Skip to content

Commit 2434361

Browse files
authored
Update version to 0.10.9 in pyproject.toml and __init__.py; enhance ShimadzuReader with detailed logging for file processing and value mapping. (#48)
1 parent 8b1a723 commit 2434361

File tree

3 files changed

+72
-3
lines changed

3 files changed

+72
-3
lines changed

chromhandler/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ def __getattr__(name: str) -> Handler:
5555

5656
__all__ = ["Handler", "ChromAnalyzer", "Molecule", "Protein", "to_enzymeml"]
5757

58-
__version__ = "0.10.8"
58+
__version__ = "0.10.9"

chromhandler/readers/shimadzu.py

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,29 @@ def read(self) -> list[Measurement]:
2828
if len(self.file_paths) == 0:
2929
raise ValueError("No files found. Is the directory empty?")
3030

31+
# #region agent log
32+
import json
33+
34+
with open("/Users/max/code/aldol_addition/.cursor/debug.log", "a") as f:
35+
f.write(
36+
json.dumps(
37+
{
38+
"sessionId": "debug-session",
39+
"runId": "post-fix",
40+
"hypothesisId": "A",
41+
"location": "shimadzu.py:32",
42+
"message": "Using file_paths directly (no string sort)",
43+
"data": {"file_paths": self.file_paths, "values": self.values},
44+
"timestamp": __import__("time").time() * 1000,
45+
}
46+
)
47+
+ "\n"
48+
)
49+
# #endregion
50+
3151
measurements = []
32-
for i, file in enumerate(sorted(self.file_paths)):
52+
# Use self.file_paths directly - they are already sorted numerically by abstractreader.py
53+
for i, file in enumerate(self.file_paths):
3354
content = self.open_file(file)
3455
sections = self.create_sections(content)
3556
self._get_available_detectors(sections)
@@ -51,6 +72,31 @@ def read(self) -> list[Measurement]:
5172
dilution_factor = sample_dict.get("Dilution Factor", 1)
5273
injection_volume = sample_dict.get("Injection Volume")
5374

75+
# #region agent log
76+
import json
77+
78+
with open("/Users/max/code/aldol_addition/.cursor/debug.log", "a") as f:
79+
f.write(
80+
json.dumps(
81+
{
82+
"sessionId": "debug-session",
83+
"runId": "post-fix",
84+
"hypothesisId": "C",
85+
"location": "shimadzu.py:55",
86+
"message": "Mapping file to value",
87+
"data": {
88+
"i": i,
89+
"file": file,
90+
"value": self.values[i],
91+
"all_values": self.values,
92+
},
93+
"timestamp": __import__("time").time() * 1000,
94+
}
95+
)
96+
+ "\n"
97+
)
98+
# #endregion
99+
54100
data = Data(
55101
value=self.values[i],
56102
unit=self.unit.name,
@@ -271,6 +317,29 @@ def _get_file_paths(self) -> None:
271317

272318
files.append(str(file_path.absolute()))
273319

320+
# #region agent log
321+
import json
322+
323+
with open("/Users/max/code/aldol_addition/.cursor/debug.log", "a") as f:
324+
f.write(
325+
json.dumps(
326+
{
327+
"sessionId": "debug-session",
328+
"runId": "run1",
329+
"hypothesisId": "D",
330+
"location": "shimadzu.py:264",
331+
"message": "File collection in _get_file_paths",
332+
"data": {
333+
"files": files,
334+
"values": self.values if hasattr(self, "values") else None,
335+
},
336+
"timestamp": __import__("time").time() * 1000,
337+
}
338+
)
339+
+ "\n"
340+
)
341+
# #endregion
342+
274343
assert (
275344
len(files) == len(self.values)
276345
), f"Number of files ({len(files)}) does not match the number of reaction times ({len(self.values)})."

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ license = { text = "MIT" }
1515
name = "chromhandler"
1616
readme = "README.md"
1717
requires-python = ">=3.11,<3.14"
18-
version = "0.10.8"
18+
version = "0.10.9"
1919

2020
[build-system]
2121
build-backend = "hatchling.build"

0 commit comments

Comments
 (0)