pept.utilities#

PEPT-oriented utility functions.

The utility functions include low-level optimised Cython functions (e.g. find_cutpoints) that are of common interest across the pept package, as well as I/O functions, parallel maps and pixel/voxel traversal algorithms.

Even though the functions are grouped in directories (subpackages) and files (modules), unlike the rest of the package, they are all imported into the pept.utilities root, so that their import paths are not too long.

pept.utilities.find_cutpoints(const double[, ...)

Compute the cutpoints from a given array of lines.

pept.utilities.find_minpoints(const double[, ...)

Compute the minimum distance points (MDPs) from all combinations of num_lines lines given in an array of lines sample_lines.

pept.utilities.group_by_column(data_array, ...)

Group the rows in a 2D data_array based on the unique values in a given column_to_separate, returning the groups as a list of numpy arrays.

pept.utilities.number_of_lines(...)

Return the number of lines (or rows) in a file.

pept.utilities.read_csv(filepath_or_buffer)

Read a given number of lines from a file and return a numpy array of the values.

pept.utilities.read_csv_chunks(...[, ...])

Read chunks of data from a file lazily, returning numpy arrays of the values.

pept.utilities.parallel_map_file(func, ...)

Utility for parallelising (read CSV chunk -> process chunk) workflows.

pept.utilities.traverse2d(double[, , ...)

Fast pixel traversal for 2D lines (or LoRs).

pept.utilities.traverse3d(double[, , , ...)

Fast voxel traversal for 3D lines (or LoRs).

pept.utilities.ChunkReader(...[, skiprows, ...])

Class for fast, on-demand reading / parsing and iteration over chunks of data from CSV files.