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 data separated by less than stepsize separated into groups.

Parameters:
dataarray

Array with values to split.

stepsizeint

Maximum separation between elements of data to be considered a single group.

Returns:
groupsndarray

Array with values of data separated into groups.

dysh.util.core.get_project_root() Path[source]

Returns the project root directory.

dysh.util.core.get_project_testdata() Path[source]

Returns the project testdata directory

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:
andarray

The data to average

axisint

The axis over which to average the data. Default: 0

weightsndarray or None

The weights to use in averaging. The weights array must be the length of the axis over which the average is taken. Default: None will use equal weights.

Returns:
averagendarray

The average along the input axis

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