Provides utilities for running nussl algorithms that do not belong to any specific algorithm or that are shared between algorithms.
utils.
add_mismatched_arrays
(array1, array2, truncate=False)¶Will add two 1D numpy arrays of different length. If truncate is false, it will expand the resultant array to the larger of the two, if True it will truncate the resultant array to the smaller of the two.
Parameters: 


Returns:  One 1D array added from the two input arrays 
utils.
add_mismatched_arrays2D
(array1, array2, truncate=False)¶Will add two 2D numpy arrays of different length. If truncate is false, it will expand the resultant array to the larger of the two, if True it will truncate the resultant array to the smaller of the two.
Parameters: 


Returns:  One 2D array added from the two input arrays 
utils.
complex_randn
(shape)¶Returns a complexvalued numpy array of random values with shape shape :param shape: (tuple) tuple of ints that will be the shape of the resultant complex numpy array
Returns: (np.ndarray
): a complexvalued numpy array of random values with shape shape
utils.
find_peak_indices
(input_array, n_peaks, min_dist=None, do_min=False, threshold=0.5)¶This function will find the indices of the peaks of an input ndimensional numpy array. This can be configured to find max or min peak indices, distance between the peaks, and a lower bound, at which the algorithm will stop searching for peaks (or upper bound if searching for max). Use exactly the same as find_peak_values().
This function currently only accepts 1D and 2D numpy arrays.
Notes
use find_peak_values().
See also
:: find_peak_values()
Parameters: 


Returns:  peak_indices – (list) list of the indices of the peak values 
utils.
find_peak_values
(input_array, n_peaks, min_dist=None, do_min=False, threshold=0.5)¶Finds the values of the peaks in a 1D or 2D numpy array. Use exactly the same as find_peak_indices(). This function will find the values of the peaks of an input ndimensional numpy array.
This can be configured to find max or min peak values, distance between the peaks, and a lower bound, at which the algorithm will stop searching for peaks (or upper bound if searching for max).
This function currently only accepts 1D and 2D numpy arrays.
Notes
use find_peak_values().
See also
:: find_peak_indices()
Parameters: 


Returns:  peak_values – (list) list of the values of the peak values 
utils.
json_numpy_obj_hook
(dct)¶Decodes a previously encoded numpy ndarray with proper shape and dtype from: http://stackoverflow.com/a/27948073/5768001 :param dct: (dict) json encoded ndarray :return: (ndarray) if input was an encoded ndarray
utils.
json_ready_numpy_array
(array)¶Adapted from: http://stackoverflow.com/a/27948073/5768001 :param array: np array to make json ready.
Returns:
utils.
json_serialize_numpy_array
(array)¶Returns a JSON string of the numpy array.
Notes
The generated JSON strings can be converted back to numpy arrays with load_numpy_json()
Parameters:  array – (numpy array) any numpy array to convert to JSON 

Returns:  (string) JSONified numpy array. 
See also
load_numpy_json()
utils.
load_numpy_json
(array_json)¶Turns a JSONified numpy array back into a regular numpy array.
Notes
This function is only guaranteed to work with JSON generated by json_serialize_numpy_array()
Parameters:  array_json – (string) JSONified nump array 

Returns:  (numpy array) numpy array from the input JSON string 
See also
json_serialize_numpy_array()