Note
Go to the end to download the full example code.
Reading SPC format files
This example shows reading of ‘Galactic Industries’ SPC data file format. (.spc format).
Import the package
import spectrochempy as scp
Read a single spectrum file
ex1 = scp.read_spc("galacticdata/BENZENE.SPC")
_ = ex1.plot()
ex1

NDDataset [/home/runner/.spectrochempy/testdata/galacticdata/BENZENE.SPC] — float64, shape: (y:1, x:1842), a.u.
name
:
/home/runner/.spectrochempy/testdata/galacticdata/BENZENE.SPC
author
:
runner@runnervm5mmn9
created
:
2026-07-10 21:25:14+00:00
description
:
Dataset from spc file.
Memo: FT-IR Spectrum of Benzene, Capillary Film.
Memo: FT-IR Spectrum of Benzene, Capillary Film.
history
:
2026-07-10 21:25:14+00:00> Imported from spc file /home/runner/.spectrochempy/testdata/galacticdata/BENZENE.SPC.
Data
title
:
Absorbance
values
:
[[ 0.1016 0.09619 ... 0.0144 0.01514]] a.u.
shape
:
(y:1, x:1842)
Dimension `x`
size
:
1842
title
:
Wavenumbers
coordinates
:
[ 449.4 451.4 ... 3999 4000] cm⁻¹
Dimension `y`
size
:
1
title
:
acquisition timestamp (GMT)
coordinates
:
[8.579e+08] s
labels
:
[ 1997-03-09 08:46:00]
Read merged subfiles
When subfiles share the same x-coordinates, they are merged automatically:
ex2 = scp.read_spc("galacticdata/CONTOUR.SPC")
_ = ex2.plot()
ex2

NDDataset [/home/runner/.spectrochempy/testdata/galacticdata/CONTOUR.SPC] — float64, shape: (y:19, x:179), a.u.
name
:
/home/runner/.spectrochempy/testdata/galacticdata/CONTOUR.SPC
author
:
runner@runnervm5mmn9
created
:
2026-07-10 21:25:14+00:00
description
:
Dataset from spc file.
Memo: Subfiles are the Same Portion of POLYS Multiplied by a Sine Wave.
Memo: Subfiles are the Same Portion of POLYS Multiplied by a Sine Wave.
history
:
2026-07-10 21:25:14+00:00> Imported from spc file /home/runner/.spectrochempy/testdata/galacticdata/CONTOUR.SPC.
Data
title
:
Absorbance
values
:
[[5.282e-05 4.543e-05 ... 6.53e-05 5.282e-05]
[5.217e-05 4.488e-05 ... 6.45e-05 5.217e-05]
...
[5.243e-05 4.51e-05 ... 6.482e-05 5.243e-05]
[5.335e-05 4.589e-05 ... 6.596e-05 5.335e-05]] a.u.
[5.217e-05 4.488e-05 ... 6.45e-05 5.217e-05]
...
[5.243e-05 4.51e-05 ... 6.482e-05 5.243e-05]
[5.335e-05 4.589e-05 ... 6.596e-05 5.335e-05]] a.u.
shape
:
(y:19, x:179)
Dimension `x`
size
:
179
title
:
Wavenumbers
coordinates
:
[ 3132 3130 ... 2791 2789] cm⁻¹
Dimension `y`
size
:
19
title
:
axis title
coordinates
:
[ 0 2 ... 34 36]
Read subfiles with different x-coordinates
Subfiles with distinct x-coordinates are returned as a list:

List (len=6, type=NDDataset)
0: NDDataset [/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC] — float64, shape: (y:1, x:124)
name
:
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC
author
:
runner@runnervm5mmn9
created
:
2026-07-10 21:25:14+00:00
description
:
Dataset from spc file.
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
history
:
2026-07-10 21:25:14+00:00> Imported from spc file
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
Data
title
:
Arbitrary Intensity
values
:
...
[[ 2803 1.723e+04 ... 7720 1930]]
shape
:
(y:1, x:124)
1: NDDataset [/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC] — float64, shape: (y:1, x:141)
name
:
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC
author
:
runner@runnervm5mmn9
created
:
2026-07-10 21:25:14+00:00
description
:
Dataset from spc file.
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
history
:
2026-07-10 21:25:14+00:00> Imported from spc file
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
Data
title
:
Arbitrary Intensity
values
:
...
[[ 6180 1823 ... 5930 2219]]
shape
:
(y:1, x:141)
2: NDDataset [/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC] — float64, shape: (y:1, x:237)
name
:
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC
author
:
runner@runnervm5mmn9
created
:
2026-07-10 21:25:14+00:00
description
:
Dataset from spc file.
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
history
:
2026-07-10 21:25:14+00:00> Imported from spc file
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
Data
title
:
Arbitrary Intensity
values
:
...
[[ 2491 2.89e+04 ... 1.123e+04 2132]]
shape
:
(y:1, x:237)
3: NDDataset [/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC] — float64, shape: (y:1, x:237)
name
:
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC
author
:
runner@runnervm5mmn9
created
:
2026-07-10 21:25:14+00:00
description
:
Dataset from spc file.
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
history
:
2026-07-10 21:25:14+00:00> Imported from spc file
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
Data
title
:
Arbitrary Intensity
values
:
...
[[ 2096 3.101e+04 ... 5209 2257]]
shape
:
(y:1, x:237)
4: NDDataset [/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC] — float64, shape: (y:1, x:253)
name
:
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC
author
:
runner@runnervm5mmn9
created
:
2026-07-10 21:25:14+00:00
description
:
Dataset from spc file.
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
history
:
2026-07-10 21:25:14+00:00> Imported from spc file
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
Data
title
:
Arbitrary Intensity
values
:
...
[[1.592e+04 3352 ... 2.961e+04 4199]]
shape
:
(y:1, x:253)
5: NDDataset [/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC] — float64, shape: (y:1, x:80)
name
:
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC
author
:
runner@runnervm5mmn9
created
:
2026-07-10 21:25:14+00:00
description
:
Dataset from spc file.
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
Memo: Multifile of Peak Mass Spectra from Drug Sample.spcFormat
Log Text:
---------
[FILEINFO]
1999/10/14 14:10 W = Modified Date/Time (FILEINFO.AB) User=brigitte
Version = 5.22
[END FILEINFO]
[GC-MS]
Version = 1.10
2000/09/12 12:44 I = Interpolated (GCMS.AB) User=Brigitte
2000/09/12 12:44 T = Truncated (GCMS.AB) User=Brigitte
Original File = drug sample.spc
Operation: Save TIC peaks to Multifile
Peak Spectra:
Subfile # Left Bsln Center Z Right Bsln
74 4.66900015 4.75843334 4.85790014
176 5.68198347 5.77180004 5.81143332
187 5.82154989 5.88114977 5.98111677
242 6.33855009 6.42843342 6.52845001
279 6.70749998 6.79773331 6.89788342
306 6.9770999 7.06698322 7.16693354
[END GC-MS]
[FILEINFO]
2000/09/12 12:45 W = Modified Date/Time (FILEINFO.AB) User=Brigitte
Version = 6.00
[END FILEINFO]
history
:
2026-07-10 21:25:14+00:00> Imported from spc file
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
/home/runner/.spectrochempy/testdata/galacticdata/DRUG_SAMPLE_PEAKS.SPC.
Data
title
:
Arbitrary Intensity
values
:
...
[[ 9301 1.36e+04 ... 1.953e+04 1813]]
shape
:
(y:1, x:80)
Total running time of the script: (0 minutes 1.232 seconds)