Warning

You are reading the documentation related to the development version. Go here if you are looking for the documentation of the stable release.

spectrochempy.write

write(dataset, filename=None, **kwargs)[source]

Write the current dataset.

Parameters
  • dataset (NDDataset) – Dataset to write.

  • filename (str or pathlib object, optional) – If not provided, a dialog is opened to select a file for writing.

  • **kwargs – Optional keyword parameters (see Other Parameters).

Returns

output_path – Path of the output file.

Other Parameters
  • protocol ({‘scp’, ‘matlab’, ‘jcamp’, ‘csv’, ‘excel’}, optional) – Protocol used for writing. If not provided, the correct protocol is inferred (whnever it is possible) from the file name extension.

  • directory (str, optional) – Where to write the specified filename . If not specified, write in the current directory.

  • description (str, optional) – A Custom description.

  • csv_delimiter (str, optional) – Set the column delimiter in CSV file. By default it is the one set in SpectroChemPy Preferences .

See also

save

Generic function for saving a NDDataset in SpectroChemPy format.

Examples

write a dataset (providing a windows type filename relative to the default Datadir )

>>> nd = scp.read_opus('irdata/OPUS')
>>> f = nd.write('opus.scp') 
>>> f.name                   
'opus.scp'