Skip to content

Data Import/Export

ExportData

Instantiates an ExportData object, used to save vectors in binary .npy or text .txt files.

Parameters:

Name Type Description Default
vector Union[ndarray, List[ndarray]]

A single vector or list of vectors to save.

required
filename str

Output file name.

required
path str

Output directory path.

'../../out'

save(binary=True)

Saves the results in a binary .npy or text .txt file.

Parameters:

Name Type Description Default
binary bool

If True, saves in binary .npy format.

True

ImportData

Instantiates an ImportData object, used to load vectors from binary .npy or text .txt files.

Parameters:

Name Type Description Default
filename str

Input file name (without extension).

required
path str

Input directory path.

'../../out'

load(mode='npy', dtype=np.float64)

Loads the saved vector.

Parameters:

Name Type Description Default
mode str

File format: npy for binary files, txt for text files.

'npy'
dtype dtype

Encoding type used, necessary for npy.

float64

Returns:

Name Type Description
data ndarray

Loaded vector.