Skip to content

Commit f9936a7

Browse files
rounding mz values to int to eliminate scan slope deviations
1 parent 76bd4e8 commit f9936a7

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

pydiaid/synchropasef/method_creator.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,15 @@ def calculate_scan_area(
373373

374374

375375
return df_scan_area
376+
377+
378+
def check_slope(params_list):
379+
"""Fix floating-point precision errors in parameter lists"""
380+
for i, params in enumerate(params_list):
381+
col0, col1, col2, col3, col4 = params
382+
slope = (col4 - col1) / (col3 - col0)
383+
print(slope)
384+
print(params)
376385

377386

378387
def generate_isolation_windows(
@@ -438,17 +447,19 @@ def generate_isolation_windows(
438447
"2"
439448
)
440449

450+
rounding_factor = 0
441451
list_method_parameters = list()
442452
for index in range(len(mz_start_lower_IM)):
443453
list_temp = [
444454
df_scan_area["lower_IM"].iloc[0],
445-
round(mz_start_lower_IM[index], 1),
446-
round(mz_start_lower_IM[index]+mz_width_lower_IM[index], 1),
455+
np.round(mz_start_lower_IM[index], rounding_factor),
456+
np.round(mz_start_lower_IM[index]+mz_width_lower_IM[index], rounding_factor),
447457
df_scan_area["upper_IM"].iloc[0],
448-
round(mz_start_upper_IM[index], 1)
458+
np.round(mz_start_upper_IM[index], rounding_factor)
449459
]
450460
list_method_parameters.append(list_temp)
451-
list_method_parameters
461+
462+
# check_slope(list_method_parameters)
452463

453464
df_method_parameters = pd.DataFrame(
454465
list_method_parameters,

0 commit comments

Comments
 (0)