Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
python-version: ["3.12", "3.13", "3.14"]
include:
- os: macos-latest
python-version: "3.14"
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `apparatus_kind` argument to `ReSpecTh_to_ChemKED` and `-ak/--apparatus-kind` to `respth2ck`, for files whose apparatus ReSpecTh records only as the generic `flame`
- `uncertainty` and `evaluated standard deviation` properties and dataGroup columns are converted and attached to the quantity they describe, whether that is a datapoint value, a common property, a species amount, or a concentration profile
- ReSpecTh `comment` elements are converted to ChemKED `comments`
- `convert_to_ReSpecTh` writes speciation measurements, as whichever of ReSpecTh's four speciation types fits the apparatus and the swept axis. Each datapoint becomes a dataGroup, the inverse of `get_speciation_datapoints`, so `ReSpecTh_to_ChemKED` reads the file back as the same ChemKED file; all 576 speciation files of the ChemKED database do
- `isvalid_experiment` validation rule cross-checking `experiment-type` against the datapoint contents and the apparatus kind, which the `anyof` datapoints schema cannot do on its own
- Round-trip tests asserting the converter reproduces each checked-in ReSpecTh/ChemKED fixture pair
- `resolve_reference` maps an uncertainty that points at a column by its `label` or `id`, and one that references `initial composition`, onto the quantity it describes; both were silently dropped before
- `0.5.0` added to the allowed `chemked-version` values, and a test asserting the current `__version__` is always among them, since `get_file_metadata` stamps it into every converted file
- Physicality checks on speciation profile values: a `concentration-profiles` amount may not be negative, and an `auxiliary-profiles` temperature, pressure or volume must be above zero on its absolute scale. Profile values declare their units once in the `quantity` block rather than per point, so they never reached `isvalid_quantity` and could hold any float, including the -1111 K and -9.9999e+94 missing-data placeholders that ReSpecTh conversions carry through
- A ReSpecTh `timeshift` element is read into the `time-shift` of every speciation datapoint; it was dropped before. `half increase` is added to the allowed `time-shift.type` values, as ReSpecTh uses it
- A concentration profile can say what the uncertainty at the end of each row is: the fields of one kind in its `uncertainty` mapping given without a value, such as `evaluated-standard-deviation-type`, `-sourcetype` and `-method`, describe the row values. `get_speciation_datapoints` records the name, kind, sourcetype and method of a varying uncertainty column this way, and `convert_to_ReSpecTh` writes the column back as described. A plain absolute uncertainty with no sourcetype needs no fields, and remains what a row's last value means by default

### Changed
- Python 3.12 or later and Pint 0.26 or later are required; Python 3.10 and 3.11 are no longer supported. Pint 0.26 itself requires Python 3.12, and earlier Pint releases cannot read a value written as a string in an offset unit, such as `"25 degC"`, so a file with a temperature in `degC` or `degF` failed to load with them
- The `tubular reactor` apparatus kind is renamed `flow reactor`, the name ReSpecTh, the ChemKED database, and the speciation literature all use. `tubular reactor` is still accepted as converter input and maps to `flow reactor`
- The mole and mass fraction sum check uses a relative tolerance of 1e-3 (`composition_sum_tolerance`) rather than the NumPy default of 1e-5, so compositions reported to a few digits are not rejected for round-off
- An auxiliary profile against a `residence-time` axis is recorded with the axis name `time`, which `auxiliary-profiles.independent.name` allows, since a residence time is a time coordinate
- An absolute uncertainty of exactly zero is accepted, meaning none was reported. The quantity it describes must still be above zero, but the uncertainty itself may be zero, the same view `isvalid_composition` takes of a composition amount of zero. Only a negative uncertainty is an error, reported as `uncertainty must not be negative`

