Skip to content

Commit

Permalink
cleaner warning message for missing analytes
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarbranson committed Jul 29, 2021
1 parent 72ef808 commit 9172019
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions latools/latools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ def srm_load_database(self, srms_used=None, reload=False):

# calculate ratios to internal_standard for calibration ratios
analyte_srm_link = {}
warns = []
warns = {}
self.uncalibrated = set()
self._analytes_missing_from_srm = set()

Expand Down Expand Up @@ -1424,7 +1424,9 @@ def srm_load_database(self, srms_used=None, reload=False):
if len(item) == 1:
ad[a] = item[0]
else:
warns.append(f' No {a} value for {srm}.')
if srm not in warns:
warns[srm] = []
warns[srm].append(a)
srm_nocal.update([ar])

analyte_srm_link[srm] = ad
Expand Down Expand Up @@ -1467,7 +1469,8 @@ def srm_load_database(self, srms_used=None, reload=False):
# Print any warnings
if len(warns) > 0:
print('WARNING: Some analytes are not present in the SRM database for some standards:')
print('\n'.join(warns))
for srm, a in warns.items():
print(f' {srm}: ' + ', '.join(self.analytes_sorted(a, focus_stage='bkgsub')))

if len(self.uncalibrated) > 0:
self.analyte_ratios.difference_update(self.uncalibrated)
Expand Down

0 comments on commit 9172019

Please sign in to comment.