misc

module of dascore.utils source

Misc Utilities.

Functions

Name Description
all_close Return True if ar1 is all close to ar2.
all_diffs_close_enough Check if all the diffs are ‘close’ handling timedeltas.
broadcast_for_index For a given shape of array, return empty slices except for slice axis.
cached_method Cache decorated method.
check_code Validate a single code token of an acquisition key.
check_filter_kwargs Check filter kwargs and return dim name and filter range.
check_filter_range Simple check on filter parameters.
check_filter_sequence Ensure the filter sequence is the right shape.
deep_equality_check Deep equality comparison for dictionaries and nested objects.
express_range_for_coord Re-express one index-side range in what a patch coordinate needs.
get_2d_line_intersection Return intersection point of two lines (p1,p2) and (p3,p4).
get_buffer_size Get the size of a buffer in bytes.
get_middle_value Get the middle value in the differences array without changing dtype.
get_parent_code_name Get the name of the calling function/class levels up in stack.
get_stencil_coefs Get centered coefficients for a derivative of specified order and derivative.
is_range True for a 2-tuple range (a (start, stop) selector).
is_strictly_monotonic Return True if a 1D sequence is strictly monotonic.
iterate Return an iterable from any object.
maybe_get_items Maybe get items from a mapping (if they exist).
maybe_mem_map Try to get a memory map array from fid, otherwise just return array.
optional_import Import a module and return the module object if installed.
order_range_tuple Ensure finite range bounds are in increasing order.
register_func Decorator for registering a function name in a list or dict.
sanitize_range_param Given a slice or tuple, check and return slice or tuple.
suppress_warnings Context manager for configuring warnings inside a local scope.
to_object_array Convert a sequence of objects to a numpy array of objects.
to_str Convert value to string.
tukey_fence Apply Tukey’s fence to determine data range without outliers.
unbyte Decode a bytes value, passing anything else through unchanged.
validate_acquisition_key Validate a composite acquisition key.
validate_warn_level Ensure a warn-level argument is one of the supported values.
warn_or_raise A helper function to issues a warning, raise an exception or do nothing.
yield_sub_sequences Yield subsequences of a sequence for specified length.