Exporters: getting data out of ixdat
Using the exporters, you can export data collected e.g.: from different files using ixdat
in a standardized way, saving the data most relevant for each technique. Note that some raw data may not be saved using the exporters (see Reading .csv files exported by ixdat: The IxdatCSVReader). Use the menu on the right for easier navigation between the different sections.
The csv_exporter
module
Classes for exporting measurement data
- class ixdat.exporters.csv_exporter.CSVExporter(measurement=None)[source]
The default exporter, which writes delimited measurement data row-wise to file
- property aliases
The aliases, needed for techniques with essential series that get renamed.
- default_export_columns = None
The names of the value series to export by default.
- delim = ','
The default delimiter
- export(path_to_file=None, measurement=None, columns=None, tspan=None, time_step=None, delim=None)[source]
Export a given measurement to a specified file.
To improve flexibility with inheritance, this method delegates its work to: - CSVExporter.prepare_header_and_data() - CSVExporter.write_header() - CSVExporter.write_data()
- Parameters
measurement (Measurement) –
The measurement to export. Defaults to self.measurement. TODO: remove this kwarg. See conversation here:
path_to_file (Path) – The path to the file to write. If it has no suffix, a .csv suffix is appended. Defaults to f”{measurement.name}.csv”
columns (list of str) – The names of the data series to include. Defaults in CSVExporter to all VSeries and TSeries in the measurement. This default may be overwritten in inheriting exporters.
tspan (timespan) – The timespan to include in the file, defaults to all of it
time_step (float) – Optional. The time spacing between data points. Can be used to reduce file size.
delim (str) – Delimiter. Defaults to self.delim (which is “,” by default)
- prepare_header_and_data(measurement, columns, tspan=None, time_step=None)[source]
Prepare self.header_lines to include metadata and value-time pairs
- Parameters
measurement (Measurement) – The measurement being exported
columns (list of str) – The names of the ValueSeries to include
tspan (timespan) – The timespan of the data to include in the export
time_step (float) – Optional. The time spacing between data points. Can be used to reduce file size.
Keyword arguments
tspan
andtime_step
as inexport()
.
The ec_exporter
module
- class ixdat.exporters.ec_exporter.ECExporter(measurement=None)[source]
A CSVExporter that by default exports potential, current, and selector
- property aliases
Ensure that the essential series are accessible as aliases.
- property default_export_columns
The default v_list for ECExporter is V_str, J_str, and sel_str
The ecms_exporter
module
- class ixdat.exporters.ecms_exporter.ECMSExporter(measurement=None)[source]
A CSVExporter that by default exports potential, current, selector, and all MID
- property default_export_columns
The default EC columns plus all MID signals
- export(path_to_file=None, measurement=None, columns=None, v_list=None, mass_list=None, mol_list=None, tspan=None, time_step=None)[source]
Export a given measurement to a specified file.
This method delegates the majority of the export work, via inheritance, to: - CSVExporter.prepare_header_and_data() - CSVExporter.write_header() - CSVExporter.write_data()
- Parameters
path_to_file (Path) – The path to the file to write. If it has no suffix, a .csv suffix is appended. Defaults to f”{measurement.name}.csv”
measurement (Measurement) –
The measurement to export. Defaults to self.measurement. TODO: remove this kwarg. See conversation here:
columns (list of str) – The names of the data series to include. Defaults to potential, current, and all MID signals.
v_list – DEPRECATED. Use columns instead.
mass_list (list of str) – Names of masses to export. Defaults to all.
mol_list (list of str or ECMSCalResult) – Names of mols for which to export quantified data.
tspan (timespan) – The timespan to include in the file, defaults to all of it
time_step (float) – Optional. The time spacing between data points. Can be used to reduce file size. Requires tspan.
The spectrum_exporter
module
- class ixdat.exporters.spectrum_exporter.SpectrumExporter(spectrum)[source]
An ixdat CSV exporter for spectra. Uses pandas.
- delim = ','
The separator for the .csv file. Has to be single-char due to pandas
- export(path_to_file, spectrum=None)[source]
Export spectrum to path_to_file.
- Parameters
path_to_file (str or Path) – The path of the file to export to. Note that if a file already exists with this path, it will be overwritten.
spectrum (Spectrum) –
The spectrum to export if different from self.spectrum TODO: remove this kwarg. See conversation here:
- class ixdat.exporters.spectrum_exporter.SpectrumSeriesExporter(spectrum_series)[source]
An exporter for ixdat spectrum series.
- delim = ','
The separator for the .csv file. Has to be single-char due to pandas
- export(path_to_file=None, spectrum_series=None, spectra_as_rows=True)[source]
Export spectrum series to path_to_file.
- Parameters
spectrum_series (Spectrum) –
The spectrum_series to export if different from self.spectrum_series TODO: remove this kwarg. See conversation here:
path_to_file (str or Path) – The path of the file to export to. Note that if a file already exists with this path, it will be overwritten.
spectra_as_rows (bool) – This specifies the orientation of the data exported. If True, the scanning variabe (e.g. wavelength) increases to the right and the time variable increases downward. If False, the scanning variable increases downwards and the time variable increases to the right. Either way it is clarified in the file header. Defaults to True.
The sec_exporter
module
- class ixdat.exporters.sec_exporter.SECExporter(measurement)[source]
Adds to CSVExporter the export of the Field with the SEC spectra
- property default_export_columns
The default v_list for SECExporter is that from EC and tracked wavelengths
- prepare_header_and_data(measurement, columns, tspan=None, time_step=None)[source]
Do the standard ixdat csv export header preparation, plus SEC stuff.
- The SEC stuff is:
export the spectroelectrochemistry spectra
export the actual reference spectrum
- add lines to the main file header pointing to the files with the
above two exports.
Args and Kwargs: see
ECExporter.prepare_header_and_data()