eemkit 0.1.0__tar.gz → 0.2.0__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 (126) hide show
  1. eemkit-0.2.0/CHANGELOG.md +100 -0
  2. {eemkit-0.1.0 → eemkit-0.2.0}/CITATION.cff +10 -2
  3. {eemkit-0.1.0 → eemkit-0.2.0}/PKG-INFO +47 -12
  4. {eemkit-0.1.0 → eemkit-0.2.0}/README.md +46 -11
  5. {eemkit-0.1.0 → eemkit-0.2.0}/docs/api.md +38 -0
  6. {eemkit-0.1.0 → eemkit-0.2.0}/docs/app-guide.md +24 -10
  7. eemkit-0.2.0/docs/cli.md +82 -0
  8. eemkit-0.2.0/docs/corrections.md +120 -0
  9. {eemkit-0.1.0 → eemkit-0.2.0}/docs/gui.md +2 -3
  10. eemkit-0.2.0/docs/img/app/1_project.png +0 -0
  11. {eemkit-0.1.0 → eemkit-0.2.0}/docs/img/app/2_corrections.png +0 -0
  12. eemkit-0.2.0/docs/img/app/3_indices.png +0 -0
  13. eemkit-0.2.0/docs/img/app/4a_parafac_ranks.png +0 -0
  14. eemkit-0.2.0/docs/img/app/4c_parafac_final.png +0 -0
  15. eemkit-0.2.0/docs/img/app/5a_rivers_time.png +0 -0
  16. eemkit-0.2.0/docs/img/app/5b_rivers_composition.png +0 -0
  17. eemkit-0.2.0/docs/img/app/5c_rivers_tests.png +0 -0
  18. eemkit-0.2.0/docs/img/app/6_export.png +0 -0
  19. {eemkit-0.1.0 → eemkit-0.2.0}/docs/index.md +30 -15
  20. eemkit-0.2.0/docs/instruments.md +78 -0
  21. eemkit-0.2.0/docs/parafac.md +160 -0
  22. {eemkit-0.1.0 → eemkit-0.2.0}/pyproject.toml +3 -0
  23. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/__init__.py +1 -1
  24. eemkit-0.2.0/src/eemkit/__main__.py +7 -0
  25. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/absorbance.py +19 -0
  26. eemkit-0.2.0/src/eemkit/cli.py +234 -0
  27. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/corrections/__init__.py +9 -1
  28. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/corrections/_common.py +13 -3
  29. eemkit-0.2.0/src/eemkit/corrections/dilution.py +124 -0
  30. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/corrections/inner_filter.py +1 -1
  31. eemkit-0.2.0/src/eemkit/corrections/instrument.py +96 -0
  32. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/corrections/scatter.py +13 -1
  33. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/corrections/spectral.py +3 -1
  34. eemkit-0.2.0/src/eemkit/corrections/zap.py +83 -0
  35. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/export_tab.py +8 -1
  36. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/main_window.py +1 -1
  37. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/parafac_tab.py +2 -0
  38. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/project_tab.py +124 -3
  39. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/io/discover.py +64 -4
  40. eemkit-0.2.0/src/eemkit/io/instruments.py +338 -0
  41. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/io/loader.py +34 -6
  42. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/parafac/__init__.py +20 -1
  43. eemkit-0.2.0/src/eemkit/parafac/compare.py +86 -0
  44. eemkit-0.2.0/src/eemkit/parafac/diagnostics.py +148 -0
  45. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/parafac/model.py +148 -6
  46. eemkit-0.2.0/src/eemkit/parafac/outliers.py +90 -0
  47. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/parafac/validation.py +13 -2
  48. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/pipeline.py +118 -24
  49. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/plot.py +89 -0
  50. eemkit-0.2.0/src/eemkit/report.py +313 -0
  51. eemkit-0.2.0/tests/data/eemR/README.md +20 -0
  52. eemkit-0.2.0/tests/data/eemR/aqualog/sample4.dat +253 -0
  53. eemkit-0.2.0/tests/data/eemR/eemR_DESCRIPTION.txt +27 -0
  54. eemkit-0.2.0/tests/data/eemR/fluoromax4/f1.dat +117 -0
  55. eemkit-0.2.0/tests/data/eemR/fluoromax4/f2.dat +117 -0
  56. eemkit-0.2.0/tests/data/eemR/fluoromax4/f3.dat +117 -0
  57. eemkit-0.2.0/tests/data/eemR/hitachi-f7000-fl/hitachi1.TXT +213 -0
  58. eemkit-0.2.0/tests/data/eemR/hitachi-f7000-fl/hitachi2.TXT +213 -0
  59. eemkit-0.2.0/tests/data/eemR/shimadzu/shimadzu.TXT +8145 -0
  60. eemkit-0.2.0/tests/test_cli.py +71 -0
  61. eemkit-0.2.0/tests/test_dilution_zap.py +162 -0
  62. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_gui.py +35 -0
  63. eemkit-0.2.0/tests/test_instruments.py +190 -0
  64. eemkit-0.2.0/tests/test_outliers_report.py +88 -0
  65. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_parafac.py +40 -2
  66. eemkit-0.2.0/tests/test_parafac_compare.py +168 -0
  67. eemkit-0.1.0/CHANGELOG.md +0 -35
  68. eemkit-0.1.0/docs/corrections.md +0 -55
  69. eemkit-0.1.0/docs/img/app/1_project.png +0 -0
  70. eemkit-0.1.0/docs/img/app/3_indices.png +0 -0
  71. eemkit-0.1.0/docs/img/app/4a_parafac_ranks.png +0 -0
  72. eemkit-0.1.0/docs/img/app/4c_parafac_final.png +0 -0
  73. eemkit-0.1.0/docs/img/app/5a_rivers_time.png +0 -0
  74. eemkit-0.1.0/docs/img/app/5b_rivers_composition.png +0 -0
  75. eemkit-0.1.0/docs/img/app/5c_rivers_tests.png +0 -0
  76. eemkit-0.1.0/docs/img/app/6_export.png +0 -0
  77. eemkit-0.1.0/docs/parafac.md +0 -44
  78. eemkit-0.1.0/src/eemkit/parafac/diagnostics.py +0 -56
  79. {eemkit-0.1.0 → eemkit-0.2.0}/.gitignore +0 -0
  80. {eemkit-0.1.0 → eemkit-0.2.0}/LICENSE +0 -0
  81. {eemkit-0.1.0 → eemkit-0.2.0}/docs/absorbance.md +0 -0
  82. {eemkit-0.1.0 → eemkit-0.2.0}/docs/campaigns.md +0 -0
  83. {eemkit-0.1.0 → eemkit-0.2.0}/docs/data_model.md +0 -0
  84. {eemkit-0.1.0 → eemkit-0.2.0}/docs/img/app/4b_parafac_outliers.png +0 -0
  85. {eemkit-0.1.0 → eemkit-0.2.0}/docs/img/app/4d_parafac_by_model.png +0 -0
  86. {eemkit-0.1.0 → eemkit-0.2.0}/docs/indices.md +0 -0
  87. {eemkit-0.1.0 → eemkit-0.2.0}/docs/plotting.md +0 -0
  88. {eemkit-0.1.0 → eemkit-0.2.0}/docs/quickstart.md +0 -0
  89. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/campaigns.py +0 -0
  90. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/core/__init__.py +0 -0
  91. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/core/dataset.py +0 -0
  92. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/core/grid.py +0 -0
  93. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/core/history.py +0 -0
  94. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/corrections/blank.py +0 -0
  95. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/corrections/crop.py +0 -0
  96. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/corrections/raman.py +0 -0
  97. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/errors.py +0 -0
  98. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/__init__.py +0 -0
  99. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/__main__.py +0 -0
  100. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/campaigns_tab.py +0 -0
  101. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/common.py +0 -0
  102. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/corrections_tab.py +0 -0
  103. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/indices_tab.py +0 -0
  104. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/state.py +0 -0
  105. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/gui/theme.py +0 -0
  106. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/indices.py +0 -0
  107. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/io/__init__.py +0 -0
  108. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/io/_cary_csv.py +0 -0
  109. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/io/cary60.py +0 -0
  110. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/io/cary_eclipse.py +0 -0
  111. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/io/pairing.py +0 -0
  112. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/parafac/_cp.py +0 -0
  113. {eemkit-0.1.0 → eemkit-0.2.0}/src/eemkit/parafac/export.py +0 -0
  114. {eemkit-0.1.0 → eemkit-0.2.0}/tests/conftest.py +0 -0
  115. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_absorbance.py +0 -0
  116. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_campaigns.py +0 -0
  117. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_cary60.py +0 -0
  118. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_cary_eclipse.py +0 -0
  119. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_corrections.py +0 -0
  120. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_dataset.py +0 -0
  121. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_grid.py +0 -0
  122. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_indices.py +0 -0
  123. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_pairing.py +0 -0
  124. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_pipeline.py +0 -0
  125. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_plot.py +0 -0
  126. {eemkit-0.1.0 → eemkit-0.2.0}/tests/test_real_data.py +0 -0
