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’}, optional) – Deprecated. Writer dispatch is determined by the file name extension or by using an explicit specialized writer API. Passing protocol= emits a DeprecationWarning; removal remains warning-first and is governed by the SpectroChemPy deprecation lifecycle policy.

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

  • description (str, optional) – Deprecated. Exported description metadata comes from dataset.description, not from a write-time override. Passing description= emits a DeprecationWarning; removal remains warning-first and is governed by the SpectroChemPy deprecation lifecycle policy.

  • 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'