spectrochempy.read_spg
- read_spg(*paths, **kwargs)[source]
Open a Thermo Nicolet file or a list of files with extension
.spg.- Parameters:
The data source(s) can be specified by the name or a list of name for the
file(s) to be loaded –
e.g., ( filename1, filename2, …, kwargs )
If the list of filenames are enclosed into brackets:
e.g., ( [filename1, filename2, …], kwargs )
The returned datasets are merged to form a single dataset, except if
mergeis set toFalse.**kwargs (keyword parameters, optional) – See Other Parameters.
- Returns:
- Other Parameters:
content (
bytesobject, optional)Instead of passing a filename for further reading, a bytes content can be
directly provided as bytes objects.
The most convenient way is to use a dictionary. This feature is particularly
useful for a GUI Dash application to handle drag and drop of files into a
Browser.
csv_delimiter (
str, optional, default:csv_delimiter)Set the column delimiter in CSV file.
description (
str, optional)A Custom description.
directory (
Pathobject objects or valid urls, optional)From where to read the files.
Used only when url are specified. If True, only downloading and saving of the
files is performed, with no attempt to read their content.
If `True` and several filenames or a ``directory`` have been provided as
arguments, then a single `NDDataset` with merged dataset (stacked along the first
dimension) is returned. In the case not all datasets have compatible dimensions or types/origins,
then several NDDatasets can be returned for different groups of compatible datasets.
origin (str, optional)
If provided it may be used to define the type of experiment (e.g., ‘ir’, ‘raman’,..)
or the origin of the data, e.g., ‘omnic’, ‘opus’, … It is often provided by the reader
automatically, but can be set manually.
It is used for instance whn reading directory with different types of files, for merging
the datasets with compatible dimensions and different origin into different groups.
It is also used when reading with the CSV protocol. In order to properly interpret CSV file
it can be necessary to set the origin of the spectra. Up to now only ``’omnic’`` and ``’tga’``
have been implemented.
pattern (
str, optional)A pattern to filter the files to read.
.. versionadded:: 0.7.2
protocol (
str, optional)``Protocol`` used for reading. It can be one of {``’scp’``, ``’omnic’``,
``’opus’``, ``’topspin’``, ``’matlab’``, ``’jcamp’``,
``’csv’``, ``’excel’``}. If not provided, the correct protocol
is inferred (whenever it is possible) from the filename extension.
Used only when url are specified. If True, saving of the
files is performed in the current directory, or in the directory specified by
the directory parameter.
Read also in subfolders.
Used only when url are specified. By default, existing files are not replaced
so not downloaded.
Sort multiple filename by acquisition date.
See also
read_spgRead grouped Omnic spectra.
read_spaRead single Omnic spectra.
read_srsRead series Omnic spectra.
readGeneric reader inferring protocol from the filename extension.
read_zipRead Zip archives (containing spectrochempy readable files)
read_dirRead an entire directory.
read_opusRead OPUS spectra.
read_labspecRead Raman LABSPEC spectra (
.txt).read_omnicRead Omnic spectra (
.spa,.spg,.srs).read_socRead Surface Optics Corps. files (
.ddr,.hdror.sdr).read_galacticRead Galactic files (
.spc).read_quaderaRead a Pfeiffer Vacuum’s QUADERA mass spectrometer software file.
read_topspinRead TopSpin Bruker NMR spectra.
read_csvRead CSV files (
.csv).read_matlabRead Matlab files (
.mat,.dso).read_carroucellRead files in a directory after a carroucell experiment.
read_wireRead Renishaw Wire files (
.wdf).
Notes
This method is an alias of
read_omnic, except that the type of file is constrained to.spg.Examples
>>> scp.read_spg('irdata/nh4y-activation.spg') NDDataset: [float64] a.u. (shape: (y:55, x:5549))