spectrochempy.read_jcamp#

read_jcamp(*paths, **kwargs)[source]#

Open infrared, Raman, UV-visible, and supported processed 1D and real 2D NMR JCAMP-DX files with extension .jdx or .dx.

This is the explicit JCAMP reader in the public import API. Use spectrochempy.read for generic format autodetection and scp.jcamp.read(...) or spectrochempy.read_jcamp when the JCAMP format is already known.

Non-merged multi-file reads may return a list-like ScpObjectList exposing helper methods for dataset selection. See spectrochempy.read for 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 (NDDataset or ScpObjectList of NDDataset) – The returned dataset(s). When several datasets are returned, the result is a list-like ScpObjectList with helper attributes such as .names, .select_largest(), .select_by_name(), .filter_by_ndim(), and .filter_by_shape().

Other Parameters:
  • 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 web application to handle drag and drop of files into a Browser.

  • directory (Path object 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) – 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.

  • 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

read

Generic reader inferring protocol from the filename extension.

spectrochempy.read_zip

Read Zip archives (containing spectrochempy readable files)

spectrochempy.read_dir

Read an entire directory.

spectrochempy.read_opus

Read OPUS spectra.

spectrochempy.read_labspec

Read Raman LABSPEC spectra (.txt).

spectrochempy.read_omnic

Read Omnic spectra (.spa, .spg, .srs).

spectrochempy.read_soc

Read Surface Optics Corps. files (.ddr , .hdr or .sdr).

spectrochempy.read_spc

Read Galactic files (.spc).

spectrochempy.read_quadera

Read a Pfeiffer Vacuum’s QUADERA mass spectrometer software file.

spectrochempy.read_csv

Read CSV files (.csv).

spectrochempy.read_matlab

Read Matlab files (.mat, .dso).

spectrochempy.read_wire

Read 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')

Examples using spectrochempy.read_jcamp#

Read an experimental Raman spectrum from JCAMP-DX

Read an experimental Raman spectrum from JCAMP-DX

Read a UV-visible spectrum from JCAMP-DX

Read a UV-visible spectrum from JCAMP-DX

Write and read an infrared spectrum in JCAMP-DX

Write and read an infrared spectrum in JCAMP-DX