Measurement
- class specatalog.models.measurements.Measurement(**kwargs)[source]
Base class representing a single measurement.
This model defines the core metadata shared by all measurement types in the system (e.g., TREPR, CWEPR, PulseEPR). It serves as the root of a polymorphic SQLAlchemy hierarchy, with
methodacting as the discriminator. Subclasses inherit these fields and may define additional, technique-specific information.The measurement belongs to exactly one
Moleculeinstance, and contains essential experiment metadata.Polymorphism
SQLAlchemy polymorphic behaviour is used to distinguish different measurement techniques:
polymorphic_on– themethodcolumnpolymorphic_identity–"base"for this class
Subclasses should set their own
polymorphic_identityvalue.Relationships
- moleculeMolecule
The molecule to which the measurement belongs. Configured as a required foreign key with cascade delete behaviour.
- id
Primary key identifying the measurement.
- Type:
int
- molecular_id
Foreign key referencing
molecules.id. Required.- Type:
int
- method
Polymorphic discriminator describing the measurement technique (e.g.,
"trepr","cwepr","pulse_epr").- Type:
str
- temperature
Measurement temperature in Kelvin (or laboratory-specific units).
- Type:
float
- solvent
Solvent used in the experiment.
- Type:
str
- concentration
Concentration of the sample, if provided.
- Type:
str or None
- date
Date on which the measurement was performed.
- Type:
datetime.date
- measured_by
The operator who performed the measurement.
- Type:
str
- location
Laboratory or instrument location of the measurement.
- Type:
str or None
- device
Device/instrument identifier.
- Type:
str or None
- series
Optional series identifier grouping related measurements.
- Type:
str or None
- path
Absolute path to the associated measurement directory in the archive. Must be unique.
- Type:
str
- corrected
Trueif the measurement has been corrected.- Type:
bool
- evaluated
Trueif the measurement has been analysed.- Type:
bool
Notes
The tablename is
measurementsAll measurement subclasses inherit timestamps from
TimeStampedModel.The
pathfield is unique, ensuring that individual measurements are not duplicated.
Examples
Creating a measurement:
>>> from measurements import Measurement >>> from molecules import Molecule >>> mol = Molecule(...) >>> m = Measurement( ... molecule=mol, ... method="TREPR", ... temperature=295.0, ... solvent="Toluene", ... date=date(2025, 1, 4), ... measured_by="Alice", ... path="/data/M12/", ... corrected=False, ... evaluated=False, ... ) >>> session.add(m) >>> session.commit()