eemkit 0.4.0__tar.gz → 0.4.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 (117) hide show
  1. {eemkit-0.4.0 → eemkit-0.4.2}/CHANGELOG.md +19 -0
  2. {eemkit-0.4.0 → eemkit-0.4.2}/CITATION.cff +2 -2
  3. {eemkit-0.4.0 → eemkit-0.4.2}/PKG-INFO +2 -2
  4. {eemkit-0.4.0 → eemkit-0.4.2}/README.md +1 -1
  5. eemkit-0.4.2/docs/img/app/0_readme_parafac_app.png +0 -0
  6. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/__init__.py +1 -1
  7. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/parafac_tab.py +97 -22
  8. {eemkit-0.4.0 → eemkit-0.4.2}/.gitignore +0 -0
  9. {eemkit-0.4.0 → eemkit-0.4.2}/LICENSE +0 -0
  10. {eemkit-0.4.0 → eemkit-0.4.2}/docs/absorbance.md +0 -0
  11. {eemkit-0.4.0 → eemkit-0.4.2}/docs/api.md +0 -0
  12. {eemkit-0.4.0 → eemkit-0.4.2}/docs/app-guide.md +0 -0
  13. {eemkit-0.4.0 → eemkit-0.4.2}/docs/campaigns.md +0 -0
  14. {eemkit-0.4.0 → eemkit-0.4.2}/docs/cli.md +0 -0
  15. {eemkit-0.4.0 → eemkit-0.4.2}/docs/corrections.md +0 -0
  16. {eemkit-0.4.0 → eemkit-0.4.2}/docs/data_model.md +0 -0
  17. {eemkit-0.4.0 → eemkit-0.4.2}/docs/gui.md +0 -0
  18. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/1_project.png +0 -0
  19. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/2_corrections.png +0 -0
  20. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/3_indices.png +0 -0
  21. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/4a_parafac_ranks.png +0 -0
  22. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/4b_parafac_outliers.png +0 -0
  23. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/4c_parafac_final.png +0 -0
  24. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/4d_parafac_by_model.png +0 -0
  25. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/5a_rivers_time.png +0 -0
  26. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/5b_rivers_composition.png +0 -0
  27. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/5c_rivers_tests.png +0 -0
  28. {eemkit-0.4.0 → eemkit-0.4.2}/docs/img/app/6_export.png +0 -0
  29. {eemkit-0.4.0 → eemkit-0.4.2}/docs/index.md +0 -0
  30. {eemkit-0.4.0 → eemkit-0.4.2}/docs/indices.md +0 -0
  31. {eemkit-0.4.0 → eemkit-0.4.2}/docs/instruments.md +0 -0
  32. {eemkit-0.4.0 → eemkit-0.4.2}/docs/parafac.md +0 -0
  33. {eemkit-0.4.0 → eemkit-0.4.2}/docs/plotting.md +0 -0
  34. {eemkit-0.4.0 → eemkit-0.4.2}/docs/quickstart.md +0 -0
  35. {eemkit-0.4.0 → eemkit-0.4.2}/pyproject.toml +0 -0
  36. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/__main__.py +0 -0
  37. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/absorbance.py +0 -0
  38. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/campaigns.py +0 -0
  39. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/cli.py +0 -0
  40. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/core/__init__.py +0 -0
  41. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/core/dataset.py +0 -0
  42. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/core/grid.py +0 -0
  43. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/core/history.py +0 -0
  44. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/__init__.py +0 -0
  45. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/_common.py +0 -0
  46. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/blank.py +0 -0
  47. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/crop.py +0 -0
  48. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/dilution.py +0 -0
  49. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/inner_filter.py +0 -0
  50. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/instrument.py +0 -0
  51. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/raman.py +0 -0
  52. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/scatter.py +0 -0
  53. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/spectral.py +0 -0
  54. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/corrections/zap.py +0 -0
  55. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/errors.py +0 -0
  56. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/__init__.py +0 -0
  57. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/__main__.py +0 -0
  58. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/campaigns_tab.py +0 -0
  59. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/common.py +0 -0
  60. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/corrections_tab.py +0 -0
  61. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/export_tab.py +0 -0
  62. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/indices_tab.py +0 -0
  63. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/main_window.py +0 -0
  64. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/project_tab.py +0 -0
  65. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/state.py +0 -0
  66. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/gui/theme.py +0 -0
  67. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/indices.py +0 -0
  68. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/io/__init__.py +0 -0
  69. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/io/_cary_csv.py +0 -0
  70. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/io/cary60.py +0 -0
  71. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/io/cary_eclipse.py +0 -0
  72. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/io/discover.py +0 -0
  73. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/io/instruments.py +0 -0
  74. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/io/loader.py +0 -0
  75. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/io/pairing.py +0 -0
  76. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/__init__.py +0 -0
  77. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/_cp.py +0 -0
  78. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/channels.py +0 -0
  79. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/compare.py +0 -0
  80. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/diagnostics.py +0 -0
  81. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/export.py +0 -0
  82. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/model.py +0 -0
  83. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/outliers.py +0 -0
  84. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/parafac/validation.py +0 -0
  85. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/pipeline.py +0 -0
  86. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/plot.py +0 -0
  87. {eemkit-0.4.0 → eemkit-0.4.2}/src/eemkit/report.py +0 -0
  88. {eemkit-0.4.0 → eemkit-0.4.2}/tests/conftest.py +0 -0
  89. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/README.md +0 -0
  90. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/aqualog/sample4.dat +0 -0
  91. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/eemR_DESCRIPTION.txt +0 -0
  92. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/fluoromax4/f1.dat +0 -0
  93. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/fluoromax4/f2.dat +0 -0
  94. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/fluoromax4/f3.dat +0 -0
  95. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/hitachi-f7000-fl/hitachi1.TXT +0 -0
  96. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/hitachi-f7000-fl/hitachi2.TXT +0 -0
  97. {eemkit-0.4.0 → eemkit-0.4.2}/tests/data/eemR/shimadzu/shimadzu.TXT +0 -0
  98. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_absorbance.py +0 -0
  99. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_campaigns.py +0 -0
  100. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_cary60.py +0 -0
  101. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_cary_eclipse.py +0 -0
  102. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_channels.py +0 -0
  103. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_cli.py +0 -0
  104. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_corrections.py +0 -0
  105. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_dataset.py +0 -0
  106. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_dilution_zap.py +0 -0
  107. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_grid.py +0 -0
  108. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_gui.py +0 -0
  109. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_indices.py +0 -0
  110. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_instruments.py +0 -0
  111. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_outliers_report.py +0 -0
  112. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_pairing.py +0 -0
  113. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_parafac.py +0 -0
  114. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_parafac_compare.py +0 -0
  115. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_pipeline.py +0 -0
  116. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_plot.py +0 -0
  117. {eemkit-0.4.0 → eemkit-0.4.2}/tests/test_real_data.py +0 -0
