Skip to content

saving

A module with functions for efficient saving and loading of RUL features and targets.

exists(save_path)

Return if the files resulting from a save call with save_path exist.

Parameters:

Name Type Description Default
save_path str

the save_path the save function was called with

required

Returns:

Type Description
bool

Whether the files exist

load(save_path, memmap=False)

Load features and targets of a run from .npy files.

This method is used to restore runs that were saved with the save function. If the runs are too large for the RAM, memmap can be set to True to avoid reading them completely to memory. This results in slower processing, though.

Parameters:

Name Type Description Default
save_path str

Path that was supplied to the save function.

required
memmap bool

whether to use memmap to avoid loading the whole run into memory

False

Returns:

Name Type Description
features ndarray

The feature array saved in save_path

targets ...

The target array saved in save_path

load_multiple(save_paths, memmap=False)

Load multiple runs with the load function.

Parameters:

Name Type Description Default
save_paths List[str]

The list of run files to load.

required
memmap bool

See load

False

Returns:

Name Type Description
features List[ndarray]

The feature arrays saved in save_paths

targets ...

The target arrays saved in save_paths

save(save_path, features, *targets)

Save features and targets of a run to .npy files.

The arrays are saved to separate .npy files to enable memmap mode in case RAM is short. The files are saved as _features.npy and _targets.npy. To load the files, supply the same save_path to the load function. If the save_path does not have the .npy file extension .npy will be appended.

Parameters:

Name Type Description Default
save_path str

The path including file name to save the arrays to.

required
features ndarray

The feature array to save.

required
targets ndarray

The targets arrays to save.

()