### Fixed
- An `uncertainty` common property with `bound="upper"` or `bound="lower"` was read as a symmetric uncertainty, so the second bound overwrote the first. The bound is now kept, as it already was for a dataGroup column
- An uncertainty column about a concentration profile was scaled by the unit factor of the profile instead of its own: an evaluated standard deviation in mole fraction on a ppm profile came out 10⁶ too small, and one on a percent profile 100 too small. A common uncertainty about a profile was scaled to its own kind, so one in mole fraction stayed a mole fraction on a mole percent or mol/cm3 profile. An absolute uncertainty, in a column or common, is now converted from its own units to those of the profile, and a relative one is not rescaled. One that cannot be converted, such as a mole fraction about a concentration profile, which would need the density of the mixture, is dropped with a warning
- A composition amount of exactly zero, meaning a species measured as absent, is accepted when it carries uncertainty metadata. It was accepted without metadata and rejected with it, and `isvalid_composition` already allowed it. Only a negative value is an error for a property with no configured units
- The unsupported-composition-units error lists the units the converter actually accepts, built from `composition_units` rather than hand-written, so it cannot fall behind the table again
- Every text file is now opened with an explicit UTF-8 encoding. Reading or writing a ChemKED or ReSpecTh file whose author names contain non-ASCII characters previously depended on the platform's preferred encoding, and failed on Windows. `convert_to_ReSpecTh` could also rewrite its pretty-printed XML in the platform encoding while declaring UTF-8 in the file. The ruff rule `PLW1514` now enforces this
Expand All @@ -34,6 +42,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `ignitionType` is only required for ignition delay files
- `composition_schema.yaml` now references the shared `uncertainty-metadata` definition instead of a hand-copied duplicate that had drifted to `type: float`, so a species amount accepts the same uncertainty forms as every other quantity. The definition is hoisted to its own top-level anchor in `value_unit_schema.yaml`
- Composition units accept concentrations (`mol/cm3`, `mol/m3`, `mol/dm3`, `mol/L`), the misspelling `mole faction` found in part of the ReSpecTh corpus, and a mixture of mole percent and mole fraction, which is reconciled onto mole fraction
- A temperature in an offset unit is parsed and validated correctly. `temperature: ['25 degC']` was rejected as unreadable, because Pint reads the string form `"25 degC"` as a multiplication and refuses that for an offset unit, and because the sign check compared the quantity against a zero in kelvin. Values are now built with Pint's two-argument form and converted to the absolute scale before the check, so -10 degC is accepted as 263.15 K while -1111 K and 0 K are still rejected
- Numeric values are normalized on conversion by the new `normalize_value`: leading zeros are stripped, since YAML reads them as octal, and a Fortran-style exponent written without the `e` is expanded so Pint can read it. Trailing zeros are deliberately left alone, being significant figures. A page range no longer keeps spaces around its dash, so it reads `446-457` rather than `446 - 457`
- Text taken from a CrossRef DOI lookup is HTML-unescaped, so a journal reaches the file as `Energy & Fuels` rather than `Energy & Fuels`. Author names are unescaped the same way
- A DOI written as a resolvable URL, such as `doi.org/10.1016/j.proci.2016.05.048`, is reduced to the bare identifier on conversion. Some ReSpecTh files write it that way and no DOI lookup accepts it
- An absolute uncertainty or evaluated standard deviation in `degC` or `degF` is treated as a temperature difference rather than a temperature, in validation and when a file is loaded. An uncertainty of `10 degC` was loaded as ±283.15 K instead of ±10 K; a temperature in `degC` with an uncertainty in kelvin failed to load, since 10 K became -263.15 degC; and a negative uncertainty such as `-5 degC` passed validation as 268.15 K

## [0.5.0] - 2026-07-02
### Added
Expand Down
8 changes: 6 additions & 2 deletions docs/ck-tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,12 @@ the kind from the article instead:
ReSpecTh_to_ChemKED('file.xml', apparatus_kind='outwardly propagating spherical flame')