@@ -3,6 +3,25 @@
3
3
  All notable changes are listed here. Versions follow
4
4
  [semantic versioning](https://semver.org/).
5
5
 
6
+ ## 0.4.2 (2026-11-25)
7
+
8
+ One fix in the application. Results do not change.
9
+
10
+ * **Sensor channels view readable on small or scaled screens.** On a laptop
11
+ screen at 150 % scaling the channel table and the share table took all the
12
+ height and the figure was squeezed into a strip a few pixels high. The
13
+ figure now keeps a readable height (the view scrolls when the window is
14
+ too small), the two tables sit side by side, each only as tall as its rows,
15
+ and the message line takes no space when it is empty. With many components
16
+ or a narrow window the tables scroll sideways instead of cutting the numbers
17
+ (checked with 7 components and 4 channels).
18
+
19
+ ## 0.4.1 (2026-11-23)
20
+
21
+ Documentation only: the README figure now shows the PARAFAC model and the
22
+ weight of each component in the application (the PyPI page takes its text
23
+ and image from the README of the released version). No code changes.
24
+
6
25
  ## 0.4.0 (2026-11-23)
7
26
 
8
27
  Sensor channels (LED and filter) in the application, the figures and the
@@ -6,8 +6,8 @@ authors:
6
6
  - family-names: Cirrone
7
7
  given-names: Riccardo Gaetano
8
8
  affiliation: University of Siena
9
- version: 0.4.0
10
- date-released: "2026-11-23"
9
+ version: 0.4.2
10
+ date-released: "2026-11-25"
11
11
  doi: 10.5281/zenodo.23982732
12
12
  identifiers:
13
13
  - type: doi
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: eemkit
3
- Version: 0.4.0
3
+ Version: 0.4.2
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/
@@ -55,7 +55,7 @@ matrices (EEMs) of dissolved organic matter: instrument import, corrections,
55
55
  fluorescence indices and validated PARAFAC modelling, with every processing
56
56
  step recorded so that an analysis can be repeated exactly.
57
57
 
58
- ![The eemkit desktop application: corrections of a river-water EEM](https://raw.githubusercontent.com/LowCostSensor/eemkit/main/docs/img/app/2_corrections.png)
58
+ ![The eemkit application: the three PARAFAC components of the Ombrone 2024 data (EEMs and loadings) and the weight of each component by river and campaign](https://raw.githubusercontent.com/LowCostSensor/eemkit/main/docs/img/app/0_readme_parafac_app.png)
59
59
 
60
60
  ## What it does
61
61
 
@@ -11,7 +11,7 @@ matrices (EEMs) of dissolved organic matter: instrument import, corrections,
11
11
  fluorescence indices and validated PARAFAC modelling, with every processing
12
12
  step recorded so that an analysis can be repeated exactly.
13
13
 
14
- ![The eemkit desktop application: corrections of a river-water EEM](https://raw.githubusercontent.com/LowCostSensor/eemkit/main/docs/img/app/2_corrections.png)
14
+ ![The eemkit application: the three PARAFAC components of the Ombrone 2024 data (EEMs and loadings) and the weight of each component by river and campaign](https://raw.githubusercontent.com/LowCostSensor/eemkit/main/docs/img/app/0_readme_parafac_app.png)
15
15
 
16
16
  ## What it does
17
17
 
@@ -1,6 +1,6 @@
1
1
  """eemkit: EEM processing and PARAFAC modelling of dissolved organic matter fluorescence."""
2
2
 
3
- __version__ = "0.4.0"
3
+ __version__ = "0.4.2"
4
4
 
5
5
  from eemkit import corrections, indices, parafac, pipeline
6
6
  from eemkit.core.dataset import stack
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import pandas as pd
6
- from PySide6.QtCore import Qt
6
+ from PySide6.QtCore import Qt, QTimer
7
7
  from PySide6.QtWidgets import (
8
8
  QAbstractItemView,
9
9
  QComboBox,
@@ -49,6 +49,22 @@ def _float(edit: QLineEdit) -> float:
49
49
  return float(edit.text().strip().replace(",", "."))
50
50
 
51
51
 
52
+ #: smallest height of the Sensor channels figure (with its toolbar), in logical pixels
53
+ CH_PLOT_MIN_HEIGHT = 380
54
+
55
+
56
+ def _fit_rows(view, rows: int, lo: int = 1, hi: int = 6) -> None:
57
+ """Make a table exactly as tall as its header and ``rows`` rows (between lo and hi;
58
+ more rows scroll inside the table), so it does not take space from the figure."""
59
+ n = min(max(rows, lo), hi)
60
+ h = (view.horizontalHeader().sizeHint().height()
61
+ + n * view.verticalHeader().defaultSectionSize() + 2 * view.frameWidth() + 2)
62
+ # room for the sideways scroll bar when the columns are wider than the table
63
+ if view.horizontalHeader().length() + view.verticalHeader().width() > view.width():
64
+ h += view.horizontalScrollBar().sizeHint().height()
65
+ view.setFixedHeight(h)
66
+
67
+
52
68
  class ParafacTab(QWidget):
53
69
  def __init__(self, project: Project, tasks: TaskBar, parent=None):
54
70
  super().__init__(parent)
@@ -181,8 +197,10 @@ class ParafacTab(QWidget):
181
197
  self.ch_table = QTableWidget(0, 4)
182
198
  self.ch_table.setHorizontalHeaderLabels(
183
199
  ["Channel", "LED (nm)", "Filter from (nm)", "Filter to (nm)"])
184
- self.ch_table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
185
- self.ch_table.setMaximumHeight(150)
200
+ # every header readable; a narrow window scrolls the table sideways
201
+ hh = self.ch_table.horizontalHeader()
202
+ hh.setSectionResizeMode(QHeaderView.ResizeToContents)
203
+ hh.setStretchLastSection(True)
186
204
  self.ch_table.itemChanged.connect(self._channels_edited)
187
205
  b_add = QPushButton("Add channel")
188
206
  b_add.clicked.connect(self.add_channel)
@@ -192,27 +210,61 @@ class ParafacTab(QWidget):
192
210
  self.ch_model.currentIndexChanged.connect(self.draw_channels)
193
211
  self.ch_status = QLabel("")
194
212
  self.ch_status.setWordWrap(True)
213
+ self.ch_status.setVisible(False)
195
214
  self.ch_plot = PlotPanel()
215
+ # the figure keeps a readable height: on a small or scaled screen (a laptop at
216
+ # 150 %) the page scrolls instead of squeezing the plot into a strip
217
+ self.ch_plot.setMinimumHeight(CH_PLOT_MIN_HEIGHT)
196
218
  self.ch_shares_model = DataFrameModel()
197
- ch_shares = QTableView()
198
- ch_shares.setModel(self.ch_shares_model)
199
- ch_shares.setMaximumHeight(130)
200
- page_ch = QWidget()
201
- v = QVBoxLayout(page_ch)
219
+ self.ch_shares = QTableView()
220
+ self.ch_shares.setModel(self.ch_shares_model)
221
+ # every cell shown whole ("53 (49–60)"); with many components the table scrolls
222
+ # sideways instead of cutting the numbers
223
+ self.ch_shares.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
224
+ self.ch_shares.horizontalHeader().setStretchLastSection(True)
225
+ shares_label = QLabel("Share of each component in the channel signal, % (mean over "
226
+ "samples; in brackets the lowest and highest sample)")
227
+ shares_label.setWordWrap(True)
228
+ # channels (left) and their shares (right) side by side, each only as tall as its rows
229
+ left = QWidget()
230
+ lv = QVBoxLayout(left)
231
+ lv.setContentsMargins(0, 0, 0, 0)
232
+ lv.addWidget(self.ch_table)
233
+ lv.addWidget(pair(b_add, b_remove))
234
+ lv.addStretch(1)
235
+ right = QWidget()
236
+ rv = QVBoxLayout(right)
237
+ rv.setContentsMargins(0, 0, 0, 0)
238
+ rv.addWidget(shares_label)
239
+ rv.addWidget(self.ch_shares)
240
+ rv.addStretch(1)
241
+ tables = QSplitter()
242
+ tables.addWidget(left)
243
+ tables.addWidget(right)
244
+ tables.setChildrenCollapsible(False)
245
+ tables.setStretchFactor(0, 2)
246
+ tables.setStretchFactor(1, 3)
247
+ tables.splitterMoved.connect(lambda *_: self._fit_channel_tables())
248
+ content = QWidget()
249
+ v = QVBoxLayout(content)
202
250
  v.addWidget(note(
203
- "A sensor with an LED and an emission filter records one number per sample. The "
204
- "signal of a component in a channel is its score × its excitation loading at the "
205
- "LED wavelength × its emission loading integrated over the filter band. These "
206
- "numbers describe the model, not the sensor: lamp output, detector response and "
207
- "filter blocking outside the band are not included."))
251
+ "Signal of a component in an LED and filter channel = its score × its excitation "
252
+ "loading at the LED × its emission loading summed over the filter band. It "
253
+ "describes the model, not the sensor: lamp output, detector response and filter "
254
+ "leakage outside the band are left out."))
208
255
  v.addWidget(pair(QLabel("Model"), self.ch_model))
209
- v.addWidget(self.ch_table)
210
- v.addWidget(pair(b_add, b_remove))
256
+ v.addWidget(tables)
211
257
  v.addWidget(self.ch_status)
212
258
  v.addWidget(self.ch_plot, 1)
213
- v.addWidget(QLabel("Share of each component in the channel signal, % (mean over "
214
- "samples, with the range between samples)"))
215
- v.addWidget(ch_shares)
259
+ ch_scroll = QScrollArea()
260
+ ch_scroll.setWidgetResizable(True)
261
+ ch_scroll.setFrameShape(QScrollArea.NoFrame)
262
+ ch_scroll.setWidget(content)
263
+ page_ch = QWidget()
264
+ pv = QVBoxLayout(page_ch)
265
+ pv.setContentsMargins(0, 0, 0, 0)
266
+ pv.addWidget(ch_scroll)
267
+ self._fit_channel_tables()
216
268
 
217
269
  self.results = QTabWidget()
218
270
  self.results.addTab(page_summary, "Number of components")
@@ -264,6 +316,20 @@ class ParafacTab(QWidget):
264
316
 
265
317
  # sensor channels ---------------------------------------------------- #
266
318
 
319
+ def resizeEvent(self, event) -> None: # noqa: N802 (Qt API)
320
+ super().resizeEvent(event)
321
+ # the tables' widths settle after this event: refit their heights once they have
322
+ QTimer.singleShot(0, self._fit_channel_tables)
323
+
324
+ def _ch_say(self, text: str) -> None:
325
+ """A message under the channel table; hidden when empty, so it takes no space."""
326
+ self.ch_status.setText(text)
327
+ self.ch_status.setVisible(bool(text))
328
+
329
+ def _fit_channel_tables(self) -> None:
330
+ _fit_rows(self.ch_table, self.ch_table.rowCount(), lo=2)
331
+ _fit_rows(self.ch_shares, self.ch_shares_model.rowCount(), lo=2)
332
+
267
333
  def _fill_channels(self, channels: dict) -> None:
268
334
  self.ch_table.blockSignals(True)
269
335
  self.ch_table.setRowCount(0)
@@ -271,12 +337,14 @@ class ParafacTab(QWidget):
271
337
  self._append_row([str(name), f"{float(c['ex']):g}", f"{float(c['em'][0]):g}",
272
338
  f"{float(c['em'][1]):g}"])
273
339
  self.ch_table.blockSignals(False)
340
+ self._fit_channel_tables()
274
341
 
275
342
  def _append_row(self, cells: list[str]) -> None:
276
343
  r = self.ch_table.rowCount()
277
344
  self.ch_table.insertRow(r)
278
345
  for c, text in enumerate(cells):
279
346
  self.ch_table.setItem(r, c, QTableWidgetItem(text))
347
+ self._fit_channel_tables()
280
348
 
281
349
  def add_channel(self) -> None:
282
350
  """A new row with starting values to edit (a protein-like LED and filter)."""
@@ -296,6 +364,7 @@ class ParafacTab(QWidget):
296
364
  for r in rows:
297
365
  self.ch_table.removeRow(r)
298
366
  self.ch_table.blockSignals(False)
367
+ self._fit_channel_tables()
299
368
  self._channels_edited()
300
369
 
301
370
  def _read_channels(self) -> dict:
@@ -321,9 +390,9 @@ class ParafacTab(QWidget):
321
390
  channels = self._read_channels()
322
391
  pipeline.channel_specs({"channels": channels})
323
392
  except (ValueError, SettingsError) as exc:
324
- self.ch_status.setText(str(exc))
393
+ self._ch_say(str(exc))
325
394
  return
326
- self.ch_status.setText("")
395
+ self._ch_say("")
327
396
  self._editing_channels = True
328
397
  try:
329
398
  self.project.set_channels(channels)
@@ -350,6 +419,12 @@ class ParafacTab(QWidget):
350
419
  self.draw_channels()
351
420
 
352
421
  def draw_channels(self) -> None:
422
+ try:
423
+ self._draw_channels()
424
+ finally:
425
+ self._fit_channel_tables()
426
+
427
+ def _draw_channels(self) -> None:
353
428
  key = self.ch_model.currentData()
354
429
  channels = self.project.settings.get("channels") or {}
355
430
  if key is None:
@@ -364,11 +439,11 @@ class ParafacTab(QWidget):
364
439
  try:
365
440
  sig = pipeline.channel_signals(model, self.project.settings)
366
441
  except SettingsError as exc:
367
- self.ch_status.setText(str(exc))
442
+ self._ch_say(str(exc))
368
443
  self.ch_plot.clear("The channels do not fit the wavelength range of the model.")
369
444
  self.ch_shares_model.set_frame(pd.DataFrame())
370
445
  return
371
- self.ch_status.setText("")
446
+ self._ch_say("")
372
447
  self.ch_plot.show_figure(plot.channel_signals(sig, model, width=9.0,
373
448
  cmap=self.project.eem_colours))
374
449
  share = 100 * sig["share"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes