@@ -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 )} )."
0 commit comments