PyKED also provides a converter to generate ReSpecTh files based on ChemKED records.
Writing ReSpecTh files is still limited to ignition delay data; a laminar burning
velocity or speciation record raises `NotImplementedError`.
Ignition delay and speciation measurement records can be written; a laminar burning
velocity record raises `NotImplementedError`. A speciation measurement is written as the
ReSpecTh speciation type its apparatus and swept axis call for: a jet stirred reactor
measurement, a burner stabilized flame speciation measurement, a concentration time profile
measurement for a shock tube or flow reactor against time, or otherwise an outlet
concentration measurement.
Given a ChemKED file ``file.yaml``, a corresponding ReSpecTh file can be created
from the command line via

Expand Down
27 changes: 25 additions & 2 deletions docs/schema-docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -607,19 +607,41 @@ This section details the schema for a speciation measurement datapoint, selected
- ``values``: sequence, required
A sequence of at least two rows. Each row contains one value for each
``independent-variables`` entry, followed by the measured amount, and optionally an
uncertainty value.
uncertainty value. Unless ``uncertainty`` says otherwise, that last value is an
absolute uncertainty in the units of the profile.

- ``uncertainty``: sequence, optional
Profile-level uncertainty or evaluated-standard-deviation information. The measured
species values are stored separately in ``values``. The sequence contains one mapping
with the uncertainty and/or evaluated-standard-deviation fields described under
:ref:`value-with-uncertainty <schema-value-with-uncertainty>`.

The fields of one kind given without its value, such as
``evaluated-standard-deviation-type``, ``-sourcetype`` and ``-method`` without
``evaluated-standard-deviation``, say what the uncertainty value at the end of each row
is. The ``-type`` field is then required, and the rows must end with an uncertainty. The
other kind may still give a value for the whole profile:

.. code-block:: yaml

values:
- [798.0, 9.8e-4, 4.9e-5]
uncertainty:
- uncertainty-type: relative # the whole profile
uncertainty: 0.1
evaluated-standard-deviation-type: absolute # the last value of each row
evaluated-standard-deviation-sourcetype: estimated

* ``auxiliary-profiles``: sequence, optional
A sequence of auxiliary measured profiles, such as temperature, pressure, volume, or
velocity. Each profile includes an ``independent`` mapping, a ``quantity`` mapping, and
``values`` rows.

* ``time-shift``: mapping, optional
How the zero of a time axis was placed. ``target`` is the species, and ``type`` is one of
``half decrease``, ``half increase``, or ``relative decrease``; a relative decrease gives
its ``amount`` as a :ref:`value-unit-optional <schema-value-unit-optional>` fraction.

.. _schema-only-keys:

Schema-Only Keys
Expand Down Expand Up @@ -657,7 +679,8 @@ should not be used in actual ChemKED files. These keys are documented in this se
``evaluated-standard-deviation-sourcetype``, and
``evaluated-standard-deviation-method`` must be accompanied by an actual
``uncertainty``, ``upper-uncertainty``/``lower-uncertainty``, or
``evaluated-standard-deviation`` value.
``evaluated-standard-deviation`` value. Only in a concentration profile may they describe
the uncertainty at the end of each row instead.

- Uncertainty fields:

Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@ classifiers = [
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Topic :: Scientific/Engineering :: Chemistry',
]
requires-python = ">=3.10"
requires-python = ">=3.12"
dependencies = [
"numpy>=2.0.0",
"pyyaml",
"cerberus",
"pint>0.24.0",
"pint>=0.26",
"uncertainties>=3.2",
"habanero>=2.9.1",
"httpx2>=2.0",
Expand Down Expand Up @@ -84,7 +82,7 @@ filterwarnings = [
# https://github.com/charliermarsh/ruff
[tool.ruff]
line-length = 100
target-version = "py310"
target-version = "py312"

[tool.ruff.lint]
# PLW1514 requires an explicit encoding on every text file that is opened. Without it, Python
Expand Down
Loading
Loading