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 (iffilepath
is provided, or the array.iterable
can be data already in memory, or a generator.nrows
can be supplied, if known. Ifiterable
has a length, it will be determined automatically. Ifnrows
is not known, this function generates chunked arrays untiliterable
is exhausted, and concatenates them.