SPCATParser

SPCATParser reads catalog files written by the Pickett SPFIT/SPCAT package, which are conventionally given the .cat suffix. SPCAT is the de facto reference format for asymmetric-top line catalogs in microwave and millimeter-wave spectroscopy; many other fitting programs emit a SPCAT-compatible .cat file as their primary user output, so this parser covers a large fraction of the catalogs that users overlay onto a measured spectrum.

The format is fixed-width with eighty characters per line: frequency (MHz), calculated error (MHz), log-base-10 intensity, degeneracy, lower-state energy (cm⁻¹), species tag, format code, and quantum-number assignments starting at column 55. The format code controls how the quantum-number block is interpreted; SPCATParser preserves the field grouping but strips embedded semicolons so the quantum-number strings round-trip safely through Blackchirp’s semicolon-delimited CSV storage. Lines shorter than 80 characters are right-padded; longer lines are truncated. Lines that do not produce a valid transition (zero frequency or unparseable fields) are silently skipped, so a catalog file with a trailing summary block parses without manual editing.

The output CatalogData carries sourceProgram = "SPCAT" and a molecule name taken from the file’s base name. The parser is registered with FileParserRegistry during application startup; the user-facing catalog overlay workflow is described in Overlays.

API Reference

class SPCATParser : public CatalogParser

Parser for SPCAT catalog (*.cat) output.

Public Functions

SPCATParser()
virtual bool canParse(const QString &filePath, const QVariantMap &hints = QVariantMap()) const override

Recognize a file by .cat suffix and a structural sniff of the first lines.

virtual CatalogData parse(const QString &filePath, const QVariantMap &hints = QVariantMap()) const override

Parse a recognized SPCAT file into a :cpp:class:CatalogData.

Sets the sourceProgram field to "SPCAT" and the moleculeName field to the file’s base name. Lines that do not produce a valid transition are silently skipped.

virtual QString formatName() const override

Returns "SPCAT".

virtual QString formatDescription() const override

Returns a one-line description of the format.

virtual QStringList fileExtensions() const override

Returns {"*.cat"}.

Private Functions

TransitionData parseLine(const QString &line) const

Parse a single 80-character SPCAT line into a TransitionData.

Returns:

TransitionData with positive frequency on success; an invalid (zero-frequency) record on failure.

QString parseQuantumNumbers(const QString &line, int formatCode) const

Extract and format the quantum-number block from an SPCAT line.

Parameters:
  • line – Full 80-character catalog line.

  • formatCode – SPCAT format code that controls the quantum-number layout.

Returns:

Formatted quantum-number string with embedded semicolons stripped for CSV safety.

double convertIntensity(double logIntensity) const

Convert a base-10 log intensity to its linear value.

Parameters:

logIntensity – log₁₀(intensity in nm²·MHz).

bool validateFormat(const QString &filePath) const

Sniff the first lines of filePath to confirm SPCAT fixed-width structure.