Utility functions#
bw_processing.utils#
This file also defines the COMMON_DTYPE used for matrix construction:
COMMON_DTYPE = [
("row_value", np.uint32),
("col_value", np.uint32),
("row_index", np.uint32),
("col_index", np.uint32),
("uncertainty_type", np.uint8),
("amount", np.float32),
("loc", np.float32),
("scale", np.float32),
("shape", np.float32),
("minimum", np.float32),
("maximum", np.float32),
("negative", np.bool),
("flip", np.bool),
]
Creating numpy structured arrays#
- bw_processing.utils.create_structured_array(iterable, dtype, nrows=None, sort=False, sort_fields=None)#
Create a numpy structured array for data
iterable. Returns a filepath of a created file (iffilepathis provided, or the array.iterablecan be data already in memory, or a generator.nrowscan be supplied, if known. Ifiterablehas a length, it will be determined automatically. Ifnrowsis not known, this function generates chunked arrays untiliterableis exhausted, and concatenates them.