compas_fab.utilities

Package containing a set of utility functions.

File system functions

list_files_in_directory

This function lists just the files in a directory, not sub-directories.

read_csv_to_dictionary

Reads a csv file and returns a dictionary with the respective keys specified in the first row of the csv file.

read_data_from_pickle

Read data from pickle file.

write_data_to_pickle

Write data to pickle file.

Numerical functions

allclose

Returns True if two lists are element-wise equal within a tolerance.

arange

Returns evenly spaced values within a given interval.

clamp

Clamps a value within the bound [min_value, max_value]

diffs

Returns the element-wise differences between two lists.

map_range

Performs a linear interpolation of a value within the range of [from_min, from_max] to another range of [to_min, to_max].

range_geometric_row

Returns a list of numbers with a certain relation to each other.

sign

Returns the sign of a number: +1 or -1.

Other functions

argmax

Returns the index of the maximum value in numbers.

argmin

Returns the index of the minimum value in numbers.

argsort

Returns the indices that would sort an array of numbers.

LazyLoader

Lazily import a module, mainly to avoid pulling in large dependencies.