Utility classes and functions
This subpackage contains general utility classes and functions
Core utility definitions, classes, and functions
- dysh.util.core.consecutive(data, stepsize=1)[source]
Returns the indices of elements in
dataseparated by less than stepsize separated into groups.- Parameters:
- dataarray
Array with values to split.
- stepsizeint
Maximum separation between elements of
datato be considered a single group.
- Returns:
- groups
ndarray Array with values of
dataseparated into groups.
- groups
- dysh.util.core.get_size(obj, seen=None)[source]
Recursively finds size of objects. See https://goshippo.com/blog/measure-real-size-any-python-object/
- dysh.util.core.minimum_string_match(s, valid_strings)[source]
return the valid string given a minimum string input
- dysh.util.core.sq_weighted_avg(a, axis=0, weights=None)[source]
Compute the mean square weighted average of an array (2nd moment).
\(v = \sqrt{\frac{\sum_i{w_i~a_i^{2}}}{\sum_i{w_i}}}\)
- Parameters:
- Returns:
- average
ndarray The average along the input axis
- average
- dysh.util.core.stripTable(table)[source]
Remove leading and trailing chars from all strings from an input table.
- Parameters:
- table: ~astropy.table.Table
The table to strip
- dysh.util.core.uniq(seq)[source]
Remove duplicates from a list while preserving order. from http://stackoverflow.com/questions/480214/how-do-you-remove-duplicates-from-a-list-in-python-whilst-preserving-order