celldetective 1.5.0b11__py3-none-any.whl → 1.5.0b12__py3-none-any.whl
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.
- celldetective/_version.py +1 -1
- celldetective/gui/tableUI.py +2 -3
- {celldetective-1.5.0b11.dist-info → celldetective-1.5.0b12.dist-info}/METADATA +1 -1
- {celldetective-1.5.0b11.dist-info → celldetective-1.5.0b12.dist-info}/RECORD +9 -8
- tests/gui/test_tableui_track_collapse.py +239 -0
- {celldetective-1.5.0b11.dist-info → celldetective-1.5.0b12.dist-info}/WHEEL +0 -0
- {celldetective-1.5.0b11.dist-info → celldetective-1.5.0b12.dist-info}/entry_points.txt +0 -0
- {celldetective-1.5.0b11.dist-info → celldetective-1.5.0b12.dist-info}/licenses/LICENSE +0 -0
- {celldetective-1.5.0b11.dist-info → celldetective-1.5.0b12.dist-info}/top_level.txt +0 -0
celldetective/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.5.
|
|
1
|
+
__version__ = "1.5.0b12"
|
celldetective/gui/tableUI.py
CHANGED
|
@@ -1347,10 +1347,9 @@ class TableUI(CelldetectiveMainWindow):
|
|
|
1347
1347
|
if self.projection_option.isChecked():
|
|
1348
1348
|
|
|
1349
1349
|
self.projection_mode = self.projection_op_cb.currentText()
|
|
1350
|
-
|
|
1350
|
+
group_table = getattr(
|
|
1351
1351
|
self.current_data.groupby(self.groupby_cols), self.projection_mode
|
|
1352
|
-
)
|
|
1353
|
-
group_table = op(self.current_data.groupby(self.groupby_cols))
|
|
1352
|
+
)(numeric_only=True)
|
|
1354
1353
|
|
|
1355
1354
|
for c in self.static_columns:
|
|
1356
1355
|
try:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
celldetective/__init__.py,sha256=LfnOyfUnYPGDc8xcsF_PfYEL7-CqAb7BMBPBIWGv84o,666
|
|
2
2
|
celldetective/__main__.py,sha256=Rzzu9ArxZSgfBVjV-lyn-3oanQB2MumQR6itK5ZaRpA,2597
|
|
3
|
-
celldetective/_version.py,sha256=
|
|
3
|
+
celldetective/_version.py,sha256=qIUsLw55S96fJBnnxozjZGAVdxWEUHBpoXhNTU6Jdh0,25
|
|
4
4
|
celldetective/event_detection_models.py,sha256=A7ZJFhJwfdhzfxJ-YZIj6IoI9Gc1hyAodFkKt8kNxDk,93549
|
|
5
5
|
celldetective/events.py,sha256=n15R53c7QZ2wT8gjb0oeNikQbuRBrVVbyNsRCqXjzXA,8166
|
|
6
6
|
celldetective/exceptions.py,sha256=f3VmIYOthWTiqMEV5xQCox2rw5c5e7yog88h-CcV4oI,356
|
|
@@ -39,7 +39,7 @@ celldetective/gui/preprocessing_block.py,sha256=cgUBv-eQBwfidK48-cTWJi0PS62wlXhs
|
|
|
39
39
|
celldetective/gui/process_block.py,sha256=KVfXnC55EYGlgKVDXDSMGu_MZbxjbQaQz4Ulyl5iqSE,76881
|
|
40
40
|
celldetective/gui/seg_model_loader.py,sha256=CqcyT1ZeQ27R54RmOHjAt1pfRwjtvS-Psw29PpFsT5A,23549
|
|
41
41
|
celldetective/gui/survival_ui.py,sha256=YBtbkjXgJW4KLpRaFysJc_po4OjVcLyCmGSWKtMbjdk,17353
|
|
42
|
-
celldetective/gui/tableUI.py,sha256=
|
|
42
|
+
celldetective/gui/tableUI.py,sha256=Bx0EZyZU8k3-9yuWl4hHepVpgtgbMk023J1XZVmQ0T4,58942
|
|
43
43
|
celldetective/gui/thresholds_gui.py,sha256=KxPmCmoMGGwwHFwPWHCOr1wPTyOPR2d-zucuAvZfSqk,34783
|
|
44
44
|
celldetective/gui/workers.py,sha256=WAtVxFEvHApBSAZMVyYsya_DHL_bYo8b57dbgUJQHc4,14890
|
|
45
45
|
celldetective/gui/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -167,7 +167,7 @@ celldetective/utils/event_detection/__init__.py,sha256=GvsdyQLMTXJj1S_FfRXjrpOxE
|
|
|
167
167
|
celldetective/utils/plots/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
168
168
|
celldetective/utils/plots/regression.py,sha256=oUCn29-hp7PxMqC-R0yoL60KMw5ZWpZAIoCDh2ErlcY,1764
|
|
169
169
|
celldetective/utils/stardist_utils/__init__.py,sha256=SY2kxFNXSRjXN4ncs3heDdXT3UNk8M3dELJQySysAf4,4231
|
|
170
|
-
celldetective-1.5.
|
|
170
|
+
celldetective-1.5.0b12.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
171
171
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
172
172
|
tests/test_cellpose_fallback.py,sha256=BJZTDFF8sFR1x7rDbvZQ2RQOB1OP6wuFBRfc8zbl5zw,3513
|
|
173
173
|
tests/test_contour_format.py,sha256=N11Rue_mxxwsZBhocRA621bpt4Cps-1DnPGzhKLSq9o,10873
|
|
@@ -190,8 +190,9 @@ tests/gui/test_measure_annotator_bugfix.py,sha256=tPfgWNKC0UkvrVssSrUcVDC1qgpzx6
|
|
|
190
190
|
tests/gui/test_new_project.py,sha256=wRjW2vEaZb0LWT-f8G8-Ptk8CW9z8-FDPLpV5uqj6ck,8778
|
|
191
191
|
tests/gui/test_project.py,sha256=KzAnodIc0Ovta0ARL5Kr5PkOR5euA6qczT_GhEZpyE4,4710
|
|
192
192
|
tests/gui/test_spot_detection_viewer.py,sha256=mCEsfTAJb5W5IeLyQmaZXq9Sjr8ehCI552RkiCEQvLw,13355
|
|
193
|
-
|
|
194
|
-
celldetective-1.5.
|
|
195
|
-
celldetective-1.5.
|
|
196
|
-
celldetective-1.5.
|
|
197
|
-
celldetective-1.5.
|
|
193
|
+
tests/gui/test_tableui_track_collapse.py,sha256=SA2Ot3wcW64nziK260QaaXY22_VEbJFbUfBVDNte7Us,6831
|
|
194
|
+
celldetective-1.5.0b12.dist-info/METADATA,sha256=qa3l5N4UgS1dt9Nlhs8PxMmxHDBk-K1yzlBRtCsRHXs,11524
|
|
195
|
+
celldetective-1.5.0b12.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
196
|
+
celldetective-1.5.0b12.dist-info/entry_points.txt,sha256=2NU6_EOByvPxqBbCvjwxlVlvnQreqZ3BKRCVIKEv3dg,62
|
|
197
|
+
celldetective-1.5.0b12.dist-info/top_level.txt,sha256=6rsIKKfGMKgud7HPuATcpq6EhdXwcg_yknBVWn9x4C4,20
|
|
198
|
+
celldetective-1.5.0b12.dist-info/RECORD,,
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Regression test for TableUI track collapse functionality.
|
|
3
|
+
Tests the fix for ValueError: numeric_only accepts only Boolean values
|
|
4
|
+
when using groupby aggregation methods (mean, sum, etc.) in set_proj_mode.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
import pandas as pd
|
|
9
|
+
import numpy as np
|
|
10
|
+
import logging
|
|
11
|
+
from PyQt5 import QtCore
|
|
12
|
+
|
|
13
|
+
from celldetective.gui.tableUI import TableUI
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.fixture(autouse=True)
|
|
17
|
+
def disable_logging():
|
|
18
|
+
"""Disable all logging to avoid Windows OSError with pytest capture."""
|
|
19
|
+
logger = logging.getLogger()
|
|
20
|
+
try:
|
|
21
|
+
logging.disable(logging.CRITICAL)
|
|
22
|
+
yield
|
|
23
|
+
finally:
|
|
24
|
+
logging.disable(logging.NOTSET)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.fixture
|
|
28
|
+
def sample_track_data():
|
|
29
|
+
"""Create sample DataFrame with track data for testing."""
|
|
30
|
+
return pd.DataFrame(
|
|
31
|
+
{
|
|
32
|
+
"position": ["pos1"] * 6 + ["pos2"] * 6,
|
|
33
|
+
"TRACK_ID": [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4],
|
|
34
|
+
"FRAME": [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2],
|
|
35
|
+
"POSITION_X": [
|
|
36
|
+
10.0,
|
|
37
|
+
12.0,
|
|
38
|
+
14.0,
|
|
39
|
+
20.0,
|
|
40
|
+
22.0,
|
|
41
|
+
24.0,
|
|
42
|
+
30.0,
|
|
43
|
+
32.0,
|
|
44
|
+
34.0,
|
|
45
|
+
40.0,
|
|
46
|
+
42.0,
|
|
47
|
+
44.0,
|
|
48
|
+
],
|
|
49
|
+
"POSITION_Y": [
|
|
50
|
+
10.0,
|
|
51
|
+
12.0,
|
|
52
|
+
14.0,
|
|
53
|
+
20.0,
|
|
54
|
+
22.0,
|
|
55
|
+
24.0,
|
|
56
|
+
30.0,
|
|
57
|
+
32.0,
|
|
58
|
+
34.0,
|
|
59
|
+
40.0,
|
|
60
|
+
42.0,
|
|
61
|
+
44.0,
|
|
62
|
+
],
|
|
63
|
+
"area": [
|
|
64
|
+
100.0,
|
|
65
|
+
110.0,
|
|
66
|
+
120.0,
|
|
67
|
+
200.0,
|
|
68
|
+
210.0,
|
|
69
|
+
220.0,
|
|
70
|
+
300.0,
|
|
71
|
+
310.0,
|
|
72
|
+
320.0,
|
|
73
|
+
400.0,
|
|
74
|
+
410.0,
|
|
75
|
+
420.0,
|
|
76
|
+
],
|
|
77
|
+
"intensity": [
|
|
78
|
+
50.0,
|
|
79
|
+
55.0,
|
|
80
|
+
60.0,
|
|
81
|
+
70.0,
|
|
82
|
+
75.0,
|
|
83
|
+
80.0,
|
|
84
|
+
90.0,
|
|
85
|
+
95.0,
|
|
86
|
+
100.0,
|
|
87
|
+
110.0,
|
|
88
|
+
115.0,
|
|
89
|
+
120.0,
|
|
90
|
+
],
|
|
91
|
+
# Non-numeric columns to ensure numeric_only=True works
|
|
92
|
+
"well_name": ["W1"] * 12,
|
|
93
|
+
"pos_name": ["100"] * 6 + ["200"] * 6,
|
|
94
|
+
"status": [0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1],
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_tableui_track_collapse_mean(qtbot, sample_track_data):
|
|
100
|
+
"""
|
|
101
|
+
Test that collapsing tracks with 'mean' operation works without ValueError.
|
|
102
|
+
This is a regression test for the fix: numeric_only=True in groupby aggregation.
|
|
103
|
+
"""
|
|
104
|
+
table_ui = TableUI(
|
|
105
|
+
data=sample_track_data,
|
|
106
|
+
title="Test Table",
|
|
107
|
+
population="targets",
|
|
108
|
+
plot_mode="plot_track_signals",
|
|
109
|
+
collapse_tracks_option=True,
|
|
110
|
+
)
|
|
111
|
+
qtbot.addWidget(table_ui)
|
|
112
|
+
table_ui.show()
|
|
113
|
+
qtbot.wait(100)
|
|
114
|
+
|
|
115
|
+
# Open the projection mode dialog
|
|
116
|
+
table_ui.set_projection_mode_tracks()
|
|
117
|
+
qtbot.wait(100)
|
|
118
|
+
|
|
119
|
+
# Set up projection parameters - mean is the default
|
|
120
|
+
assert table_ui.projection_option.isChecked()
|
|
121
|
+
table_ui.projection_op_cb.setCurrentText("mean")
|
|
122
|
+
table_ui.current_data = sample_track_data
|
|
123
|
+
|
|
124
|
+
# Execute the collapse - this should NOT raise ValueError
|
|
125
|
+
try:
|
|
126
|
+
table_ui.set_proj_mode()
|
|
127
|
+
qtbot.wait(100)
|
|
128
|
+
except ValueError as e:
|
|
129
|
+
if "numeric_only" in str(e):
|
|
130
|
+
pytest.fail(f"Regression: numeric_only ValueError occurred: {e}")
|
|
131
|
+
raise
|
|
132
|
+
|
|
133
|
+
# Verify subtable was created
|
|
134
|
+
assert hasattr(table_ui, "subtable")
|
|
135
|
+
assert table_ui.subtable is not None
|
|
136
|
+
|
|
137
|
+
# Cleanup
|
|
138
|
+
table_ui.subtable.close()
|
|
139
|
+
table_ui.close()
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def test_tableui_track_collapse_all_operations(qtbot, sample_track_data):
|
|
143
|
+
"""
|
|
144
|
+
Test that all aggregation operations work in track collapse without ValueError.
|
|
145
|
+
Operations tested: mean, median, min, max, first, last, prod, sum
|
|
146
|
+
"""
|
|
147
|
+
operations = ["mean", "median", "min", "max", "first", "last", "prod", "sum"]
|
|
148
|
+
|
|
149
|
+
for op in operations:
|
|
150
|
+
table_ui = TableUI(
|
|
151
|
+
data=sample_track_data.copy(),
|
|
152
|
+
title=f"Test Table - {op}",
|
|
153
|
+
population="targets",
|
|
154
|
+
plot_mode="plot_track_signals",
|
|
155
|
+
collapse_tracks_option=True,
|
|
156
|
+
)
|
|
157
|
+
qtbot.addWidget(table_ui)
|
|
158
|
+
table_ui.show()
|
|
159
|
+
qtbot.wait(50)
|
|
160
|
+
|
|
161
|
+
# Open the projection mode dialog
|
|
162
|
+
table_ui.set_projection_mode_tracks()
|
|
163
|
+
qtbot.wait(50)
|
|
164
|
+
|
|
165
|
+
# Configure for the current operation
|
|
166
|
+
table_ui.projection_option.setChecked(True)
|
|
167
|
+
table_ui.projection_op_cb.setCurrentText(op)
|
|
168
|
+
table_ui.current_data = sample_track_data.copy()
|
|
169
|
+
|
|
170
|
+
# Execute the collapse
|
|
171
|
+
try:
|
|
172
|
+
table_ui.set_proj_mode()
|
|
173
|
+
qtbot.wait(50)
|
|
174
|
+
except ValueError as e:
|
|
175
|
+
if "numeric_only" in str(e):
|
|
176
|
+
pytest.fail(
|
|
177
|
+
f"Regression: numeric_only ValueError occurred for '{op}': {e}"
|
|
178
|
+
)
|
|
179
|
+
raise
|
|
180
|
+
|
|
181
|
+
# Verify subtable was created
|
|
182
|
+
assert hasattr(table_ui, "subtable"), f"subtable not created for '{op}'"
|
|
183
|
+
assert table_ui.subtable is not None, f"subtable is None for '{op}'"
|
|
184
|
+
|
|
185
|
+
# Cleanup
|
|
186
|
+
table_ui.subtable.close()
|
|
187
|
+
table_ui.close()
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def test_tableui_track_collapse_with_mixed_dtypes(qtbot):
|
|
191
|
+
"""
|
|
192
|
+
Test track collapse with a DataFrame containing mixed data types.
|
|
193
|
+
Ensures numeric_only=True properly handles non-numeric columns.
|
|
194
|
+
"""
|
|
195
|
+
mixed_data = pd.DataFrame(
|
|
196
|
+
{
|
|
197
|
+
"position": ["pos1"] * 4,
|
|
198
|
+
"TRACK_ID": [1, 1, 2, 2],
|
|
199
|
+
"FRAME": [0, 1, 0, 1],
|
|
200
|
+
"numeric_col": [1.5, 2.5, 3.5, 4.5],
|
|
201
|
+
"string_col": ["a", "b", "c", "d"],
|
|
202
|
+
"bool_col": [True, False, True, False],
|
|
203
|
+
"category_col": pd.Categorical(["cat1", "cat1", "cat2", "cat2"]),
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
table_ui = TableUI(
|
|
208
|
+
data=mixed_data,
|
|
209
|
+
title="Mixed Types Table",
|
|
210
|
+
population="targets",
|
|
211
|
+
plot_mode="plot_track_signals",
|
|
212
|
+
collapse_tracks_option=True,
|
|
213
|
+
)
|
|
214
|
+
qtbot.addWidget(table_ui)
|
|
215
|
+
table_ui.show()
|
|
216
|
+
qtbot.wait(100)
|
|
217
|
+
|
|
218
|
+
# Open the projection mode dialog
|
|
219
|
+
table_ui.set_projection_mode_tracks()
|
|
220
|
+
qtbot.wait(100)
|
|
221
|
+
|
|
222
|
+
table_ui.projection_option.setChecked(True)
|
|
223
|
+
table_ui.projection_op_cb.setCurrentText("mean")
|
|
224
|
+
table_ui.current_data = mixed_data
|
|
225
|
+
|
|
226
|
+
# This should not raise ValueError about numeric_only
|
|
227
|
+
try:
|
|
228
|
+
table_ui.set_proj_mode()
|
|
229
|
+
qtbot.wait(100)
|
|
230
|
+
except ValueError as e:
|
|
231
|
+
if "numeric_only" in str(e):
|
|
232
|
+
pytest.fail(f"Regression: numeric_only ValueError with mixed types: {e}")
|
|
233
|
+
raise
|
|
234
|
+
|
|
235
|
+
assert hasattr(table_ui, "subtable")
|
|
236
|
+
|
|
237
|
+
# Cleanup
|
|
238
|
+
table_ui.subtable.close()
|
|
239
|
+
table_ui.close()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|