reactorcheck 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/.github/workflows/release.yml +5 -5
  2. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/.gitignore +1 -0
  3. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/CHANGELOG.md +17 -0
  4. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/CITATION.cff +1 -1
  5. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/PKG-INFO +22 -9
  6. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/README.md +21 -8
  7. reactorcheck-0.2.2/docs/public-data-sources.md +249 -0
  8. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/pyproject.toml +1 -1
  9. reactorcheck-0.2.2/scripts/validate_public_reactor_data.py +280 -0
  10. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/__init__.py +1 -1
  11. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/io.py +73 -1
  12. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/species.py +7 -1
  13. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/gui_widget_smoke.py +24 -4
  14. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_project_metadata.py +1 -1
  15. reactorcheck-0.2.2/tests/test_public_data_regressions.py +191 -0
  16. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_version.py +1 -1
  17. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/.github/workflows/ci.yml +0 -0
  18. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/CONTRIBUTING.md +0 -0
  19. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/LICENSE +0 -0
  20. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/docs/assets/composition-result.png +0 -0
  21. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/docs/assets/example-result.png +0 -0
  22. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/docs/assets/social-preview.png +0 -0
  23. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/docs/dependency-licenses.md +0 -0
  24. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/docs/interchange.md +0 -0
  25. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/docs/scientific-definitions.md +0 -0
  26. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/examples/synthetic_composition.csv +0 -0
  27. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/examples/synthetic_composition.xlsx +0 -0
  28. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/examples/synthetic_composition_config.json +0 -0
  29. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/examples/synthetic_config.json +0 -0
  30. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/examples/synthetic_reactor.csv +0 -0
  31. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/schemas/reactorcheck-interchange.experimental.schema.json +0 -0
  32. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/scripts/generate_example_assets.py +0 -0
  33. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/__main__.py +0 -0
  34. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/calculations.py +0 -0
  35. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/cli.py +0 -0
  36. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/composition.py +0 -0
  37. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/gui.py +0 -0
  38. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/gui_controller.py +0 -0
  39. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/models.py +0 -0
  40. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/plotting.py +0 -0
  41. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/py.typed +0 -0
  42. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/qc.py +0 -0
  43. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/service.py +0 -0
  44. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/steady.py +0 -0
  45. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/src/reactorcheck/units.py +0 -0
  46. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/conftest.py +0 -0
  47. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_calculations.py +0 -0
  48. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_composition.py +0 -0
  49. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_io_cli_gui.py +0 -0
  50. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_service.py +0 -0
  51. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_species.py +0 -0
  52. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_steady.py +0 -0
  53. {reactorcheck-0.2.1 → reactorcheck-0.2.2}/tests/test_units.py +0 -0
@@ -11,8 +11,8 @@ jobs:
11
11
  permissions:
12
12
  contents: read
13
13
  steps:
14
- - uses: actions/checkout@v4
15
- - uses: actions/setup-python@v5
14
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
15
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
16
16
  with:
17
17
  python-version: "3.12"
18
18
  cache: pip
@@ -42,7 +42,7 @@ jobs:
42
42
  examples/synthetic_composition.csv \
43
43
  examples/synthetic_composition_config.json \
44
44
  /tmp/reactorcheck-release-gui.xlsx
45
- - uses: actions/upload-artifact@v4
45
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
46
46
  with:
47
47
  name: python-package-distributions
48
48
  path: dist/
@@ -57,8 +57,8 @@ jobs:
57
57
  permissions:
58
58
  id-token: write
59
59
  steps:
60
- - uses: actions/download-artifact@v4
60
+ - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
61
61
  with:
62
62
  name: python-package-distributions
63
63
  path: dist/
64
- - uses: pypa/gh-action-pypi-publish@release/v1
64
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
@@ -6,6 +6,7 @@ __pycache__/
6
6
  .pytest_cache/
7
7
  .ruff_cache/
8
8
  .venv/
9
+ uv.lock
9
10
  build/
10
11
  dist/
11
12
  htmlcov/
