libpyhat.utils package
Submodules
libpyhat.utils.file_search module
libpyhat.utils.folds module
libpyhat.utils.lookup module
libpyhat.utils.outlier_identify module
libpyhat.utils.paths module
libpyhat.utils.utils module
- libpyhat.utils.utils.checkbandnumbers(bands, checkbands)[source]
Given a list of input bands, check that the passed tuple contains those bands.
In case of THEMIS, we check for band 9 as band 9 is the temperature band required to derive thermal temperature. We also check for band 10 which is required for TES atmosphere calculations.
Parameters
- bandstuple
of bands in the input image
- checkbandslist
of bands to check against
Returns
- : bool
True if the bands are present, else False
- libpyhat.utils.utils.checkdeplaid(incidence)[source]
Given an incidence angle, select the appropriate deplaid method.
Parameters
- incidencefloat
incidence angle extracted from the campt results.
- libpyhat.utils.utils.checkmonotonic(iterable, piecewise=False)[source]
Check if a given iterable is monotonically increasing.
Parameters
- iterableiterable
Any Python iterable object
- piecewiseboolean
If false, return a boolean for the entire iterable, else return a list with elementwise monotinicy checks
Returns
- monotonicbool/list
A boolean list of all True if monotonic, or including an inflection point
- libpyhat.utils.utils.crossform(a)[source]
Return the cross form, e.g. a in the cross product of a b. Parameters ———- a : ndarray
(3,) vector
Returns
- andarray
(3,3)
- libpyhat.utils.utils.find_in_dict(obj, key)[source]
Recursively find an entry in a dictionary
Parameters
- objdict
The dictionary to search
- keystr
The key to find in the dictionary
Returns
- itemobj
The value from the dictionary
- libpyhat.utils.utils.find_nested_in_dict(data, key_list)[source]
Traverse a list of keys into a dict.
Parameters
- datadict
The dictionary to be traversed
- key_list: list
The list of keys to be travered. Keys are traversed in the order they are entered in the list
Returns
- valueobject
The value in the dict
- libpyhat.utils.utils.getnearest(iterable, value)[source]
Given an iterable, get the index nearest to the input value
Parameters
- iterableiterable
An iterable to search
- valueint, float
The value to search for
Returns
- : int
The index into the list
- libpyhat.utils.utils.make_homogeneous(points)[source]
- Convert a set of points (n x dim array) to
homogeneous coordinates.
Parameters
- pointsndarray
n x m array of points, where n is the number of points.
Returns
- : ndarray
n x m + 1 array of homogeneous points
- libpyhat.utils.utils.normalize_vector(line)[source]
Normalize a standard form line
Parameters
- linendarray
Standard form of a line (Ax + By + C = 0)
Returns
- linendarray
The normalized line
Examples
>>> x = np.random.random((3,3)) >>> normalize_vector(x) array([[ 0.88280225, 0.4697448 , 0.11460811], [ 0.26090555, 0.96536433, 0.91648305], [ 0.58271501, 0.81267657, 0.30796395]])
- libpyhat.utils.utils.remove_field_name(a, name)[source]
Given a numpy structured array, remove a column and return a copy of the remainder of the array
Parameters
- andarray
Numpy structured array
- namestr
of the index (column) to be removed
Returns
- bndarray
Numpy structured array with the ‘name’ column removed