spectrochempy.read_jcamp#
- read_jcamp(*paths, **kwargs)[source]#
Open infrared, Raman, UV-visible, and supported processed 1D and real 2D NMR
JCAMP-DXfiles with extension.jdxor.dx.This is the explicit JCAMP reader in the public import API. Use
spectrochempy.readfor generic format autodetection andscp.jcamp.read(...)orspectrochempy.read_jcampwhen the JCAMP format is already known.Non-merged multi-file reads may return a list-like
ScpObjectListexposing helper methods for dataset selection. Seespectrochempy.readfor the complete description of the generic import convention and multi-object return behavior.The infrared reader supports AFFN and DIFDUP encoding (see McDonald and Paul A. Wilks [1988]). Raman and UV-visible spectra use explicit ASCII X/Y pairs in XYDATA or XYPOINTS. Multiple Raman or UV-visible files are returned as separate spectra. Processed NMR spectra use the optional NMR plugin’s interop reader.
- Parameters:
*paths (str or path-like, optional) – JCAMP-DX file paths, URLs, or a list of paths.
jcamp_kind ({“auto”, “ir”, “nmr”, “uvvis”, “raman”}, optional) – Route by the declared data type by default. Set a kind explicitly when the declaration is ambiguous. Containers with conflicting declared spectrum types are rejected. Processed real 2D NMR spectra use the NTUPLES profile and require nmrglue-ng 1.3 or later.
**kwargs (keyword parameters, optional) – See Other Parameters.
- Returns:
object (
NDDatasetorScpObjectListofNDDataset) – The returned dataset(s). When several datasets are returned, the result is a list-likeScpObjectListwith helper attributes such as.names,.select_largest(),.select_by_name(),.filter_by_ndim(), and.filter_by_shape().- 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 web application to handle drag and drop of files into a Browser.directory (
Pathobject objects or valid urls, optional) – From where to read the files.download_only (
bool, optional, default:False) – Used only when url are specified. If True, only downloading and saving of the files is performed, with no attempt to read their content.merge (
bool, optional, default:False) – IfTrueand several filenames or adirectoryhave been provided as arguments, then a singleNDDatasetwith 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.pattern (
str, optional) – A pattern to filter the files to read.Added in version 0.7.2.
read_only (
bool, optional, default:True) – 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.recursive (
bool, optional, default:False) – Read also in subfolders.replace_existing (
bool, optional, default:False) – Used only when url are specified. By default, existing files are not replaced so not downloaded.sortbydate (
bool, optional, default:True) – Sort multiple filename by acquisition date.
See also
readGeneric reader inferring protocol from the filename extension.
spectrochempy.read_zipRead Zip archives (containing spectrochempy readable files)
spectrochempy.read_dirRead an entire directory.
spectrochempy.read_opusRead OPUS spectra.
spectrochempy.read_labspecRead Raman LABSPEC spectra (
.txt).spectrochempy.read_omnicRead Omnic spectra (
.spa,.spg,.srs).spectrochempy.read_socRead Surface Optics Corps. files (
.ddr,.hdror.sdr).spectrochempy.read_spcRead Galactic files (
.spc).spectrochempy.read_quaderaRead a Pfeiffer Vacuum’s QUADERA mass spectrometer software file.
spectrochempy.read_csvRead CSV files (
.csv).spectrochempy.read_matlabRead Matlab files (
.mat,.dso).spectrochempy.read_wireRead Renishaw Wire files (
.wdf).
Examples
Using the explicit namespace API
>>> scp.jcamp.read('irdata/jcamp/nh4y-activation.jdx')
Using the legacy top-level alias
>>> scp.read_jcamp('irdata/jcamp/nh4y-activation.jdx')