File Operations Module¶
Functions for importing, exporting, and saving data in various formats.
Load and Save¶
load_data ¶
Loads a dataset from filename, or displays a file dialog if no
filename is given (the dialog needs the GUI extras installed).
Container detection is by content (zip magic bytes); .mat and
legacy .npy fall back to extension:
.dvmacontainer files (zip magic bytes) — the default format since 1.5.0; safe, pickle-free (seecontainer).- legacy
.npypickle saves from pydvma <= 1.4.0 — supported forever. Trust model: the legacy path usesnp.load(allow_pickle=True), and unpickling can execute arbitrary code, so only open legacy .npy files you or your lab created..dvmafiles do not have this caveat. .mat(by extension) — JW-logger imports.
save_data ¶
Saves a DataSet to 'filename.dvma' (container format v2 — a zip
of manifest.json + pickle-free .npy arrays; see container), or
provides a dialog if no filename is given.
Legacy escape hatch: an explicit filename ending in .npy
writes the pre-1.5.0 pickle format instead, for workflows that
still need it. New saves should prefer .dvma — it is safe to
share (loading executes no code) and readable outside Python.
Parameters:
-
dataset(DataSet) –An object of the class DataSet
-
parent(optional, default:None) –Parent widget for file dialog
-
filename(str, default:None) –Output filename, dialog shown if not provided
-
overwrite_without_prompt(bool, default:False) –If True, overwrite without asking
save_fig ¶
Saves figure to file 'filename.png' and 'filename.pdf', or provides dialog if no filename provided.
Parameters:
-
plot(PlotData or Figure) –A PlotData object or matplotlib Figure object
-
parent(optional, default:None) –Parent widget for file dialog
-
figsize(tuple, default:None) –Tuple for figure size
-
filename(str, default:None) –Output filename, dialog shown if not provided
-
overwrite_without_prompt(bool, default:False) –If True, overwrite without asking
Export Functions¶
export_to_matlab ¶
Exports dataset class to file 'filename.mat', or provides dialog if no filename provided.
Saved file can be loaded directly in Matlab as set of arrays.
Parameters:
-
dataset(DataSet) –An object of the class DataSet
-
parent(optional, default:None) –Parent widget for file dialog
-
filename(str, default:None) –Output filename, dialog shown if not provided
-
overwrite_without_prompt(bool, default:False) –If True, overwrite without asking
export_to_matlab_jwlogger ¶
Exports dataset class to file 'filename.mat', or provides dialog if no filename provided.
Saved file is compatible with Jim Woodhouse logger file format.
Parameters:
-
dataset(DataSet) –An object of the class DataSet
-
parent(optional, default:None) –Parent widget for file dialog
-
filename(str, default:None) –Output filename, dialog shown if not provided
-
overwrite_without_prompt(bool, default:False) –If True, overwrite without asking
export_to_csv ¶
Exports data to file 'filename.csv', or provides dialog if no filename provided.
Saved file is *.csv
Parameters:
-
data_list(TimeDataList, FreqDataList, or TfDataList) –Data list to export
-
parent(optional, default:None) –Parent widget for file dialog
-
filename(str, default:None) –Output filename, dialog shown if not provided
-
overwrite_without_prompt(bool, default:False) –If True, overwrite without asking
Import Functions¶
import_from_matlab_jwlogger ¶
Imports dataset class from file 'filename.mat', or provides dialog if no filename provided.
Saved file is compatible with Jim Woodhouse logger file format.
Parameters:
-
filename(str, default:None) –Input filename, dialog shown if not provided