@@ -3,6 +3,23 @@
3
3
  All notable changes follow [Keep a Changelog](https://keepachangelog.com/) and
4
4
  versions follow semantic versioning.
5
5
 
6
+ ## [0.2.2] - 2026-08-23
7
+
8
+ ### Added
9
+
10
+ - Added checksum-pinned, opt-in validation against selected public fixed-bed
11
+ reactor and composition datasets without vendoring their source files.
12
+ - Added helium to the explicit species model for user-confirmed internal-standard
13
+ reconstruction.
14
+
15
+ ### Fixed
16
+
17
+ - Detect structurally consistent comma, semicolon, or tab delimiters instead of
18
+ treating every CSV as comma-delimited.
19
+ - Exclude explicit result and uncertainty headers from conservative species
20
+ mapping suggestions while preserving detector ambiguity for user review.
21
+ - Updated the release workflow to current Node 24 GitHub actions.
22
+
6
23
  ## [0.2.1] - 2026-08-23
7
24
 
8
25
  ### Fixed
@@ -2,7 +2,7 @@ cff-version: 1.2.0
2
2
  message: "If you use ReactorCheck, please cite this software."
3
3
  title: "ReactorCheck"
4
4
  type: software
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  date-released: 2026-08-23
7
7
  license: MIT
8
8
  repository-code: "https://github.com/hdkim99/ReactorCheck"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: reactorcheck
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Unit-aware catalytic reactor analysis from compositions or measured species flows.
5
5
  Project-URL: Homepage, https://github.com/hdkim99/ReactorCheck
6
6
  Project-URL: Repository, https://github.com/hdkim99/ReactorCheck
@@ -63,7 +63,7 @@ Description-Content-Type: text/markdown
63
63
 
64
64
  [![CI](https://github.com/hdkim99/ReactorCheck/actions/workflows/ci.yml/badge.svg)](https://github.com/hdkim99/ReactorCheck/actions/workflows/ci.yml)
65
65
  [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
66
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
66
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/hdkim99/ReactorCheck/blob/main/LICENSE)
67
67
 
68
68
  ![ReactorCheck internal-standard composition analysis](https://raw.githubusercontent.com/hdkim99/ReactorCheck/main/docs/assets/composition-result.png)
69
69
 
@@ -105,8 +105,8 @@ reactorcheck-gui
105
105
  ```
106
106
 
107
107
  The synthetic CO hydrogenation example is available as both
108
- [`CSV`](examples/synthetic_composition.csv) and
109
- [`XLSX`](examples/synthetic_composition.xlsx). Its hand calculation reconstructs
108
+ [`CSV`](https://github.com/hdkim99/ReactorCheck/blob/main/examples/synthetic_composition.csv) and
109
+ [`XLSX`](https://github.com/hdkim99/ReactorCheck/blob/main/examples/synthetic_composition.xlsx). Its hand calculation reconstructs
110
110
  CO/H2/CH3OH/N2 outlet flows of 0.5/1.0/0.5/1.0 mol/h.
111
111
 
112
112
  The backward-compatible direct-flow example remains available:
@@ -146,8 +146,18 @@ single `composition.basis` key is rejected rather than guessed.
146
146
  Raw composition sums are always retained and checked against a configured
147
147
  tolerance. Normalization does not change the internal-standard ratio, a property
148
148
  covered by scientific regression tests. See
149
- [`docs/scientific-definitions.md`](docs/scientific-definitions.md) and the complete
150
- [`composition configuration`](examples/synthetic_composition_config.json).
149
+ [`docs/scientific-definitions.md`](https://github.com/hdkim99/ReactorCheck/blob/main/docs/scientific-definitions.md) and the complete
150
+ [`composition configuration`](https://github.com/hdkim99/ReactorCheck/blob/main/examples/synthetic_composition_config.json).
151
+
152
+ ## Selected public real-data validation
153
+
154
+ ReactorCheck's IO and mapping paths have also been exercised against selected
155
+ public fixed-bed reactor exports: a Zenodo online-GC workbook/processed-flow
156
+ pair and a Mendeley Data dry-composition table. This does not imply validation
157
+ for every instrument or published metric definition. Dataset DOI, license,
158
+ checksums, files/columns used, failures found, scientific boundaries, and the
159
+ opt-in reproduction command are recorded in
160
+ [`docs/public-data-sources.md`](https://github.com/hdkim99/ReactorCheck/blob/main/docs/public-data-sources.md).
151
161
 
152
162
  ## Outputs
153
163
 
@@ -191,6 +201,9 @@ twine check dist/*
191
201
  ```
192
202
 
193
203
  Synthetic example data are MIT-licensed with the project. See
194
- [CONTRIBUTING.md](CONTRIBUTING.md) and [CITATION.cff](CITATION.cff).
195
- The 1280×640 [`social-preview.png`](docs/assets/social-preview.png) is the current
196
- repository social-preview candidate and is generated from the same real example.
204
+ [CONTRIBUTING.md](https://github.com/hdkim99/ReactorCheck/blob/main/CONTRIBUTING.md)
205
+ and [CITATION.cff](https://github.com/hdkim99/ReactorCheck/blob/main/CITATION.cff).
206
+ The 1280×640
207
+ [`social-preview.png`](https://raw.githubusercontent.com/hdkim99/ReactorCheck/main/docs/assets/social-preview.png)
208
+ is the current repository social-preview candidate and is generated from the same
209
+ synthetic composition example shown above.
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![CI](https://github.com/hdkim99/ReactorCheck/actions/workflows/ci.yml/badge.svg)](https://github.com/hdkim99/ReactorCheck/actions/workflows/ci.yml)
6
6
  [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/hdkim99/ReactorCheck/blob/main/LICENSE)
8
8
 
9
9
  ![ReactorCheck internal-standard composition analysis](https://raw.githubusercontent.com/hdkim99/ReactorCheck/main/docs/assets/composition-result.png)
10
10
 
@@ -46,8 +46,8 @@ reactorcheck-gui
46
46
  ```
47
47
 
48
48
  The synthetic CO hydrogenation example is available as both
49
- [`CSV`](examples/synthetic_composition.csv) and
50
- [`XLSX`](examples/synthetic_composition.xlsx). Its hand calculation reconstructs
49
+ [`CSV`](https://github.com/hdkim99/ReactorCheck/blob/main/examples/synthetic_composition.csv) and
50
+ [`XLSX`](https://github.com/hdkim99/ReactorCheck/blob/main/examples/synthetic_composition.xlsx). Its hand calculation reconstructs
51
51
  CO/H2/CH3OH/N2 outlet flows of 0.5/1.0/0.5/1.0 mol/h.
52
52
 
53
53
  The backward-compatible direct-flow example remains available:
@@ -87,8 +87,18 @@ single `composition.basis` key is rejected rather than guessed.
87
87
  Raw composition sums are always retained and checked against a configured
88
88
  tolerance. Normalization does not change the internal-standard ratio, a property
89
89
  covered by scientific regression tests. See
90
- [`docs/scientific-definitions.md`](docs/scientific-definitions.md) and the complete
91
- [`composition configuration`](examples/synthetic_composition_config.json).
90
+ [`docs/scientific-definitions.md`](https://github.com/hdkim99/ReactorCheck/blob/main/docs/scientific-definitions.md) and the complete
91
+ [`composition configuration`](https://github.com/hdkim99/ReactorCheck/blob/main/examples/synthetic_composition_config.json).
92
+
93
+ ## Selected public real-data validation
94
+
95
+ ReactorCheck's IO and mapping paths have also been exercised against selected
96
+ public fixed-bed reactor exports: a Zenodo online-GC workbook/processed-flow
97
+ pair and a Mendeley Data dry-composition table. This does not imply validation
98
+ for every instrument or published metric definition. Dataset DOI, license,
99
+ checksums, files/columns used, failures found, scientific boundaries, and the
100
+ opt-in reproduction command are recorded in
101
+ [`docs/public-data-sources.md`](https://github.com/hdkim99/ReactorCheck/blob/main/docs/public-data-sources.md).
92
102
 
93
103
  ## Outputs
94
104
 
@@ -132,6 +142,9 @@ twine check dist/*
132
142
  ```
133
143
 
134
144
  Synthetic example data are MIT-licensed with the project. See
135
- [CONTRIBUTING.md](CONTRIBUTING.md) and [CITATION.cff](CITATION.cff).
136
- The 1280×640 [`social-preview.png`](docs/assets/social-preview.png) is the current
137
- repository social-preview candidate and is generated from the same real example.
145
+ [CONTRIBUTING.md](https://github.com/hdkim99/ReactorCheck/blob/main/CONTRIBUTING.md)
146
+ and [CITATION.cff](https://github.com/hdkim99/ReactorCheck/blob/main/CITATION.cff).
147
+ The 1280×640
148
+ [`social-preview.png`](https://raw.githubusercontent.com/hdkim99/ReactorCheck/main/docs/assets/social-preview.png)
149
+ is the current repository social-preview candidate and is generated from the same
150
+ synthetic composition example shown above.
@@ -0,0 +1,249 @@
1
+ # Public real-data validation sources
2
+
3
+ This register distinguishes source data, publication licenses, redistribution
4
+ rights, and the level of validation actually performed. Public availability or
5
+ the ability to cite a paper does not by itself grant permission to redistribute
6
+ its dataset. Access dates below are in ISO format.
7
+
8
+ The source files are **not bundled** in ReactorCheck. The selected dataset
9
+ licenses permit redistribution with attribution, but keeping the original files
10
+ at their authoritative repositories avoids stale multi-megabyte copies and
11
+ preserves the record of record. The default test suite uses only minimal,
12
+ attributed regressions; it never downloads data.
13
+
14
+ ## Dataset register
15
+
16
+ | Dataset ID | Project | Repository | Dataset DOI | Dataset license | Files used | Validation scope | Fixture included? |
17
+ | --- | --- | --- | --- | --- | --- | --- | --- |
18
+ | RC-PUB-001 | Swiss Cat+ East A1 high-throughput CO2 hydrogenation | Zenodo | [10.5281/zenodo.8314734](https://doi.org/10.5281/zenodo.8314734) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | `A1_G1_FBTesting_XDB4x_RawData.xlsx`; `A1_G1_FBData_XDB4x_mean.csv` | Raw GC/workbook IO and mapping; processed-flow mapping, API/CLI/GUI-controller/export; scientific-definition audit | Yes—inline headers and one measured row; original files no |
19
+ | RC-PUB-002 | Fixed-bed reverse water-gas shift experiment | Mendeley Data | [10.17632/sw7225g8xr.3](https://doi.org/10.17632/sw7225g8xr.3) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | `data_V2.csv` | Processed dry-composition delimiter and mapping validation; metadata/method comparison | Yes—inline header and two records; original file no |
20
+
21
+ ## RC-PUB-001 — Swiss Cat+ fixed-bed reactor and online GC
22
+
23
+ **Dataset:** *Raw, processed and merged Data for Swiss Cat+ East A1 project
24
+ related to the automated and high-throughput Bayesian Optimization of CO2
25
+ hydrogenation heterogeneous catalysts*
26
+
27
+ - **Authors:** Adrian Ramirez; Erwin Lam; Daniel Pacheco; Yuhui Hou; Hermann
28
+ Tribukait; Loïc Roch; Christophe Copéret; Paco Laveille.
29
+ - **Repository:** Zenodo record
30
+ [8314734](https://zenodo.org/records/8314734).
31
+ - **Dataset DOI:** [10.5281/zenodo.8314734](https://doi.org/10.5281/zenodo.8314734).
32
+ - **Dataset license:** CC BY 4.0. It permits sharing and adaptation, including
33
+ redistribution, provided attribution, a license link, and change indication
34
+ are supplied. No third-party material was extracted into this repository.
35
+ - **Original publication:** Adrian Ramirez, Erwin Lam, Daniel Pacheco
36
+ Gutierrez, Yuhui Hou, Hermann Tribukait, Loïc M. Roch, Christophe Copéret,
37
+ and Paco Laveille. “Accelerated exploration of heterogeneous CO2
38
+ hydrogenation catalysts by Bayesian-optimized high-throughput and automated
39
+ experimentation.” *Chem Catalysis* 4(2), 100888 (2024).
40
+ [10.1016/j.checat.2023.100888](https://doi.org/10.1016/j.checat.2023.100888).
41
+ - **Accessible method version:** ChemRxiv preprint
42
+ [10.26434/chemrxiv-2023-kmd91](https://doi.org/10.26434/chemrxiv-2023-kmd91),
43
+ CC BY-NC 4.0. This is a publication license, separate from the dataset's CC BY
44
+ 4.0 license.
45
+ - **Access date:** 2026-08-23.
46
+ - **Technique:** four parallel fixed-bed reactors, automated high-throughput
47
+ CO2 hydrogenation, and online FID/TCD gas chromatography. The publication
48
+ explicitly identifies helium as the internal standard; ReactorCheck still
49
+ requires the user to confirm the nonreactive-standard assumption.
50
+
51
+ ### Files inspected
52
+
53
+ `A1_G1_FBTesting_XDB4x_RawData.xlsx`
54
+
55
+ - **Size:** 150,533 bytes.
56
+ - **SHA-256:**
57
+ `85726cbefbbaf808b2a2936b418f28bcb646d0c7e00cd4690a679f81c2f65d83`.
58
+ - **Zenodo MD5:** `1357edc21b44c337603f3bf79fcf1abe`.
59
+ - **Sheet:** `Run Data`.
60
+ - **Shape:** 125 rows × 175 columns.
61
+ - **Columns audited:** identifiers and time (`SampleTimeId`, `LocalTime`,
62
+ `UtcTime`, `RunName`, `Reactor`, `Block`, `ElapsedRunTime`); reactor state
63
+ (`Reactor_Gas_Flow_Nml_min`, inlet/outlet pressure, temperature PV/SP);
64
+ GC provenance (`FID_F_FileName`, `FID_F_MethodName`,
65
+ `FID_F_SampleDateTime`, `FID_F_SampleId`); detector-specific measurements
66
+ including `FID_B_CO2_Conc`, `TCD_Aux_CO2_Conc`, `TCD_Aux_H2_Conc`,
67
+ `TCD_Aux_He_Conc`, `TCD_Aux_N2_Conc`, `TCD_Aux_CO_Conc`,
68
+ `FID_F_CH4_Conc`, and `FID_B_MeOH_Conc`; catalyst metadata including
69
+ `R_MassLoaded`, `C_CatalystID`, `C_Support`, and `C_Metal`.
70
+ - **Observed variation:** the same species can occur on more than one detector
71
+ (`FID_B_CO2_Conc` and `TCD_Aux_CO2_Conc`). ReactorCheck deliberately returns
72
+ both as suggestions and does not select a detector. One row contains zero
73
+ helium and therefore cannot support internal-standard reconstruction.
74
+ - **Processing performed:** read-only workbook inspection, sheet/shape/header
75
+ validation, conservative mapping suggestions, and a one-row minimal
76
+ regression retaining only cited measured values from `SampleTimeId=715`,
77
+ `Reactor=1`, and `ElapsedRunTime=4.423007`. The original workbook was
78
+ not changed or copied into the repository.
79
+ - **Validation level:** raw workbook IO and mapping are validated. Complete
80
+ scientific reproduction of every catalyst result is not claimed because the
81
+ detector choice and publication processing must be supplied explicitly.
82
+
83
+ `A1_G1_FBData_XDB4x_mean.csv`
84
+
85
+ - **Size:** 8,032 bytes.
86
+ - **SHA-256:**
87
+ `92a93f9174b66a22faae53f92c6f996d595567cf056a0c2a7c8872e3a4d0a217`.
88
+ - **Zenodo MD5:** `7a6bdc57c72a8e11d93b0e1fe2e3f20b`.
89
+ - **Shape:** 16 rows × 39 columns.
90
+ - **Columns:** `Unit`, `Reactor`, `Temperature Set (°C)`, `Pressure Set
91
+ (barg)`, `Block`, `Temperature (°C)`, `Pressure (barg)`, `Time on Stream
92
+ (h)`, the `CO2`, `N2`, `He`, and `H2` inlet-flow columns, reconstructed
93
+ `*_fr (ml/min)` columns for H2, He, N2, CO2, CO, CH4, MeOH, C2–C4
94
+ hydrocarbons/alcohols, `Sumcarbon (%)`, `CO2 Conversion (%)`, and four
95
+ published selectivity columns.
96
+ - **Processing performed:** read-only parsing and mapping audit; API, CLI, GUI
97
+ controller, QC, and XLSX export exercise with the selected original flow
98
+ columns. No source rows were normalized, smoothed, removed, or interpolated.
99
+ - **Validation level:** processed tabular data and runtime call paths. The
100
+ resulting direct-disappearance conversion is **not** a reproduction of the
101
+ published conversion definition; see “Scientific-definition boundary”.
102
+
103
+ ### Scientific-definition boundary
104
+
105
+ The publication defines `Sumcarbon` from detected carbon-containing species and
106
+ defines CO2 conversion from the CO2 share of that carbon-normalized sum. It also
107
+ defines product selectivity on a carbon-number basis and calculates formation
108
+ rates using the measured helium standard. ReactorCheck's current conversion is
109
+ the explicit inlet/outlet disappearance definition
110
+ `(F_CO2,in - F_CO2,out) / F_CO2,in`. Applying that definition directly to the
111
+ published `*_fr` table produces materially different values and physical-range
112
+ QC warnings. This is a **scientific-definition difference**, not a value to
113
+ silently coerce or an excuse to replace the existing definition. The published
114
+ carbon-normalized workflow remains unsupported.
115
+
116
+ The processed rows are block/catalyst summaries. `Time on Stream (h)` is
117
+ retained, but those rows are not treated as one continuous time trace for
118
+ automatic steady-state detection. Detector selection, block grouping, and
119
+ publication-specific carbon normalization remain explicit external processing.
120
+
121
+ ## RC-PUB-002 — processed fixed-bed rWGS table
122
+
123
+ **Dataset:** *Experimental Reverse Water-Gas Shift (rWGS) Reaction Dataset from
124
+ a Fixed-Bed Reactor*
125
+
126
+ - **Authors:** Enzo Komatz; Marion Andritz; Christoph Markowitsch.
127
+ - **Repository:** Mendeley Data
128
+ [sw7225g8xr/3](https://data.mendeley.com/datasets/sw7225g8xr/3).
129
+ - **Dataset DOI:** [10.17632/sw7225g8xr.3](https://doi.org/10.17632/sw7225g8xr.3).
130
+ - **Dataset license:** CC BY 4.0. The repository states that sharing and
131
+ modification are permitted with attribution, a license link, and an
132
+ indication of changes. The original file is nevertheless not redistributed
133
+ by ReactorCheck.
134
+ - **Original publication:** Enzo Komatz, Marion Andritz, and Christoph
135
+ Markowitsch. “Experimental dataset of the reverse water-gas shift reaction in
136
+ a fixed-bed reactor setup under varying reactor conditions.” *Data in Brief*
137
+ 65, 112485 (2026).
138
+ [10.1016/j.dib.2026.112485](https://doi.org/10.1016/j.dib.2026.112485),
139
+ CC BY-NC 4.0. The publication license is separate from the dataset license.
140
+ - **Method reference:** Enzo Komatz, *Development of automated software for
141
+ analysis and simulation of the reverse water gas shift reaction* (Master's
142
+ thesis, 2025).
143
+ [10.34901/mul.pub.2025.108](https://doi.org/10.34901/mul.pub.2025.108).
144
+ - **Access date:** 2026-08-23.
145
+ - **Technique:** fixed-bed rWGS reactor with calibrated mass-flow controllers
146
+ and an NDIR gas analyzer. This is real laboratory data but **not a GC export**;
147
+ it was selected to test a real fixed-bed, dry-mol% tabular layout and CSV
148
+ compatibility.
149
+
150
+ ### File inspected
151
+
152
+ `data_V2.csv`
153
+
154
+ - **Size:** 31,698 bytes.
155
+ - **SHA-256:**
156
+ `9700726a1146c812b8dbb63ab5d7e8cf4fcf55e480668a52fbe0287bac3077b2`.
157
+ - **Format:** semicolon-delimited CSV with CRLF records.
158
+ - **Shape after correct parsing:** 313 rows × 15 columns.
159
+ - **Columns:** `H2toCO2`, `GHSV`, `pset`, `Tout`, `Tset`,
160
+ `GA_H2_corrected`, `GA_CH4_corrected`, `GA_CO_corrected`,
161
+ `GA_CO2_corrected`, `u_GA_H2`, `u_GA_CH4`, `u_GA_CO`, `u_GA_CO2`,
162
+ `XCO2`, and `SCO`.
163
+ - **Units from source metadata:** ratio dimensionless; GHSV in h^-1; pressure
164
+ in bara; temperatures in °C; analyzer and uncertainty columns in dry mol%;
165
+ conversion/selectivity in percent.
166
+ - **Processing performed:** read-only parsing, delimiter/header/shape audit,
167
+ mapping audit, and a two-row regression retaining the public header and
168
+ zero-based source data rows 0 and 1. No censored values, normalization, or recalculation
169
+ was introduced.
170
+ - **Validation level:** processed/normalized supplementary table. Raw analyzer
171
+ signals and the time series used to establish steady state are not present in
172
+ this file.
173
+
174
+ This table contains independent steady-state operating points and no time
175
+ column. ReactorCheck does not synthesize timestamps or run time-series
176
+ steady-state detection on it. The source's `XCO2` and `SCO` remain published
177
+ metrics; uncertainty columns (`u_GA_*`) and derived conversion/selectivity
178
+ columns are not suggested as species measurements.
179
+
180
+ ## Failure register
181
+
182
+ | Dataset ID | Real-data issue | Classification | Resolution | Regression |
183
+ | --- | --- | --- | --- | --- |
184
+ | RC-PUB-002 | Semicolon CSV was parsed as 313 × 1 under a comma-only parser | IO/parser bug | Conservative comma/semicolon/tab detection; multiple structurally valid delimiters fail explicitly | `test_public_semicolon_csv_is_read_as_fifteen_columns`; `test_ambiguous_csv_delimiter_fails_explicitly` |
185
+ | RC-PUB-001 / 002 | Published conversion/selectivity and `u_GA_*` uncertainty headers were suggested as measured species | Schema/mapping bug | Exclude only explicit derived/error tokens and the source's `u_` prefix; corrected flow/concentration columns remain candidates | `test_public_metric_and_uncertainty_columns_are_not_species_measurements` |
186
+ | RC-PUB-001 | `TCD_Aux_He_Conc` was not recognized, preventing an explicitly configured He-standard workflow | Schema/mapping bug | Add He formula/atomic weight and conservative complete-token recognition; user confirmation remains mandatory | `test_public_raw_gc_header_recognizes_helium_without_selecting_a_detector`; `test_public_raw_gc_row_supports_explicit_helium_reconstruction` |
187
+ | RC-PUB-001 | FID and TCD both expose CO2 measurements | User ambiguity, not a parser bug | Preserve both suggestions; require user detector mapping | Header regression verifies two CO2 candidates |
188
+ | RC-PUB-001 | Published carbon-normalized conversion differs from direct inlet/outlet disappearance | Scientific-definition difference / unsupported workflow | Document and expose QC; do not rewrite the core definition | Opt-in external validation records the numerical difference |
189
+ | RC-PUB-002 | Table has no timestamp or raw stabilization trace | Unsupported workflow | Do not fabricate time or claim steady-state detection | Documented boundary; no implementation added |
190
+
191
+ ## Reproduce the external validation
192
+
193
+ Download the three exact source files from the repository records above. Then,
194
+ from an editable or installed ReactorCheck environment, run:
195
+
196
+ ```bash
197
+ python scripts/validate_public_reactor_data.py \
198
+ --swisscat-raw /path/to/A1_G1_FBTesting_XDB4x_RawData.xlsx \
199
+ --swisscat-mean /path/to/A1_G1_FBData_XDB4x_mean.csv \
200
+ --rwgs /path/to/data_V2.csv \
201
+ --output-dir /path/to/new-empty-validation-output
202
+ ```
203
+
204
+ The script verifies filename, size, and SHA-256 before reading anything. It
205
+ exercises raw/processed IO, conservative suggestions, API analysis, CLI
206
+ suggest/analyze, GUI-controller load/analyze, QC, and complete XLSX export. Its
207
+ `validation-report.json` records source identities, source shapes, no implicit
208
+ transformations/exclusions, QC codes, and the unresolved conversion-definition
209
+ difference. It does not download data and is not part of default `pytest`.
210
+
211
+ With a functional Tk display (or `xvfb-run`), the actual widget path can be
212
+ checked against the processed public file and generated configuration:
213
+
214
+ ```bash
215
+ python tests/gui_widget_smoke.py \
216
+ /path/to/A1_G1_FBData_XDB4x_mean.csv \
217
+ /path/to/new-empty-validation-output/swisscat-mean-config.json \
218
+ /path/to/new-empty-validation-output/swisscat-mean-tk-widget.xlsx \
219
+ --conversion-column conversion_CO2_fraction \
220
+ --expected-conversion -0.09004780446173652
221
+ ```
222
+
223
+ ## Assessed but not selected for this validation round
224
+
225
+ - **Zenodo 10.5281/zenodo.21884075**, *Dataset for: Dopant-Controlled Oxygen
226
+ Vacancy Dynamics Define CO2-to-Methanol Catalysis on In2O3* (Becker et al.;
227
+ CC BY 4.0; publication
228
+ [10.1038/s41467-026-72876-w](https://doi.org/10.1038/s41467-026-72876-w)).
229
+ `04_Figure_4_a_catalysis_operando.zip` is 6,132,151 bytes (SHA-256
230
+ `bcadc5efc35229e1920c04500ca3325164137ff2c677b2487c2b392ba439810f`)
231
+ and contains genuine Chromeleon hierarchical text reports, GC calibration
232
+ RTF, and MS/QMS exports. These are not flat CSV/XLSX tables and therefore are
233
+ a real but currently unsupported vendor-report workflow. No vendor adapter
234
+ was added from a single dataset.
235
+ - Mendeley Data [10.17632/z5bypjm62y.1](https://doi.org/10.17632/z5bypjm62y.1)
236
+ contains real raw GC data for liquid-batch reductive amination, outside the
237
+ catalytic flow-reactor scope selected here.
238
+ - Mendeley Data [10.17632/3rd2hm4zrw.1](https://doi.org/10.17632/3rd2hm4zrw.1)
239
+ concerns trickle-bed styrene experiments but exposes primarily PDF GC
240
+ reports rather than a reproducible flat feed/outlet table.
241
+ - Dryad [10.25349/D9ZG6B](https://doi.org/10.25349/D9ZG6B) includes genuine
242
+ GC-FID/TCD data with an argon standard, but the underlying experiment is
243
+ batch polyethylene upcycling rather than the declared flow-reactor workflow.
244
+ - Figshare/ACS supplementary candidates dominated figure images, PDF-only
245
+ summaries, HPLC/electrochemical data, or simulation output; NIST candidates
246
+ were compiled kinetics rather than source laboratory exports. Harvard
247
+ Dataverse and OSF searches did not yield a better licensed raw
248
+ reactor-plus-GC table for this round. These were excluded rather than being
249
+ mislabeled as raw-file validation.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "reactorcheck"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Unit-aware catalytic reactor analysis from compositions or measured species flows."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -0,0 +1,280 @@
1
+ """Opt-in validation against checksum-pinned public reactor datasets.
2
+
3
+ The script never downloads or rewrites source data. Download the three files
4
+ from the cited repositories, pass their local paths, and use a new/empty output
5
+ directory. See ``docs/public-data-sources.md`` for sources, licenses, and the
6
+ scientific limits of each comparison.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import argparse
12
+ import hashlib
13
+ import json
14
+ from pathlib import Path
15
+ from typing import Any
16
+
17
+ import numpy as np
18
+ import openpyxl
19
+ import pandas as pd
20
+
21
+ from reactorcheck.cli import main as cli_main
22
+ from reactorcheck.gui_controller import GUIController
23
+ from reactorcheck.io import read_table, save_config, suggest_mappings
24
+ from reactorcheck.models import AnalysisConfig, ChannelMapping, Species
25
+ from reactorcheck.service import analyze_frame
26
+
27
+ EXPECTED_FILES = {
28
+ "swisscat_raw": {
29
+ "name": "A1_G1_FBTesting_XDB4x_RawData.xlsx",
30
+ "size": 150_533,
31
+ "sha256": "85726cbefbbaf808b2a2936b418f28bcb646d0c7e00cd4690a679f81c2f65d83",
32
+ "doi": "10.5281/zenodo.8314734",
33
+ },
34
+ "swisscat_mean": {
35
+ "name": "A1_G1_FBData_XDB4x_mean.csv",
36
+ "size": 8_032,
37
+ "sha256": "92a93f9174b66a22faae53f92c6f996d595567cf056a0c2a7c8872e3a4d0a217",
38
+ "doi": "10.5281/zenodo.8314734",
39
+ },
40
+ "rwgs": {
41
+ "name": "data_V2.csv",
42
+ "size": 31_698,
43
+ "sha256": "9700726a1146c812b8dbb63ab5d7e8cf4fcf55e480668a52fbe0287bac3077b2",
44
+ "doi": "10.17632/sw7225g8xr.3",
45
+ },
46
+ }
47
+
48
+
49
+ def _sha256(path: Path) -> str:
50
+ digest = hashlib.sha256()
51
+ with path.open("rb") as stream:
52
+ for block in iter(lambda: stream.read(1024 * 1024), b""):
53
+ digest.update(block)
54
+ return digest.hexdigest()
55
+
56
+
57
+ def _verify_source(path: Path, key: str) -> dict[str, Any]:
58
+ expected = EXPECTED_FILES[key]
59
+ if not path.is_file():
60
+ raise ValueError(f"Missing source file: {path}")
61
+ actual_size = path.stat().st_size
62
+ actual_sha256 = _sha256(path)
63
+ if path.name != expected["name"]:
64
+ raise ValueError(f"Expected {expected['name']!r}, received {path.name!r}")
65
+ if actual_size != expected["size"] or actual_sha256 != expected["sha256"]:
66
+ raise ValueError(
67
+ f"Checksum/size mismatch for {path.name}; do not validate a changed source file"
68
+ )
69
+ return {
70
+ "path": str(path.resolve()),
71
+ "size": actual_size,
72
+ "sha256": actual_sha256,
73
+ "doi": expected["doi"],
74
+ }
75
+
76
+
77
+ def _mean_config() -> AnalysisConfig:
78
+ """Map the selected Swiss Cat+ processed flow columns without redefining them."""
79
+ channels = (
80
+ ChannelMapping(
81
+ "CO2_fr (ml/min)",
82
+ Species("CO2", "CO2"),
83
+ "reactant",
84
+ "mL/min",
85
+ inlet_column="CO2_in (ml/min)",
86
+ inlet_unit="mL/min",
87
+ ),
88
+ ChannelMapping(
89
+ "H2_fr (ml/min)",
90
+ Species("H2", "H2"),
91
+ "reactant",
92
+ "mL/min",
93
+ inlet_column="H2_in (ml/min)",
94
+ inlet_unit="mL/min",
95
+ ),
96
+ ChannelMapping(
97
+ "He_fr (ml/min)",
98
+ Species("He", "He"),
99
+ "inert",
100
+ "mL/min",
101
+ inlet_column="He_in (ml/min)",
102
+ inlet_unit="mL/min",
103
+ ),
104
+ ChannelMapping(
105
+ "N2_fr (ml/min)",
106
+ Species("N2", "N2"),
107
+ "inert",
108
+ "mL/min",
109
+ inlet_column="N2_in (ml/min)",
110
+ inlet_unit="mL/min",
111
+ ),
112
+ ChannelMapping("CO_fr (ml/min)", Species("CO", "CO"), "product", "mL/min"),
113
+ ChannelMapping("CH4_fr (ml/min)", Species("CH4", "CH4"), "product", "mL/min"),
114
+ ChannelMapping("MeOH_fr (ml/min)", Species("MeOH", "CH3OH"), "product", "mL/min"),
115
+ )
116
+ return AnalysisConfig(
117
+ time_column="Time on Stream (h)",
118
+ time_unit="h",
119
+ channels=channels,
120
+ reference_reactant="CO2",
121
+ catalyst_mass="50 mg",
122
+ sty_product="MeOH",
123
+ )
124
+
125
+
126
+ def _prepare_output(path: Path) -> None:
127
+ if path.exists() and any(path.iterdir()):
128
+ raise ValueError(f"Output directory must be new or empty: {path}")
129
+ path.mkdir(parents=True, exist_ok=True)
130
+
131
+
132
+ def validate(args: argparse.Namespace) -> dict[str, Any]:
133
+ """Run read-only source checks and real API/CLI/GUI-controller paths."""
134
+ output = args.output_dir.resolve()
135
+ _prepare_output(output)
136
+ sources = {
137
+ "swisscat_raw": _verify_source(args.swisscat_raw, "swisscat_raw"),
138
+ "swisscat_mean": _verify_source(args.swisscat_mean, "swisscat_mean"),
139
+ "rwgs": _verify_source(args.rwgs, "rwgs"),
140
+ }
141
+
142
+ raw = read_table(args.swisscat_raw, sheet_name="Run Data")
143
+ mean = read_table(args.swisscat_mean)
144
+ rwgs = read_table(args.rwgs)
145
+ if raw.shape != (125, 175) or mean.shape != (16, 39) or rwgs.shape != (313, 15):
146
+ raise AssertionError(
147
+ f"Unexpected source shapes: raw={raw.shape}, mean={mean.shape}, rwgs={rwgs.shape}"
148
+ )
149
+
150
+ raw_suggestions = suggest_mappings(raw)
151
+ mean_suggestions = suggest_mappings(mean)
152
+ rwgs_suggestions = suggest_mappings(rwgs)
153
+ if not any(item["species"] == "He" for item in raw_suggestions):
154
+ raise AssertionError("Helium was not suggested from the public raw GC header")
155
+ if sum(item["species"] == "CO2" for item in raw_suggestions) < 2:
156
+ raise AssertionError(
157
+ "Detector-specific duplicate CO2 channels were not preserved for review"
158
+ )
159
+ excluded_headers = {
160
+ "CO2 Conversion (%)",
161
+ "MeOH Selectivity (%)",
162
+ "CH4 Selectivity(%)",
163
+ "CO Selectivity(%)",
164
+ "u_GA_CO",
165
+ "u_GA_CO2",
166
+ }
167
+ mapped_headers = {item["column"] for item in (*mean_suggestions, *rwgs_suggestions)}
168
+ if mapped_headers & excluded_headers:
169
+ raise AssertionError("Derived metrics or uncertainty columns were mapped as measurements")
170
+
171
+ config = _mean_config()
172
+ api_result = analyze_frame(mean, config, source=str(args.swisscat_mean.resolve()))
173
+ if "conversion_outside_physical_range" not in {issue.code for issue in api_result.qc_issues}:
174
+ raise AssertionError("Expected the published-definition mismatch to remain visible in QC")
175
+
176
+ config_path = output / "swisscat-mean-config.json"
177
+ cli_output = output / "swisscat-mean-cli.xlsx"
178
+ cli_raw_suggestions = output / "swisscat-raw-suggestions.json"
179
+ cli_mean_suggestions = output / "swisscat-mean-suggestions.json"
180
+ save_config(config, config_path)
181
+ if cli_main(["suggest", str(args.swisscat_raw), "--output", str(cli_raw_suggestions)]):
182
+ raise AssertionError("CLI raw mapping suggestion failed")
183
+ if cli_main(["suggest", str(args.swisscat_mean), "--output", str(cli_mean_suggestions)]):
184
+ raise AssertionError("CLI processed mapping suggestion failed")
185
+ if cli_main(
186
+ [
187
+ "analyze",
188
+ str(args.swisscat_mean),
189
+ "--config",
190
+ str(config_path),
191
+ "--output",
192
+ str(cli_output),
193
+ ]
194
+ ):
195
+ raise AssertionError("CLI real-data analysis/export failed")
196
+
197
+ controller = GUIController()
198
+ controller.load(args.swisscat_raw)
199
+ if controller.data is None or controller.data.shape != raw.shape:
200
+ raise AssertionError("GUI controller did not load the raw workbook losslessly")
201
+ controller.load(args.swisscat_mean)
202
+ gui_result = controller.analyze(config)
203
+ gui_output = output / "swisscat-mean-gui-controller.xlsx"
204
+ controller.export(gui_output)
205
+
206
+ cli_processed = pd.read_excel(cli_output, sheet_name="processed")
207
+ np.testing.assert_allclose(
208
+ api_result.processed["conversion_CO2_fraction"],
209
+ cli_processed["conversion_CO2_fraction"],
210
+ rtol=1e-12,
211
+ atol=1e-12,
212
+ )
213
+ np.testing.assert_allclose(
214
+ api_result.processed["conversion_CO2_fraction"],
215
+ gui_result.processed["conversion_CO2_fraction"],
216
+ rtol=1e-12,
217
+ atol=1e-12,
218
+ )
219
+ expected_sheets = {"summary", "processed", "qc", "settings", "provenance"}
220
+ for workbook_path in (cli_output, gui_output):
221
+ sheets = set(openpyxl.load_workbook(workbook_path, read_only=True).sheetnames)
222
+ if sheets != expected_sheets:
223
+ raise AssertionError(f"Incomplete export workbook: {workbook_path}")
224
+
225
+ computed = 100.0 * api_result.processed["conversion_CO2_fraction"].to_numpy()
226
+ published = mean["CO2 Conversion (%)"].to_numpy(dtype=float)
227
+ report = {
228
+ "sources": sources,
229
+ "source_shapes": {
230
+ "swisscat_raw": list(raw.shape),
231
+ "swisscat_mean": list(mean.shape),
232
+ "rwgs": list(rwgs.shape),
233
+ },
234
+ "validation_level": {
235
+ "swisscat_raw": "raw-workbook IO and conservative mapping only",
236
+ "swisscat_mean": "processed-flow API/CLI/GUI-controller/export path",
237
+ "rwgs": "processed dry-composition CSV delimiter and mapping only",
238
+ },
239
+ "transformations": [],
240
+ "excluded_rows": [],
241
+ "scientific_definition_difference": {
242
+ "reactorcheck": "direct inlet/outlet CO2 disappearance",
243
+ "publication": "carbon-normalized CO2 conversion",
244
+ "maximum_absolute_percentage_point_difference": float(
245
+ np.max(np.abs(computed - published))
246
+ ),
247
+ "comparison_status": "unsupported definition difference; not reconciled",
248
+ },
249
+ "qc_codes": sorted({issue.code for issue in api_result.qc_issues}),
250
+ "outputs": [
251
+ str(config_path),
252
+ str(cli_raw_suggestions),
253
+ str(cli_mean_suggestions),
254
+ str(cli_output),
255
+ str(gui_output),
256
+ ],
257
+ }
258
+ report_path = output / "validation-report.json"
259
+ report_path.write_text(json.dumps(report, indent=2) + "\n", encoding="utf-8")
260
+ return report
261
+
262
+
263
+ def build_parser() -> argparse.ArgumentParser:
264
+ """Build the opt-in validation CLI."""
265
+ parser = argparse.ArgumentParser(description=__doc__)
266
+ parser.add_argument("--swisscat-raw", required=True, type=Path)
267
+ parser.add_argument("--swisscat-mean", required=True, type=Path)
268
+ parser.add_argument("--rwgs", required=True, type=Path)
269
+ parser.add_argument("--output-dir", required=True, type=Path)
270
+ return parser
271
+
272
+
273
+ def main() -> None:
274
+ """Validate selected public files supplied explicitly by the user."""
275
+ report = validate(build_parser().parse_args())
276
+ print(json.dumps(report, indent=2))
277
+
278
+
279
+ if __name__ == "__main__":
280
+ main()
@@ -18,4 +18,4 @@ __all__ = [
18
18
  "analyze_file",
19
19
  "analyze_frame",
20
20
  ]
21
- __version__ = "0.2.1"
21
+ __version__ = "0.2.2"
@@ -2,7 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import csv
5
6
  import json
7
+ import re
6
8
  from dataclasses import asdict
7
9
  from pathlib import Path
8
10
  from typing import Any, cast
@@ -24,6 +26,73 @@ class InputError(ValueError):
24
26
  """Raised for unsupported or invalid input data."""
25
27
 
26
28
 
29
+ _CSV_DELIMITERS = (",", ";", "\t")
30
+ _DERIVED_METRIC_TOKENS = {
31
+ "CONVERSION",
32
+ "ERROR",
33
+ "SELECTIVITY",
34
+ "UNCERTAINTY",
35
+ "YIELD",
36
+ }
37
+
38
+
39
+ def _detect_csv_delimiter(source: Path) -> str:
40
+ """Detect a conservative delimiter from structurally consistent rows.
41
+
42
+ A candidate must split the header into multiple fields and produce the
43
+ same number of fields in every sampled non-empty record. Multiple valid
44
+ candidates are ambiguous and require the user to disambiguate the file.
45
+ """
46
+ try:
47
+ with source.open(encoding="utf-8-sig", newline="") as stream:
48
+ records = [line for line in stream if line.strip()][:50]
49
+ except (OSError, UnicodeError) as exc:
50
+ raise InputError(f"Could not inspect CSV delimiter: {exc}") from exc
51
+
52
+ if not records:
53
+ raise InputError("Input table is empty")
54
+
55
+ candidates: list[str] = []
56
+ observed: list[str] = []
57
+ for delimiter in _CSV_DELIMITERS:
58
+ try:
59
+ rows = list(csv.reader(records, delimiter=delimiter, strict=True))
60
+ except csv.Error:
61
+ continue
62
+ widths = [len(row) for row in rows]
63
+ if widths[0] > 1:
64
+ observed.append(delimiter)
65
+ if widths[0] > 1 and len(set(widths)) == 1:
66
+ candidates.append(delimiter)
67
+
68
+ if len(candidates) > 1:
69
+ names = {",": "comma", ";": "semicolon", "\t": "tab"}
70
+ readable = ", ".join(names[value] for value in candidates)
71
+ raise InputError(
72
+ f"Ambiguous CSV delimiter: multiple consistent delimiters were found ({readable})"
73
+ )
74
+ if len(candidates) == 1:
75
+ return candidates[0]
76
+ if observed:
77
+ names = {",": "comma", ";": "semicolon", "\t": "tab"}
78
+ readable = ", ".join(names[value] for value in observed)
79
+ raise InputError(
80
+ "Could not determine a consistent CSV delimiter from the sampled rows "
81
+ f"(header candidates: {readable})"
82
+ )
83
+ # Preserve valid one-column CSV behavior when the header has no candidate
84
+ # delimiter. Comma is pandas' historical/default CSV basis.
85
+ return ","
86
+
87
+
88
+ def _is_derived_metric_column(column: str) -> bool:
89
+ """Return whether a header explicitly describes a derived/error metric."""
90
+ if column.strip().lower().startswith("u_"):
91
+ return True
92
+ tokens = {token.upper() for token in re.findall(r"[A-Za-z0-9]+", column)}
93
+ return bool(tokens & _DERIVED_METRIC_TOKENS)
94
+
95
+
27
96
  def read_table(path: str | Path, sheet_name: str | int = 0) -> pd.DataFrame:
28
97
  """Read CSV or XLSX without modifying source data."""
29
98
  source = Path(path)
@@ -31,7 +100,8 @@ def read_table(path: str | Path, sheet_name: str | int = 0) -> pd.DataFrame:
31
100
  raise InputError(f"Input file does not exist: {source}")
32
101
  suffix = source.suffix.lower()
33
102
  if suffix == ".csv":
34
- frame = pd.read_csv(source)
103
+ delimiter = _detect_csv_delimiter(source)
104
+ frame = pd.read_csv(source, sep=delimiter)
35
105
  elif suffix == ".xlsx":
36
106
  frame = pd.read_excel(source, sheet_name=sheet_name)
37
107
  else:
@@ -47,6 +117,8 @@ def suggest_mappings(frame: pd.DataFrame) -> list[dict[str, str]]:
47
117
  """Conservatively suggest recognized species columns for user review."""
48
118
  suggestions: list[dict[str, str]] = []
49
119
  for column in frame.columns:
120
+ if _is_derived_metric_column(str(column)):
121
+ continue
50
122
  inferred = infer_species(str(column))
51
123
  if inferred is not None:
52
124
  name, formula = inferred
@@ -10,6 +10,7 @@ from collections.abc import Mapping
10
10
  # for common catalytic gas-phase species. Explicit composition remains inspectable.
11
11
  ATOMIC_WEIGHTS: Mapping[str, float] = {
12
12
  "H": 1.008,
13
+ "He": 4.002602,
13
14
  "C": 12.011,
14
15
  "N": 14.007,
15
16
  "O": 15.999,
@@ -33,6 +34,7 @@ ATOMIC_WEIGHTS: Mapping[str, float] = {
33
34
 
34
35
  COMMON_SPECIES: Mapping[str, str] = {
35
36
  "H2": "H2",
37
+ "HE": "He",
36
38
  "O2": "O2",
37
39
  "N2": "N2",
38
40
  "CO": "CO",
@@ -105,7 +107,11 @@ def molecular_weight(composition: Mapping[str, int]) -> float:
105
107
  def infer_species(column_name: str) -> tuple[str, str] | None:
106
108
  """Infer a common gas species only from complete column-name tokens."""
107
109
  tokens = {token.upper() for token in re.findall(r"[A-Za-z0-9]+", column_name)}
108
- matches = [(name, formula) for name, formula in COMMON_SPECIES.items() if name in tokens]
110
+ matches = [
111
+ ("He" if name == "HE" else name, formula)
112
+ for name, formula in COMMON_SPECIES.items()
113
+ if name in tokens
114
+ ]
109
115
  if len(matches) == 1:
110
116
  return matches[0]
111
117
  return None
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import argparse
5
6
  import sys
6
7
  import tkinter as tk
7
8
  from pathlib import Path
@@ -11,7 +12,13 @@ from reactorcheck.gui_controller import GUIController
11
12
  from reactorcheck.io import load_config
12
13
 
13
14
 
14
- def main(data_path: Path, config_path: Path, output_path: Path) -> None:
15
+ def main(
16
+ data_path: Path,
17
+ config_path: Path,
18
+ output_path: Path,
19
+ conversion_column: str = "conversion_CO_fraction",
20
+ expected_conversion: float = 0.5,
21
+ ) -> None:
15
22
  """Exercise mapped controls, controller, service, core, and export."""
16
23
  root = tk.Tk()
17
24
  root.withdraw()
@@ -23,10 +30,10 @@ def main(data_path: Path, config_path: Path, output_path: Path) -> None:
23
30
  root.update()
24
31
  if controller.result is None:
25
32
  raise AssertionError("GUI Analyze did not produce a result")
26
- conversion = float(controller.result.processed["conversion_CO_fraction"].iloc[0])
33
+ conversion = float(controller.result.processed[conversion_column].iloc[0])
27
34
  # Percent -> fraction -> internal-standard ratio involves ordinary binary
28
35
  # floating conversion. This matches the 1e-9 scientific regression tolerance.
29
- if abs(conversion - 0.5) > 1e-9:
36
+ if abs(conversion - expected_conversion) > 1e-9:
30
37
  raise AssertionError(f"Unexpected GUI/core conversion: {conversion}")
31
38
  if not app.summary_tree.get_children():
32
39
  raise AssertionError("GUI result table was not populated")
@@ -37,4 +44,17 @@ def main(data_path: Path, config_path: Path, output_path: Path) -> None:
37
44
 
38
45
 
39
46
  if __name__ == "__main__":
40
- main(Path(sys.argv[1]), Path(sys.argv[2]), Path(sys.argv[3]))
47
+ parser = argparse.ArgumentParser()
48
+ parser.add_argument("data", type=Path)
49
+ parser.add_argument("config", type=Path)
50
+ parser.add_argument("output", type=Path)
51
+ parser.add_argument("--conversion-column", default="conversion_CO_fraction")
52
+ parser.add_argument("--expected-conversion", type=float, default=0.5)
53
+ arguments = parser.parse_args(sys.argv[1:])
54
+ main(
55
+ arguments.data,
56
+ arguments.config,
57
+ arguments.output,
58
+ arguments.conversion_column,
59
+ arguments.expected_conversion,
60
+ )
@@ -53,7 +53,7 @@ def test_release_workflow_is_trusted_publishing_only() -> None:
53
53
  assert "/tmp/reactorcheck-release-venv/bin/python -m pip check" in workflow
54
54
  assert "id-token: write" in workflow
55
55
  assert "name: pypi" in workflow
56
- assert "pypa/gh-action-pypi-publish@release/v1" in workflow
56
+ assert "pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33" in workflow
57
57
  assert "PYPI_API_TOKEN" not in workflow
58
58
  assert "secrets." not in workflow
59
59
  publish = workflow.split(" publish:\n", maxsplit=1)[1]
@@ -0,0 +1,191 @@
1
+ """Minimal regressions derived from public laboratory data.
2
+
3
+ RC-PUB-001
4
+ Source DOI: 10.5281/zenodo.8314734
5
+ Source files: A1_G1_FBTesting_XDB4x_RawData.xlsx and
6
+ A1_G1_FBData_XDB4x_mean.csv
7
+ License: CC BY 4.0
8
+ Reduction: retain public column names for mapping and one measured row for
9
+ ratio reconstruction, with explicit attribution in the test docstring; no
10
+ source file is redistributed.
11
+
12
+ RC-PUB-002
13
+ Source DOI: 10.17632/sw7225g8xr.3
14
+ Source file: data_V2.csv, zero-based data rows 0 and 1
15
+ License: CC BY 4.0
16
+ Reduction: retain the public header and two representative, unmodified
17
+ records needed to reproduce delimiter detection; no source file is
18
+ redistributed.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ from pathlib import Path
24
+
25
+ import pandas as pd
26
+ import pytest
27
+
28
+ from reactorcheck.io import InputError, read_table, suggest_mappings
29
+ from reactorcheck.models import (
30
+ AnalysisConfig,
31
+ ChannelMapping,
32
+ CompositionSettings,
33
+ Species,
34
+ )
35
+ from reactorcheck.service import analyze_frame
36
+
37
+ RWGS_HEADER = (
38
+ "H2toCO2;GHSV;pset;Tout;Tset;GA_H2_corrected;GA_CH4_corrected;"
39
+ "GA_CO_corrected;GA_CO2_corrected;u_GA_H2;u_GA_CH4;u_GA_CO;"
40
+ "u_GA_CO2;XCO2;SCO"
41
+ )
42
+ RWGS_ROWS = (
43
+ "3.00;8000.00;1.00;576.11;550.00;63.76;10.36;9.66;20.29;"
44
+ "1.6E+00;1.2E-01;2.6E-01;3.1E-01;52.86;48.11",
45
+ "3.00;8000.00;3.00;579.84;550.00;58.81;16.02;7.69;21.79;"
46
+ "1.6E+00;2.3E-01;2.0E-01;3.4E-01;54.82;31.88",
47
+ )
48
+
49
+
50
+ def test_public_semicolon_csv_is_read_as_fifteen_columns(tmp_path: Path) -> None:
51
+ source = tmp_path / "data_V2.csv"
52
+ source.write_text("\r\n".join((RWGS_HEADER, *RWGS_ROWS)) + "\r\n", encoding="ascii")
53
+
54
+ frame = read_table(source)
55
+
56
+ assert frame.shape == (2, 15)
57
+ assert list(frame.columns[-3:]) == ["u_GA_CO2", "XCO2", "SCO"]
58
+ assert frame.loc[0, "GA_CO2_corrected"] == pytest.approx(20.29)
59
+
60
+
61
+ def test_ambiguous_csv_delimiter_fails_explicitly(tmp_path: Path) -> None:
62
+ source = tmp_path / "ambiguous.csv"
63
+ source.write_text("a,b;c\n1,2;3\n", encoding="utf-8")
64
+
65
+ with pytest.raises(InputError, match="Ambiguous CSV delimiter"):
66
+ read_table(source)
67
+
68
+
69
+ def test_structurally_inconsistent_public_delimiter_fails_explicitly(tmp_path: Path) -> None:
70
+ source = tmp_path / "ragged.csv"
71
+ source.write_text("a;b\n1;2;3\n", encoding="utf-8")
72
+
73
+ with pytest.raises(InputError, match="consistent CSV delimiter"):
74
+ read_table(source)
75
+
76
+
77
+ def test_public_metric_and_uncertainty_columns_are_not_species_measurements() -> None:
78
+ columns = [
79
+ "GA_CO_corrected",
80
+ "GA_CO2_corrected",
81
+ "u_GA_CO",
82
+ "u_GA_CO2",
83
+ "CO2 Conversion (%)",
84
+ "MeOH Selectivity (%)",
85
+ "CH4 Selectivity(%)",
86
+ "CO Selectivity(%)",
87
+ "CO2_fr (ml/min)",
88
+ ]
89
+
90
+ suggestions = suggest_mappings(read_table_from_header(columns))
91
+
92
+ assert suggestions == [
93
+ {"column": "GA_CO_corrected", "species": "CO", "formula": "CO"},
94
+ {"column": "GA_CO2_corrected", "species": "CO2", "formula": "CO2"},
95
+ {"column": "CO2_fr (ml/min)", "species": "CO2", "formula": "CO2"},
96
+ ]
97
+
98
+
99
+ def test_public_raw_gc_header_recognizes_helium_without_selecting_a_detector() -> None:
100
+ columns = [
101
+ "FID_B_CO2_Conc",
102
+ "TCD_Aux_CO2_Conc",
103
+ "TCD_Aux_H2_Conc",
104
+ "TCD_Aux_He_Conc",
105
+ "TCD_Aux_N2_Conc",
106
+ ]
107
+
108
+ suggestions = suggest_mappings(read_table_from_header(columns))
109
+
110
+ assert {item["column"] for item in suggestions} == set(columns)
111
+ assert next(item for item in suggestions if item["column"] == "TCD_Aux_He_Conc") == {
112
+ "column": "TCD_Aux_He_Conc",
113
+ "species": "He",
114
+ "formula": "He",
115
+ }
116
+ assert sum(item["species"] == "CO2" for item in suggestions) == 2
117
+ assert Species("He", "He").molecular_weight_g_mol == pytest.approx(4.002602)
118
+
119
+
120
+ @pytest.mark.scientific
121
+ def test_public_raw_gc_row_supports_explicit_helium_reconstruction() -> None:
122
+ """RC-PUB-001: one measured row exercises explicit He reconstruction.
123
+
124
+ Derived from DOI 10.5281/zenodo.8314734, file
125
+ A1_G1_FBTesting_XDB4x_RawData.xlsx, sheet ``Run Data``, identified by
126
+ ``SampleTimeId=715``, ``Reactor=1``, and ``ElapsedRunTime=4.423007``
127
+ (CC BY 4.0). The single row retains only analysis values and is not a substitute
128
+ for validating the full source workbook. Feed ratios follow the cited
129
+ publication; the explicit nonreactive He assumption remains user-owned.
130
+ """
131
+ frame = pd.DataFrame(
132
+ {
133
+ "ElapsedRunTime": [4.423007],
134
+ "TCD_Aux_CO2_Conc": [8.955452],
135
+ "TCD_Aux_H2_Conc": [25.381241],
136
+ "TCD_Aux_He_Conc": [6.170010],
137
+ "TCD_Aux_N2_Conc": [56.361374],
138
+ "TCD_Aux_CO_Conc": [0.0],
139
+ "FID_F_CH4_Conc": [0.111773],
140
+ "FID_B_MeOH_Conc": [0.0],
141
+ }
142
+ )
143
+ channels = (
144
+ ChannelMapping(
145
+ "TCD_Aux_CO2_Conc", Species("CO2", "CO2"), "reactant", "percent", "1.875 mL/min"
146
+ ),
147
+ ChannelMapping(
148
+ "TCD_Aux_H2_Conc", Species("H2", "H2"), "reactant", "percent", "5.625 mL/min"
149
+ ),
150
+ ChannelMapping("TCD_Aux_He_Conc", Species("He", "He"), "inert", "percent"),
151
+ ChannelMapping("TCD_Aux_N2_Conc", Species("N2", "N2"), "inert", "percent", "3.5 mL/min"),
152
+ ChannelMapping("TCD_Aux_CO_Conc", Species("CO", "CO"), "product", "percent"),
153
+ ChannelMapping("FID_F_CH4_Conc", Species("CH4", "CH4"), "product", "percent"),
154
+ ChannelMapping("FID_B_MeOH_Conc", Species("CH3OH", "CH3OH"), "product", "percent"),
155
+ )
156
+ config = AnalysisConfig(
157
+ time_column="ElapsedRunTime",
158
+ time_unit="h",
159
+ channels=channels,
160
+ reference_reactant="CO2",
161
+ catalyst_mass="0.05 g",
162
+ composition=CompositionSettings(
163
+ normalization="raw_measured",
164
+ water_basis="dry",
165
+ internal_standard="He",
166
+ internal_standard_feed="1.5 mL/min",
167
+ confirmed_nonreactive=True,
168
+ assumption=(
169
+ "The user confirms the publication's deliberately added He is "
170
+ "nonreactive, so F_He,out = F_He,in."
171
+ ),
172
+ ),
173
+ )
174
+
175
+ result = analyze_frame(frame, config, source="RC-PUB-001 minimal measured row")
176
+
177
+ processed = result.processed.iloc[0]
178
+ assert processed["flow_out_CO2_mol_h"] / processed["flow_out_He_mol_h"] == pytest.approx(
179
+ 8.955452 / 6.170010
180
+ )
181
+ assert processed["flow_out_H2_mol_h"] / processed["flow_out_He_mol_h"] == pytest.approx(
182
+ 25.381241 / 6.170010
183
+ )
184
+ provenance = result.provenance.iloc[0]
185
+ assert provenance["internal_standard"] == "He"
186
+ assert provenance["internal_standard_assumption"] == config.composition.assumption
187
+
188
+
189
+ def read_table_from_header(columns: list[str]) -> pd.DataFrame:
190
+ """Build an in-memory table without introducing a bundled data fixture."""
191
+ return pd.DataFrame(columns=columns, index=[0], dtype=float)
@@ -18,4 +18,4 @@ def _match(path: Path, pattern: str) -> str:
18
18
  def test_version_surfaces_are_consistent() -> None:
19
19
  pyproject = _match(ROOT / "pyproject.toml", r'^version = "([^"]+)"$')
20
20
  citation = _match(ROOT / "CITATION.cff", r"^version: ([^\s]+)$")
21
- assert __version__ == pyproject == citation == "0.2.1"
21
+ assert __version__ == pyproject == citation == "0.2.2"
File without changes