@@ -0,0 +1,100 @@
1
+ # Changelog
2
+
3
+ All notable changes are listed here. Versions follow
4
+ [semantic versioning](https://semver.org/).
5
+
6
+ ## 0.2.0 (2026-11-06)
7
+
8
+ Other fluorometers, diluted samples, zap, PARAFAC model comparison and
9
+ diagnostics, new samples on a fitted model, an HTML report and a command
10
+ line; benchmarked against drEEM as well as staRdom. One result changes: core
11
+ consistency is now computed as in drEEM (first item).
12
+
13
+ * **Changed: core consistency is now computed as the N-way toolbox's
14
+ `corcond` (the copy used by drEEM)**: loading vectors of each component
15
+ scaled to the same norm, core fitted to the observed cells only (missing
16
+ values left out, not filled with the model), denominator the sum of squares
17
+ of the core. eemkit 0.1 gave values that depended on how each component's
18
+ size was split between the modes; values now match drEEM 2.26.03 to 10⁻⁶ %
19
+ (tested). They are usually lower than before for good models (Ombrone,
20
+ 3 components: 75.0 % instead of 85.5 %) and no longer strongly negative for
21
+ overfactored ones; EEMqual changes with them. The models themselves do not
22
+ change. Rank-1 models are now computed too, instead of set to 100.
23
+ * Application: the window no longer grows wider than the screen once a final
24
+ PARAFAC model is shown (its summary line now wraps); it fits a 1366-pixel
25
+ wide laptop screen.
26
+ * Benchmark of the PARAFAC fit against drEEM 2.26.03 (N-way and parafac3w
27
+ engines) on the Ombrone data: same model, Tucker congruence ≥ 0.9999.
28
+
29
+ * Command line: `eemkit check project.toml` reports missing files and
30
+ settings; `eemkit run project.toml` runs the whole chain and exports the
31
+ results, as the application does (also `python -m eemkit`).
32
+ * PARAFAC random starts run in parallel threads (`n_jobs`, default every
33
+ processor); the model does not depend on it.
34
+ * README and documentation: install from PyPI, Zenodo DOI.
35
+ * Shift- and shape-sensitive congruence (`shift_shape_congruence`; Wünsch et
36
+ al. 2019), also reported in split-half validation (`ssc_ex`, `ssc_em`).
37
+ * `eemqual` (Bro & Vidal 2011) and an `eemqual` column in the exploration
38
+ table.
39
+ * `compare_models`, `compare_ranks` and `component_correlations` to compare
40
+ PARAFAC models and their components.
41
+ * `project_samples`: scores of new samples on a fitted model with its spectra
42
+ fixed, with a flag for samples the model describes worse than any of its
43
+ own.
44
+ * PARAFAC models store each sample's data sum of squares (`data_sumsq`).
45
+ * Outlier diagnostics: `sample_diagnostics` (leverage, relative residual and
46
+ ranks per sample), `spectral_residuals` (residual by wavelength), and the
47
+ figures `plot.residual_eems` and `plot.spectral_residuals`.
48
+ * Other fluorometers: readers for Horiba Aqualog and Fluoromax, Hitachi
49
+ F-7000 (over-range values to missing), Shimadzu (excitation wavelengths from
50
+ the settings) and any text matrix; two-column absorbance files. The format
51
+ is set in `project.instrument` / `project.absorbance_format`, and the folder
52
+ scan follows it. Processing already done by the instrument software (e.g.
53
+ Aqualog "Sample - Blank") must be declared in `project.already_done`: it is
54
+ recorded, never repeated nor skipped silently. Files that do not state the
55
+ instrument's spectral correction are marked "unknown". Tested on the
56
+ example files of the R package eemR. In the application, an `Instrument`
57
+ box on the Project page sets the formats and the steps already done.
58
+ * Diluted samples: optional pairing-table columns `dilution_factor` and
59
+ `abs_dilution_factor`; absorbance rescaled to the EEM's dilution before the
60
+ inner-filter correction (`match_absorbance_dilution`), EEMs multiplied by
61
+ their dilution after Raman units (`correct_dilution`), CDOM metrics
62
+ reported for the undiluted sample.
63
+ * `zap`: regions listed in the project file (`[zap]`) set to NaN after Raman
64
+ units and recorded in the history; optional interpolation separate from the
65
+ scatter bands (`interpolate_missing(only=...)`).
66
+ * `report.html`: the whole analysis on one self-contained page (samples,
67
+ processing history, indices, exploration, final model, validation, outlier
68
+ diagnostics, settings), from `eemkit.report.write_report`, the export
69
+ (`report=True`), the command line and the application's Export page.
70
+
71
+ ## 0.1.0 (2026-11-05)
72
+
73
+ First public release.
74
+
75
+ * Readers for Agilent Cary Eclipse 3-D EEMs and Cary 60 absorbance CSV files;
76
+ folder scan, pairing table draft (always excluded until checked) and
77
+ multi-sample `xarray` dataset on common wavelength grids.
78
+ * Corrections in an enforced order: instrument spectral correction,
79
+ absorbance blank, inner filter, blank subtraction, Raman units, scatter
80
+ removal with optional interpolation, crop. Every step is recorded in the
81
+ processing history.
82
+ * Fluorescence indices (FI, HIX, BIX) and Coble peaks.
83
+ * CDOM metrics from the absorbance spectra (`eemkit.absorbance`): a254, a350,
84
+ S275–295, S350–400, SR, E2:E3 and SUVA254 (with a DOC column), after a
85
+ 680–700 nm baseline correction; low-signal values are left empty with the
86
+ reason.
87
+ * Non-negative PARAFAC with missing values, random starts, core consistency,
88
+ leverage, split-half validation and OpenFluor export.
89
+ * Comparison of campaigns, sites and rivers (`eemkit.campaigns`): replicate
90
+ means per site and time, design and confounding warnings, Kruskal–Wallis
91
+ and Dunn–Holm tests within each group, Spearman correlations with site
92
+ position and with covariates, PARAFAC composition; optional site and
93
+ covariate tables.
94
+ * Publication figures (`eemkit.plot`), including a Cary Eclipse colour scale.
95
+ * `eemkit.pipeline`: the whole chain driven by one settings file.
96
+ * Desktop application (`eemkit-gui`, PySide6): a sidebar of steps with their
97
+ status, light and dark themes, and a "Rivers and dates" page; a
98
+ PyInstaller recipe for a stand-alone Windows build, which ships the
99
+ licence texts of eemkit, Qt and every bundled package.
100
+ * Benchmarked against staRdom 1.1.32 on 205 river-water samples.
@@ -6,8 +6,16 @@ authors:
6
6
  - family-names: Cirrone
7
7
  given-names: Riccardo Gaetano
8
8
  affiliation: University of Siena
9
- version: 0.1.0
10
- date-released: "2026-11-05"
9
+ version: 0.2.0
10
+ date-released: "2026-11-06"
11
+ doi: 10.5281/zenodo.23982732
12
+ identifiers:
13
+ - type: doi
14
+ value: 10.5281/zenodo.23982732
15
+ description: "All versions (concept DOI); resolves to the latest release"
16
+ - type: doi
17
+ value: 10.5281/zenodo.23982733
18
+ description: "Version 0.1.0"
11
19
  license: GPL-3.0-or-later
12
20
  repository-code: "https://github.com/LowCostSensor/eemkit"
13
21
  url: "https://lowcostsensor.github.io/eemkit/"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: eemkit
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Excitation-emission matrix (EEM) processing and PARAFAC modelling of dissolved organic matter fluorescence
5
5
  Project-URL: Homepage, https://github.com/LowCostSensor/eemkit
6
6
  Project-URL: Documentation, https://lowcostsensor.github.io/eemkit/
@@ -46,6 +46,8 @@ Description-Content-Type: text/markdown
46
46
 
47
47
  [![tests](https://github.com/LowCostSensor/eemkit/actions/workflows/tests.yml/badge.svg)](https://github.com/LowCostSensor/eemkit/actions/workflows/tests.yml)
48
48
  [![docs](https://github.com/LowCostSensor/eemkit/actions/workflows/docs.yml/badge.svg)](https://lowcostsensor.github.io/eemkit/)
49
+ [![PyPI](https://img.shields.io/pypi/v/eemkit.svg)](https://pypi.org/project/eemkit/)
50
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23982732.svg)](https://doi.org/10.5281/zenodo.23982732)
49
51
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/LowCostSensor/eemkit/blob/main/LICENSE)
50
52
 
51
53
  Python tools and a desktop application for fluorescence excitation-emission
@@ -58,30 +60,45 @@ step recorded so that an analysis can be repeated exactly.
58
60
  ## What it does
59
61
 
60
62
  * **Import** Agilent Cary Eclipse 3-D EEMs and Cary 60 absorbance spectra
61
- (CSV "ASCII with log"), with the instrument settings from the file log.
63
+ (CSV "ASCII with log"), with the instrument settings from the file log;
64
+ also Horiba Aqualog and Fluoromax, Hitachi F-7000, Shimadzu and plain
65
+ matrix or two-column files. Processing already done by the instrument
66
+ software must be declared and is never repeated.
62
67
  Samples, blanks and absorbance spectra are paired through an explicit,
63
68
  hand-editable table: nothing is matched silently.
64
69
  * **Correct** in a fixed, enforced order: instrument spectral correction
65
70
  (optional), absorbance blank, inner-filter effect (Kothawala et al. 2013),
66
71
  blank subtraction, Raman units (Lawaetz & Stedmon 2009), Rayleigh and Raman
67
72
  scatter removal, crop. Values that depend on the measurement, such as cuvette
68
- path lengths, have no defaults.
73
+ path lengths, have no defaults. Diluted samples are handled (absorbance
74
+ rescaled to the EEM's dilution, EEMs multiplied back after Raman units), and
75
+ regions to discard can be zapped; both are recorded.
69
76
  * **Indices**: fluorescence index, humification and biological indices, Coble
70
77
  peaks.
71
78
  * **CDOM metrics** from the absorbance spectra: a254, a350, spectral slopes
72
79
  S275–295 and S350–400, slope ratio (Helms et al. 2008), E2:E3 and SUVA254,
73
80
  after a baseline correction; values the signal cannot support are left
74
81
  empty with the reason.
75
- * **PARAFAC** with non-negativity and missing values, random starts, core
76
- consistency, leverage and residuals, split-half validation (Murphy et al.
77
- 2013) and export to OpenFluor.
82
+ * **PARAFAC** with non-negativity and missing values, random starts run in
83
+ parallel, split-half validation (Murphy et al. 2013) and export to
84
+ OpenFluor. Models are judged by core consistency (computed as in drEEM),
85
+ shift- and shape-sensitive congruence (Wünsch et al. 2019) and EEMqual (Bro
86
+ & Vidal 2011); models and ranks can be compared component by component.
87
+ * **Outliers**: leverage, residuals by sample and by wavelength, and residual
88
+ EEMs of the worst-fitted samples.
89
+ * **New samples** can be scored on a fitted model with its spectra fixed;
90
+ samples the model describes worse than any of its own are flagged.
78
91
  * **Rivers, sites and dates**: any index, CDOM metric or PARAFAC component
79
92
  compared between sampling campaigns within each river (replicates averaged
80
93
  per site, Kruskal–Wallis and Dunn tests), along the river and against
81
94
  covariates such as discharge or rainfall, with a warning when rivers and
82
95
  dates cannot be separated.
83
96
  * **Figures** for publication, and a **desktop application** (PySide6, light
84
- and dark themes) that drives the whole chain without code.
97
+ and dark themes) that drives the whole chain without code; the same chain
98
+ also runs from the command line (`eemkit run project.toml`).
99
+ * **Report**: the whole analysis on one self-contained HTML page (samples,
100
+ processing history, indices, PARAFAC exploration, final model, validation,
101
+ outliers, settings).
85
102
  * **Provenance**: data are `xarray` datasets that carry their metadata and the
86
103
  full processing history; one settings file drives both scripts and the
87
104
  application.
@@ -142,7 +159,12 @@ pipeline.export_results("results", s, corrected=corrected, indices=indices,
142
159
  ```
143
160
 
144
161
  Or start the application (`python -m eemkit.gui`) and open the same
145
- `project.toml`.
162
+ `project.toml`, or run it from a terminal:
163
+
164
+ ```bash
165
+ eemkit check project.toml # missing files and settings
166
+ eemkit run project.toml # the whole chain, results in project.output_dir
167
+ ```
146
168
 
147
169
  Every function can also be used on its own; see the
148
170
  [documentation](https://lowcostsensor.github.io/eemkit/).
@@ -158,6 +180,11 @@ was compared with the R package staRdom 1.1.32 (Pucher et al. 2019):
158
180
  * the 3-component PARAFAC models have Tucker congruence ≥ 0.999 for every
159
181
  excitation and emission loading.
160
182
 
183
+ The PARAFAC model was also compared with drEEM 2.26.03 (MATLAB; Murphy et al.
184
+ 2013), with both its engines, the N-way toolbox and parafac3w: Tucker
185
+ congruence ≥ 0.9999, Fmax correlation 1.00000, same explained variance, and
186
+ core consistency within 0.1 %.
187
+
161
188
  The scripts and the full report are in
162
189
  [ombrone-fdom](https://github.com/LowCostSensor/ombrone-fdom).
163
190
 
@@ -176,10 +203,18 @@ to its root folder. Contributions and bug reports are welcome: see
176
203
 
177
204
  ## Citation
178
205
 
179
- If you use eemkit, please cite it (see
180
- [CITATION.cff](https://github.com/LowCostSensor/eemkit/blob/main/CITATION.cff); a DOI is
181
- issued on Zenodo for every release) and the methods it implements, listed in
182
- the documentation of each step.
206
+ If you use eemkit, please cite it, together with the methods it implements
207
+ (listed in the documentation of each step):
208
+
209
+ > Cirrone, R. G. eemkit: EEM processing and PARAFAC modelling of dissolved
210
+ > organic matter fluorescence. Zenodo.
211
+ > [doi:10.5281/zenodo.23982732](https://doi.org/10.5281/zenodo.23982732)
212
+
213
+ This DOI always points to the latest version; each release also has its own
214
+ DOI, listed on the Zenodo page (0.1.0:
215
+ [10.5281/zenodo.23982733](https://doi.org/10.5281/zenodo.23982733)). The
216
+ details are in
217
+ [CITATION.cff](https://github.com/LowCostSensor/eemkit/blob/main/CITATION.cff).
183
218
 
184
219
  ## License
185
220
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  [![tests](https://github.com/LowCostSensor/eemkit/actions/workflows/tests.yml/badge.svg)](https://github.com/LowCostSensor/eemkit/actions/workflows/tests.yml)
4
4
  [![docs](https://github.com/LowCostSensor/eemkit/actions/workflows/docs.yml/badge.svg)](https://lowcostsensor.github.io/eemkit/)
5
+ [![PyPI](https://img.shields.io/pypi/v/eemkit.svg)](https://pypi.org/project/eemkit/)
6
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23982732.svg)](https://doi.org/10.5281/zenodo.23982732)
5
7
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/LowCostSensor/eemkit/blob/main/LICENSE)
6
8
 
7
9
  Python tools and a desktop application for fluorescence excitation-emission
@@ -14,30 +16,45 @@ step recorded so that an analysis can be repeated exactly.
14
16
  ## What it does
15
17
 
16
18
  * **Import** Agilent Cary Eclipse 3-D EEMs and Cary 60 absorbance spectra
17
- (CSV "ASCII with log"), with the instrument settings from the file log.
19
+ (CSV "ASCII with log"), with the instrument settings from the file log;
20
+ also Horiba Aqualog and Fluoromax, Hitachi F-7000, Shimadzu and plain
21
+ matrix or two-column files. Processing already done by the instrument
22
+ software must be declared and is never repeated.
18
23
  Samples, blanks and absorbance spectra are paired through an explicit,
19
24
  hand-editable table: nothing is matched silently.
20
25
  * **Correct** in a fixed, enforced order: instrument spectral correction
21
26
  (optional), absorbance blank, inner-filter effect (Kothawala et al. 2013),
22
27
  blank subtraction, Raman units (Lawaetz & Stedmon 2009), Rayleigh and Raman
23
28
  scatter removal, crop. Values that depend on the measurement, such as cuvette
24
- path lengths, have no defaults.
29
+ path lengths, have no defaults. Diluted samples are handled (absorbance
30
+ rescaled to the EEM's dilution, EEMs multiplied back after Raman units), and
31
+ regions to discard can be zapped; both are recorded.
25
32
  * **Indices**: fluorescence index, humification and biological indices, Coble
26
33
  peaks.
27
34
  * **CDOM metrics** from the absorbance spectra: a254, a350, spectral slopes
28
35
  S275–295 and S350–400, slope ratio (Helms et al. 2008), E2:E3 and SUVA254,
29
36
  after a baseline correction; values the signal cannot support are left
30
37
  empty with the reason.
31
- * **PARAFAC** with non-negativity and missing values, random starts, core
32
- consistency, leverage and residuals, split-half validation (Murphy et al.
33
- 2013) and export to OpenFluor.
38
+ * **PARAFAC** with non-negativity and missing values, random starts run in
39
+ parallel, split-half validation (Murphy et al. 2013) and export to
40
+ OpenFluor. Models are judged by core consistency (computed as in drEEM),
41
+ shift- and shape-sensitive congruence (Wünsch et al. 2019) and EEMqual (Bro
42
+ & Vidal 2011); models and ranks can be compared component by component.
43
+ * **Outliers**: leverage, residuals by sample and by wavelength, and residual
44
+ EEMs of the worst-fitted samples.
45
+ * **New samples** can be scored on a fitted model with its spectra fixed;
46
+ samples the model describes worse than any of its own are flagged.
34
47
  * **Rivers, sites and dates**: any index, CDOM metric or PARAFAC component
35
48
  compared between sampling campaigns within each river (replicates averaged
36
49
  per site, Kruskal–Wallis and Dunn tests), along the river and against
37
50
  covariates such as discharge or rainfall, with a warning when rivers and
38
51
  dates cannot be separated.
39
52
  * **Figures** for publication, and a **desktop application** (PySide6, light
40
- and dark themes) that drives the whole chain without code.
53
+ and dark themes) that drives the whole chain without code; the same chain
54
+ also runs from the command line (`eemkit run project.toml`).
55
+ * **Report**: the whole analysis on one self-contained HTML page (samples,
56
+ processing history, indices, PARAFAC exploration, final model, validation,
57
+ outliers, settings).
41
58
  * **Provenance**: data are `xarray` datasets that carry their metadata and the
42
59
  full processing history; one settings file drives both scripts and the
43
60
  application.
@@ -98,7 +115,12 @@ pipeline.export_results("results", s, corrected=corrected, indices=indices,
98
115
  ```
99
116
 
100
117
  Or start the application (`python -m eemkit.gui`) and open the same
101
- `project.toml`.
118
+ `project.toml`, or run it from a terminal:
119
+
120
+ ```bash
121
+ eemkit check project.toml # missing files and settings
122
+ eemkit run project.toml # the whole chain, results in project.output_dir
123
+ ```
102
124
 
103
125
  Every function can also be used on its own; see the
104
126
  [documentation](https://lowcostsensor.github.io/eemkit/).
@@ -114,6 +136,11 @@ was compared with the R package staRdom 1.1.32 (Pucher et al. 2019):
114
136
  * the 3-component PARAFAC models have Tucker congruence ≥ 0.999 for every
115
137
  excitation and emission loading.
116
138
 
139
+ The PARAFAC model was also compared with drEEM 2.26.03 (MATLAB; Murphy et al.
140
+ 2013), with both its engines, the N-way toolbox and parafac3w: Tucker
141
+ congruence ≥ 0.9999, Fmax correlation 1.00000, same explained variance, and
142
+ core consistency within 0.1 %.
143
+
117
144
  The scripts and the full report are in
118
145
  [ombrone-fdom](https://github.com/LowCostSensor/ombrone-fdom).
119
146
 
@@ -132,10 +159,18 @@ to its root folder. Contributions and bug reports are welcome: see
132
159
 
133
160
  ## Citation
134
161
 
135
- If you use eemkit, please cite it (see
136
- [CITATION.cff](https://github.com/LowCostSensor/eemkit/blob/main/CITATION.cff); a DOI is
137
- issued on Zenodo for every release) and the methods it implements, listed in
138
- the documentation of each step.
162
+ If you use eemkit, please cite it, together with the methods it implements
163
+ (listed in the documentation of each step):
164
+
165
+ > Cirrone, R. G. eemkit: EEM processing and PARAFAC modelling of dissolved
166
+ > organic matter fluorescence. Zenodo.
167
+ > [doi:10.5281/zenodo.23982732](https://doi.org/10.5281/zenodo.23982732)
168
+
169
+ This DOI always points to the latest version; each release also has its own
170
+ DOI, listed on the Zenodo page (0.1.0:
171
+ [10.5281/zenodo.23982733](https://doi.org/10.5281/zenodo.23982733)). The
172
+ details are in
173
+ [CITATION.cff](https://github.com/LowCostSensor/eemkit/blob/main/CITATION.cff).
139
174
 
140
175
  ## License
141
176
 
@@ -8,6 +8,24 @@
8
8
 
9
9
  ::: eemkit.io.cary60.mean_cycles
10
10
 
11
+ ::: eemkit.io.instruments
12
+ options:
13
+ show_root_toc_entry: false
14
+ members:
15
+ - read_aqualog
16
+ - read_fluoromax
17
+ - read_hitachi_f7000
18
+ - read_shimadzu
19
+ - read_matrix_csv
20
+ - read_two_column_absorbance
21
+
22
+ ::: eemkit.corrections.instrument
23
+ options:
24
+ show_root_toc_entry: false
25
+ members:
26
+ - check_declared
27
+ - mark_done
28
+
11
29
  ::: eemkit.io.discover.scan_folder
12
30
 
13
31
  ::: eemkit.io.discover.suggest_pairing
@@ -26,9 +44,12 @@
26
44
  - apply_spectral_correction
27
45
  - read_correction_file
28
46
  - subtract_absorbance_blank
47
+ - match_absorbance_dilution
29
48
  - correct_inner_filter
30
49
  - subtract_blank
31
50
  - normalize_raman
51
+ - correct_dilution
52
+ - zap
32
53
  - raman_area
33
54
  - remove_scatter
34
55
  - interpolate_missing
@@ -68,9 +89,18 @@
68
89
  - summary_table
69
90
  - model_eem
70
91
  - residuals
92
+ - project_samples
71
93
 
72
94
  ::: eemkit.parafac.validation.split_half
73
95
 
96
+ ::: eemkit.parafac.compare
97
+ options:
98
+ show_root_toc_entry: false
99
+
100
+ ::: eemkit.parafac.outliers
101
+ options:
102
+ show_root_toc_entry: false
103
+
74
104
  ::: eemkit.parafac.diagnostics
75
105
  options:
76
106
  show_root_toc_entry: false
@@ -94,3 +124,11 @@
94
124
  ::: eemkit.plot
95
125
  options:
96
126
  show_root_toc_entry: false
127
+
128
+ ## Report
129
+
130
+ ::: eemkit.report.write_report
131
+
132
+ ## Command line
133
+
134
+ ::: eemkit.cli.main
@@ -4,7 +4,7 @@ How to use the eemkit desktop application to go from Cary Eclipse and Cary 60 CS
4
4
 
5
5
  The screenshots show river-water samples from the Ombrone basin, Italy, 2024 (Polvani et al. 2026, [doi:10.1016/j.envpol.2026.127858](https://doi.org/10.1016/j.envpol.2026.127858)); the data and the project file are in the [ombrone-fdom](https://github.com/LowCostSensor/ombrone-fdom) repository.
6
6
 
7
- The app is a front end to the eemkit library and does no calculations of its own. Every button calls the same functions as a script using `eemkit.pipeline`, and gives the same results: on the Ombrone data, the 3-component model fitted in the app has 99.017 % explained variance, 85.5 % core consistency and a split-half congruence of 0.9915, as in the scripted analysis.
7
+ The app is a front end to the eemkit library and does no calculations of its own. Every button calls the same functions as a script using `eemkit.pipeline`, and gives the same results: on the Ombrone data, the 3-component model fitted in the app has 99.017 % explained variance, 75.0 % core consistency and a split-half congruence of 0.9915, as in the scripted analysis.
8
8
 
9
9
  Labels in this guide are written as they appear on screen, for example `Apply corrections`.
10
10
 
@@ -17,24 +17,22 @@ installer), then, in a terminal (on Windows: *PowerShell* from the Start
17
17
  menu):
18
18
 
19
19
  ```bash
20
- python -m pip install "eemkit[gui] @ https://github.com/LowCostSensor/eemkit/archive/refs/heads/main.zip"
20
+ python -m pip install "eemkit[gui]"
21
21
  python -m eemkit.gui
22
22
  ```
23
23
 
24
- The first command installs eemkit from GitHub (it is not on PyPI yet; then it
25
- will be `pip install "eemkit[gui]"`); the `[gui]` part is needed for the
26
- application. The second starts it. To open a project directly, pass the file
27
- as an argument:
24
+ The first command installs eemkit from PyPI; the `[gui]` part is needed for
25
+ the application. The second starts it. To open a project directly, pass the
26
+ file as an argument:
28
27
 
29
28
  ```bash
30
29
  python -m eemkit.gui path/to/project.toml
31
30
  ```
32
31
 
33
- To update an existing installation while the version number has not changed
34
- (`--upgrade` is not enough), reinstall eemkit; the other libraries stay:
32
+ To update to the latest release:
35
33
 
36
34
  ```bash
37
- python -m pip install --force-reinstall --no-deps "eemkit @ https://github.com/LowCostSensor/eemkit/archive/refs/heads/main.zip"
35
+ python -m pip install --upgrade "eemkit[gui]"
38
36
  ```
39
37
 
40
38
  ### The Ombrone example project
@@ -86,6 +84,19 @@ This page decides which files are read and how they are paired.
86
84
  * `Pairing table`: the CSV file with the pairing. `Open…` opens an existing one.
87
85
  * `Output folder`: where step 6 writes the results. It cannot be inside the data folder.
88
86
 
87
+ ### The instrument
88
+
89
+ The `Instrument` box, on the right of the paths, says which files to read
90
+ (details in [Instruments and formats](instruments.md)):
91
+
92
+ * `Fluorometer`: Cary Eclipse (default), Horiba Aqualog or Fluoromax, Hitachi F-7000, Shimadzu, or a text matrix.
93
+ * `Absorbance`: Cary 60 (default) or a two-column file (wavelength, absorbance).
94
+ * `Already done by the instrument software`: tick only what the instrument software did before export (blank subtracted, inner filter corrected, Raman units). eemkit records these steps and does not repeat them; a file that says a step was done that is not ticked stops the loading, with the file header in the message.
95
+ * `Shimadzu excitation`: first excitation wavelength and step, which Shimadzu files do not contain (active only for Shimadzu).
96
+ * `Matrix layout`: which of the first row and first column holds the excitation wavelengths (active only for a text matrix).
97
+
98
+ Changing the instrument drops the data read so far: scan and load again.
99
+
89
100
  ### The buttons, in order
90
101
 
91
102
  | Button | What it does |
@@ -113,6 +124,8 @@ This page decides which files are read and how they are paired.
113
124
  * **Double-click** a cell to edit it. In the file columns (`eem_file`, `eem_blank_file`, `abs_file`, `abs_blank_file`) a list opens with the files of the right kind found by the scan.
114
125
  * The `Filter rows…` box filters on every column (for example `Merse_2024-07`). Clicking a column header sorts by that column.
115
126
  * Extra columns (river, campaign, site, replicate, notes…) become sample metadata: you find them again in the indices and in the groupings.
127
+ * Diluted samples: add the columns `dilution_factor` (EEM) and `abs_dilution_factor` (absorbance), final volume / sample volume, empty = undiluted. The corrections then report the undiluted sample; see [Diluted samples](corrections.md#diluted-samples).
128
+ * Regions to remove by hand (spikes, bad scans) are listed in the `[zap]` section of the project file; see [zap](corrections.md#removing-bad-data-by-hand-zap). The application does not edit them yet: it applies those in the file.
116
129
 
117
130
  ## 2 · Corrections
118
131
 
@@ -214,7 +227,7 @@ Settings on the left, four views of the results on the right. Work in two stages
214
227
  | Column | Meaning |
215
228
  | --- | --- |
216
229
  | `explained_pct` | Explained variance (%) of the scaled data. |
217
- | `core_consistency_pct` | CORCONDIA (Bro & Kiers 2003): close to 100 for an appropriate model, collapses with too many components. |
230
+ | `core_consistency_pct` | CORCONDIA (Bro & Kiers 2003), computed as the N-way toolbox and drEEM do: close to 100 for an appropriate model, drops with too many components. |
218
231
  | `sse_normalized` | Residual sum of squares. |
219
232
  | `n_iter`, `converged` | Iterations of the best fit and whether it reached the tolerance. |
220
233
  | `starts_at_best` | How many initialisations reached the same minimum: if few did, the solution is unstable. |
@@ -302,6 +315,7 @@ Compares campaigns, sites and rivers for any variable of the indices table or of
302
315
  | `parafac_3comp_openfluor.txt` | File for OpenFluor. Check it against the current upload template before submitting it. |
303
316
  | `parafac_3comp_model.nc` | The complete model. |
304
317
  | `figures/` | Number-of-components diagnostics, components and leverage, as PDF and PNG, in the colours chosen in `View` → `EEM colours`. |
318
+ | `report.html` | One page with the whole analysis: samples, every processing step, indices, the exploratory models, the final model with its validation, outlier diagnostics (residual EEMs of the worst-fitted samples, residuals by wavelength) and the settings. The figures are inside the page, so it can be e-mailed or archived as it is. |
305
319
 
306
320
  The `3` in the names is the number of components of the final model.
307
321
 
@@ -0,0 +1,82 @@
1
+ # Command line
2
+
3
+ The `eemkit` command runs a project without the application: the same
4
+ settings file, the same steps, the same results. It is the way to rerun an
5
+ analysis on a server, in a batch script, or months later.
6
+
7
+ ```bash
8
+ eemkit check project.toml
9
+ eemkit run project.toml
10
+ ```
11
+
12
+ If the `eemkit` command is not found (Python's `Scripts` folder is not on the
13
+ PATH), use `python -m eemkit` instead: `python -m eemkit run project.toml`.
14
+
15
+ ## `eemkit check`
16
+
17
+ Reads the project file and reports, without processing anything:
18
+
19
+ * how many rows the pairing table has and how many are included;
20
+ * every file of an included row that is missing (the first ten, then a count);
21
+ * settings that have no default and are not set, such as the cuvette path
22
+ lengths;
23
+ * the output folder, and whether the final PARAFAC model has been chosen.
24
+
25
+ It ends with `OK` (exit status 0) or the number of problems (exit status 1).
26
+
27
+ ## `eemkit run`
28
+
29
+ Runs the whole chain in the order of the application:
30
+
31
+ 1. reads the included samples;
32
+ 2. corrections up to Raman units, then scatter removal and crop;
33
+ 3. fluorescence indices and, when absorbance spectra are paired, CDOM metrics;
34
+ 4. the exploratory PARAFAC models for every rank in `parafac.ranks`, with
35
+ split-half validation (the table is printed);
36
+ 5. the final model, if `parafac.final.rank` is set;
37
+ 6. the export: corrected EEMs, indices, models, OpenFluor file, figures,
38
+ `report.html` (the whole analysis on one page), settings and processing
39
+ record.
40
+
41
+ | Option | Meaning |
42
+ | --- | --- |
43
+ | `-o`, `--output DIR` | Output folder; default `project.output_dir`. It may not be inside the data folder, which is read-only. |
44
+ | `-j`, `--jobs N` | PARAFAC random starts run at the same time; default every processor. The result does not depend on it. |
45
+ | `--no-explore` | Skip the exploratory models and fit only `parafac.final.rank`. |
46
+ | `--no-figures` | Do not write figures (they need matplotlib: `pip install "eemkit[plot]"`). |
47
+ | `--no-report` | Do not write `report.html` (it also needs matplotlib). |
48
+
49
+ Paths in the project file are relative to the folder that contains it.
50
+ Warnings are printed as they occur; an error stops the run with exit status 1
51
+ and a message that names the setting or the file.
52
+
53
+ Example on the Ombrone dataset (205 samples; abridged):
54
+
55
+ ```text
56
+ $ eemkit run config/ombrone_project.toml -o results
57
+ [ 0.0 s] reading the samples of the pairing table
58
+ [ 9.8 s] 205 samples
59
+ [ 9.8 s] corrections up to Raman units
60
+ [ 9.9 s] scatter removal and crop
61
+ [ 10.0 s] fluorescence indices
62
+ [ 10.1 s] CDOM metrics
63
+ warning: CDOM metrics: 40 sample(s) with values left empty (low signal); see the cdom_notes column
64
+ [ 10.1 s] exploratory PARAFAC models
65
+ [ 10.1 s] 2 components: fitting (1/12)
66
+ ...
67
+ explained_pct core_consistency_pct ... split_half_min_tcc split_half_validated
68
+ rank
69
+ 2 97.933 99.373 ... 0.989 True
70
+ 3 99.016 74.868 ... 0.992 True
71
+ 4 99.209 24.714 ... 0.175 False
72
+ ...
73
+ [1214.2 s] final 3-component model (1/2)
74
+ [1485.1 s] split-half validation (2/2)
75
+ [1705.4 s] explained 99.017 %, core consistency 75.0 %, 20/20 starts at the best minimum, split-half min TCC 0.9915 (validated)
76
+ [1705.6 s] writing results to results
77
+ [1708.0 s] done: 16 files
78
+ ```
79
+
80
+ The exploration of six ranks with split-half validation is the slow part
81
+ (about 20 minutes here); once the rank is chosen, `--no-explore` reruns only
82
+ the final model.