Reading a PerkinElmer SP file (plugin)

This example shows how to read a PerkinElmer .sp binary IR file using the optional spectrochempy-perkinelmer plugin.

Hint

Requires the official ``spectrochempy-perkinelmer`` plugin. Install with: pip install spectrochempy[perkinelmer].


import spectrochempy as scp

Read the sample PerkinElmer file

The PerkinElmer reader is available through the namespaced API scp.perkinelmer. A single-spectrum .sp file is loaded as an NDDataset with wavelength coordinates and available metadata.

datadir = scp.preferences.datadir
filename = datadir / "irdata" / "perkinelmer" / "spectra.sp"

dataset = scp.perkinelmer.read(filename)

Display the dataset summary:

NDDataset [spectra] — float64, shape: (y:1, x:3301), a.u.
name
:
spectra
author
:
runner@runnervmmklqx
created
:
2026-06-26 18:16:25+00:00
description
:
Spectrum at 5673,-2148,294 Micrometers Aperture: 100,100
history
:
2026-06-26 18:16:25+00:00> Imported from PerkinElmer .sp file /home/runner/.spectrochempy/testdata/irdata/perkinelmer/spectra.sp.
Data
title
:
intensity
values
:
[[ 0.03724 0.03719 ... 0.003684 0.004176]] a.u.
shape
:
(y:1, x:3301)
Dimension `x`
size
:
3301
title
:
wavelength
coordinates
:
[ 4000 3999 ... 701 700] nm
Dimension `y`
size
:
1
title
:
spectrum index
coordinates
:
[ 0]


The dataset preserves available metadata from the PerkinElmer file:

print(f"Instrument model: {dataset.meta.instrument_model}")
print(f"Detector:        {dataset.meta.detector}")
print(f"Source:          {dataset.meta.source}")
print(f"Analyst:         {dataset.meta.analyst}")
print(f"Date:            {dataset.meta.date}")
print(f"Accumulations:   {dataset.meta.accumulations}")
Instrument model: Spectrum One
Detector:        MCT
Source:          MIR
Analyst:         None
Date:            Thu Mar 09 09:17:56 2006
Accumulations:   32

Plot the spectrum:

plot spectrochempy perkinelmer  plot read perkinelmer

This ends the example ! The following line can be removed or commented when the example is run as a notebook (ipynb).

# scp.show()

Total running time of the script: (0 minutes 0.144 seconds)