Skip to content

Commit c4a74bd

Browse files
committed
Fixed Pandas FutureWarning
1 parent 65b4b0c commit c4a74bd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/picor/isotope_correction.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ def correct_data(uncorrected_data, subset, res_corr_info):
118118
data[label2.as_string] = (
119119
data[label2.as_string] - trans_prob * data[label1.as_string]
120120
)
121-
data[label2.as_string].clip(lower=0, inplace=True)
121+
# Ensure no negative values after correction, but preserve dtype and avoid inplace modification issues
122+
data[label2.as_string] = data[label2.as_string].clip(lower=0)
122123
_logger.info(
123124
f"Transition prob {label1.as_string} -> {label2.as_string}: {trans_prob}"
124125
)
@@ -146,7 +147,8 @@ def calc_transition_prob(label1, label2, res_corr_info):
146147
return 0
147148
difference_labels = label2.subtract(label1)
148149
if res_corr_info.do_correction:
149-
trans_prob = rc.calc_indirect_overlap_prob(label1, label2, res_corr_info)
150+
trans_prob = rc.calc_indirect_overlap_prob(
151+
label1, label2, res_corr_info)
150152
else: # Without resolution correction
151153
trans_prob = ip.calc_label_diff_prob(label1, difference_labels)
152154
return trans_prob

0 commit comments

Comments
 (0)