blank = (session.query(GcRun).join(Integration, Integration.run_id == GcRun.id) .filter(GcRun.date > day, GcRun.date < day_end) .filter(Integration.filename.like('%Blank2500.D')) .order_by(GcRun.date) .one_or_none()) if not sample or not quantifier or not blank: print(f'Sample, standard or blank not found for {day}.') continue quant = SampleQuant(sample, quantifier, blank, standard_to_quantify_with) quant.quantify() quant_runs.append(quant) compile_quant_report(quant_runs, 'SX3555', 'CC416168', certified_values_of_sample, date=datetime(2019, 7, 6)) # report for SX3555 Qx CC416168 finished, values to be re-assigned for vice versa standard_to_quantify_with = session.query(Standard).filter(Standard.name == 'sx3555').one_or_none() # get standard cert values for the quantifier certified_values_of_sample = session.query(Standard).filter(Standard.name == 'cc416168').one().quantifications # get standard cert values for the sample being quantified quant_runs = [] # re-assign to quantify the other way around (CC4416168 Qx SX3555) for day in days_with_standards: day_end = day + dt.timedelta(days=1) sample = (session.query(GcRun).join(Integration, Integration.run_id == GcRun.id) .filter(GcRun.date > day, GcRun.date < day_end) .filter(Integration.filename.like('%CC416168.D')) .order_by(GcRun.date)
sx3555_certification = session.query(Standard).filter(Standard.name == 'sx3555').one() # quantify all compounds in SX3555 with CC416168 all_in_sx3555 = [] for cc416168, sx3555, blank_2500 in zip(cc416168_set, sx3555_set, blank_2500_set): cc416168 = blank_subtract(cc416168, vocs, session, blank=blank_2500) sx3555 = blank_subtract(sx3555, vocs, session, blank=blank_2500) # CC416168 defaults to using the same blank as the sample -- OK here all_quant = SampleQuant(sx3555, cc416168, blank_2500, cc416168_certification) all_quant.quantify() all_in_sx3555.append(all_quant) compile_quant_report(all_in_sx3555, 'SX3555', 'CC416168', sx3555_certification.quantifications, date=datetime(2019, 3, 20)) # quantify all compounds in CC416168 with SX3555 all_in_cc416168 = [] for cc416168, sx3555, blank_2500 in zip(cc416168_set, sx3555_set, blank_2500_set): cc416168 = blank_subtract(cc416168, vocs, session, blank=blank_2500) sx3555 = blank_subtract(sx3555, vocs, session, blank=blank_2500) # SX3555 defaults to using the same blank as the sample -- OK here all_quant = SampleQuant(cc416168, sx3555, blank_2500, sx3555_certification) all_quant.quantify() all_in_cc416168.append(all_quant)
GcRun.date > day, GcRun.date < day_end).filter( Integration.filename.like('%Blank2500.D')).order_by( GcRun.date).one_or_none()) if not sample or not quantifier or not blank: print(f'Sample, standard or blank not found for {day}.') continue quant = SampleQuant(sample, quantifier, blank, standard_to_quantify_with) quant.quantify() quant_runs.append(quant) compile_quant_report(quant_runs, 'CC416168', 'CC464566', certified_values_of_sample, date=datetime(2019, 11, 5)) # report for SX3555 Qx CC416168 finished, values to be re-assigned for vice versa standard_to_quantify_with = session.query(Standard).filter( Standard.name == 'cc416168').one_or_none() # get standard cert values for the quantifier certified_values_of_sample = session.query(Standard).filter( Standard.name == 'cc464566').one().quantifications # get standard cert values for the sample being quantified quant_runs = [ ] # re-assign to quantify the other way around (CC4416168 Qx SX3555) for day in days_with_standards: day_end = day + dt.timedelta(days=1)
cc464566_certification = session.query(Standard).filter( Standard.name == 'cc464566').one() sx3555_certification = session.query(Standard).filter( Standard.name == 'sx3555').one() # quantify VOCs in SX3555 with CC464566 vocs_in_sx3555 = [] for blank_2500, cc464566, sx3555 in zip(blank_2500_set, cc464566_set, sx3555_set): cc464566 = blank_subtract(cc464566, vocs, session, blank=blank_1250) sx3555 = blank_subtract(sx3555, vocs, session, blank=blank_2500) # VOC standard CC464566 is 1000s sample, needs 1000s blank voc_quant = SampleQuant(sx3555, cc464566, blank_2500, cc464566_certification, standard_blank=blank_1250) voc_quant.quantify() vocs_in_sx3555.append(voc_quant) compile_quant_report(vocs_in_sx3555, 'SX3555', 'CC464566', sx3555_certification.quantifications, date=datetime(2019, 3, 19))
cc464566 = blank_subtract(cc464566, vocs, session, blank=blank_1000) sx3556 = blank_subtract(sx3556, vocs, session, blank=blank_2500) # VOC standard CC464566 is 1000s sample, needs 1000s blank voc_quant = SampleQuant(sx3556, cc464566, blank_2500, cc464566_certification, standard_blank=blank_1000) voc_quant.quantify() vocs_in_sx3556.append(voc_quant) compile_quant_report(vocs_in_sx3556, 'SX3556', 'CC464566', sx3556_certification.quantifications, date=datetime(2018, 5, 16)) for cc416168, sx3556 in zip(cc416168_set, sx3556_set): cc416168 = blank_subtract(cc416168, vocs, session, blank=blank_2500) sx3556 = blank_subtract(sx3556, vocs, session, blank=blank_2500) # CC416168 defaults to using the same blank as the sample -- OK here all_quant = SampleQuant(sx3556, cc416168, blank_2500, cc416168_certification) all_quant.quantify() all_in_sx3556.append(all_quant) compile_quant_report(all_in_sx3556,
certified_values_of_sample = (session.query(Standard) .filter(Standard.name == 'cc412022_noaa_provided') .one().quantifications) # get standard cert values for the sample being quantified vocs = session.query(Standard).filter(Standard.name == 'vocs').one_or_none() vocs = [q.name for q in vocs.quantifications] samples = (session.query(GcRun).join(Integration, Integration.run_id == GcRun.id) .filter(GcRun.date > datetime(2019, 11, 12), GcRun.date < datetime(2019, 11, 13)) .filter(Integration.filename.like('%CC412022___.D')) .order_by(GcRun.date) .all()) standards = (session.query(GcRun).join(Integration, Integration.run_id == GcRun.id) .filter(GcRun.date > datetime(2019, 11, 12), GcRun.date < datetime(2019, 11, 13)) .filter(Integration.filename.like('%CC416168___.D')) .order_by(GcRun.date) .all()) quants = [] for sample, standard in zip(samples, standards): blank_subtract(sample, vocs, session, blank=None, force_no_blank=True) blank_subtract(standard, vocs, session, blank=None, force_no_blank=True) quant = SampleQuant(sample, standard, None, standard_to_quantify_with) quant.quantify() quants.append(quant) compile_quant_report(quants, 'CC412022', 'CC416168', certified_values_of_sample, date=datetime(2019, 11, 12))
if not sample or not quantifier or not blank: print(f'Sample, standard or blank not found for {day}.') continue sample = blank_subtract(sample, vocs, session, blank) quantifier = blank_subtract(quantifier, vocs, session, blank) quant = SampleQuant(sample, quantifier, blank, standard_to_quantify_with) quant.quantify() quant_runs.append(quant) compile_quant_report(quant_runs, 'CC412022', 'SX3555', certified_values_of_sample, date=datetime(2019, 12, 20)) # report for CC412022 Qx SX3555 finished, values to be re-assigned for vice versa standard_to_quantify_with = session.query(Standard).filter( Standard.name == 'cc412022_noaa_provided').one_or_none() # get standard cert values for the quantifier certified_values_of_sample = session.query(Standard).filter( Standard.name == 'sx3555').one().quantifications # get standard cert values for the sample being quantified quant_runs = [ ] # re-assign to quantify the other way around (SX3555 Qx CC412022) for day in days_with_standards: day_end = day + dt.timedelta(days=1)
.order_by(GcRun.date) .one_or_none()) if not sample or not quantifier or not blank: print(f'Sample, standard or blank not found for {day}.') continue sample = blank_subtract(sample, vocs, session, blank) quantifier = blank_subtract(quantifier, vocs, session, blank) quant = SampleQuant(sample, quantifier, blank, standard_to_quantify_with) quant.quantify() quant_runs.append(quant) compile_quant_report(quant_runs, 'CC412022', 'CC464566', certified_values_of_sample, date=datetime(2019, 12, 1)) # report for CC412022 Qx CC416168 finished, values to be re-assigned for vice versa standard_to_quantify_with = session.query(Standard).filter(Standard.name == 'cc412022_noaa_provided').one_or_none() # get standard cert values for the quantifier certified_values_of_sample = session.query(Standard).filter(Standard.name == 'cc464566').one().quantifications # get standard cert values for the sample being quantified quant_runs = [] # re-assign to quantify the other way around (CC464566 Qx CC412022) for day in days_with_standards: day_end = day + dt.timedelta(days=1) sample = (session.query(GcRun).join(Integration, Integration.run_id == GcRun.id) .filter(GcRun.date > day, GcRun.date < day_end) .filter(Integration.filename.like('%CC464566.D')) .order_by(GcRun.date)