sps.make_sps_index
- sps.make_sps_index(filepath_prefix: str = '', num_dimensions: int = 2, num_orthotope_dimensions: int = 0, storage_type: str = 'Ram', open_in_write_mode: bool = True) sps.AbstractIndex
Factory for the sparse prefix sum indices.
- Parameters:
filepath_prefix (str) – Prefix path of the index on the filesystem (multiple files with different endings will be created), defaults to “”.
num_dimensions (int) – Number of dimensions for datapoints in the index, defaults to 2.
num_orthotope_dimensions (int) – Number of orthotope dimensions for the index (i.e. in how many dimensions do the data-hyperrectangles have thickness), defaults to 0.
storage_type (str) – The way the datastructure interacts with the filesystem, defaults to Ram.
open_in_write_mode (str) – Open the index in write mode (if this is set to False no changes can be made to the index), defaults to True.
- Returns:
The sparse prefix sum datastructure.
- Return type:
A child of libSps.AbstractIndex.
Acceptable storage_types are:
“Disk” to create indices that load all data from a file on startup and store it back to the file on shutdown. Expect them to consume as much RAM as the filesize.
“Cached” to create indices that use a cache to load data from and store data to a file dynamically as needed during runtime. Expect this storage type to be slightly slower than the other two options. For large datasets this storage is necessary, as it allows the RAM usage to be independent of the amount of data stored.
“Ram” to create indices that store all information in RAM and never interact with the filesystem.
“PickByFileSize” to use the Disk option if the index is opened with open_in_write_mode=False and the index file requires less than half of the available RAM, otherwise Cached is used.