openqlab.io
– Import of Instrument Data¶
Convenient importers of instrument data.
Import Functions¶
- openqlab.io.read(files: str | PathLike | IO | List[str | PathLike | IO], append: bool = False, importer: str | None = None, type: str | None = None, as_list: bool = False, **kwargs) DataContainer | List[DataContainer] ¶
Import data from lab instruments.
Automatically imports lab instrument data data_files. Several importers are available, and will be used to try and import the data. Note that the same importer will be used for all data_files. The data will be returned as a Pandas
DataFrame
.- Parameters:
data_files – a filename or list of file names to import
**kwargs – optional argument list that is passed on to the importer. Use the type keyword to explicitly specify an importer.
- Returns:
a DataContainer containing the imported data with header information if available. The index of the data frame will be set to a natural x-axis, e.g. frequency or time.
- Return type:
openqlab.io.DataContainer
Examples
Read traces from an oscilloscope data file:
>>> data = io.read('scope.bin') >>> data.head() Channel 0 Channel 1 Time (s) -0.005000 -0.019347 5.22613 -0.004995 -0.019347 5.22613 ...
Read multiple data_files containing spectral data:
>>> data = io.read(['vac.txt', 'dark.txt', 'sqz.txt'])
- Raises:
UndefinedImporter – The file type cannot be recognized and cannot be imported automatically, or the given importer type does not exist (if type was specified).
- Parameters:
files – a filename or list of file names to import.
append – If True, multiple data_files will be appended row wise. If False, column wise.
kwargs – optional argument list that is passed on to the importer.
- Returns:
DataContainer with imported data_files or empty DataContainer.
Base Importer¶
Importer template
- class openqlab.io.base_importer.BaseImporter¶
- abstract property AUTOIMPORTER¶
List of strings with a regex to match the first lines.
- abstract property NAME¶
List of strings with a regex to match the first lines.