spectrochempy.read_spa
- read_spa(*paths, **kwargs)[source][source]
Open a Thermo Nicolet file or a list of files with extension
.spa
.- Parameters:
*paths (
str
,Path
object objects or valid urls, optional) – 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
merge
is set toFalse
.If a source is not provided (i.e., no
paths
, norcontent
), a dialog box will be opened to select files.**kwargs (keyword parameters, optional) – See Other Parameters.
- Returns:
object (
NDDataset
or list ofNDDataset
) – The returned dataset(s).- Other Parameters:
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.directory (
Path
object objects or valid urls, optional) – From where to read the files.merge (
bool
, optional, default:False
) – IfTrue
and several filenames or adirectory
have been provided as arguments, then a singleNDDataset
with merged (stacked along the first dimension) is returned.sortbydate (
bool
, optional, default:True
) – Sort multiple filename by acquisition date.description (
str
, optional) – A Custom description.origin (one of {
'omnic'
,'tga'
}, optional) – 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.csv_delimiter (
str
, optional, default:csv_delimiter
) – Set the column delimiter in CSV file.content (
bytes
object, 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.iterdir (
bool
, optional, default:True
) – IfTrue
and no filename was provided, all files present in the provideddirectory
are returned (and merged ifmerge
isTrue
. It is assumed that all the files correspond to current reading protocol.Changed in version 0.6.2:
iterdir
replace the deprecatedlistdir
argument.
See also
read
Generic reader inferring protocol from the filename extension.
read_zip
Read Zip archives (containing spectrochempy readable files)
read_dir
Read an entire directory.
read_opus
Read OPUS spectra.
read_labspec
Read Raman LABSPEC spectra (
.txt
).read_omnic
Read Omnic spectra (
.spa
,.spg
,.srs
).read_soc
Read Surface Optics Corps. files (
.ddr
,.hdr
or.sdr
).read_galactic
Read Galactic files (
.spc
).read_quadera
Read a Pfeiffer Vacuum’s QUADERA mass spectrometer software file.
read_topspin
Read TopSpin Bruker NMR spectra.
read_csv
Read CSV files (
.csv
).read_jcamp
Read Infrared JCAMP-DX files (
.jdx
,.dx
).read_matlab
Read Matlab files (
.mat
,.dso
).read_carroucell
Read files in a directory after a carroucell experiment.
read_wire
Read REnishaw Wire files (
.wdf
).
Notes
This method is an alias of
read_omnic
, except that the type of file is contrain to.spa
.Examples
>>> scp.read_spa('irdata/subdir/20-50/7_CZ0-100 Pd_21.SPA') NDDataset: [float64] a.u. (shape: (y:1, x:5549)) >>> scp.read_spa(directory='irdata/subdir', merge=True) NDDataset: [float64] a.u. (shape: (y:4, x:5549))