.filter(Integration.filename.like('%SX3555%.D')) .order_by(Integration.date) .all()) vocs = session.query(Standard).filter(Standard.name == 'vocs').one() vocs = [q.name for q in vocs.quantifications] cc416168_certification = session.query(Standard).filter(Standard.name == 'cc416168').one() 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 = []
blank_run = (session.query(GcRun).join( Integration, Integration.run_id == GcRun.id).filter( GcRun.date > datetime(2019, 11, 12, 3), GcRun.date < datetime(2019, 11, 12, 6)).filter( Integration.filename.like('%Blank2500.D')).one_or_none()) assert len(standard_runs) == len( ambient_runs), "Unequal number of standard and ambient runs found!" ambients = [] standards = [] # last_standard = None for ambient_run, standard_run in zip(ambient_runs, standard_runs): blank_subtract(ambient_run, vocs, session, blank=blank_run) blank_subtract(standard_run, vocs, session, blank=blank_run) quant = SampleQuant(ambient_run, standard_run, blank_run, standard_to_quantify_with) quant.quantify() # # if last_standard: # alt_quant = SampleQuant(ambient_run, last_standard, blank_run, standard_to_quantify_with) # alt_quant.quantify() # # last_standard = standard_run ambient_run = session.merge( ambient_run) # merge the quantified run, then add to list
Standard.name == 'cc416168').one() cc464566_certification = session.query(Standard).filter( Standard.name == 'cc464566').one() sx3556_certification = session.query(Standard).filter( Standard.name == 'sx3556').one() # quantify VOCs in SX3556 with CC464566, and quantify all in SX3556 with CC416168 vocs_in_sx3556 = [] all_in_sx3556 = [] for blank_1000, cc464566, sx3556 in zip(blank_1000_set, cc464566_set, sx3556_set): 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',
vocs = session.query(Standard).filter(Standard.name == 'vocs').one() vocs = [q.name for q in vocs.quantifications] 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',
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))
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()) # print(sample.date) # print(f'Toluene sample: {search_for_attr_value(sample.compounds, "name", "toluene").pa}') # print(f'Toluene standard: {search_for_attr_value(quantifier.compounds, "name", "toluene").pa}') # print(f'Toluene blank: {search_for_attr_value(blank.compounds, "name", "toluene").pa}\n') 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', 'CC416168', certified_values_of_sample, date=datetime(2019, 11, 16)) # 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 == 'cc416168').one().quantifications # get standard cert values for the sample being quantified
Integration.filename == '2019_03_19_Room2500.D').one()) ambient = (session.query(GcRun).join( Integration, Integration.run_id == GcRun.id).filter( Integration.filename == '2019_03_19a_02.D').one()) standard = session.query(Standard).filter(Standard.name == 'cc416168').one() voc_standard_list = session.query(Standard).filter( Standard.name == 'vocs').one() vocs = [q.name for q in voc_standard_list.quantifications] ridgeline.working_std = standard_run ridgeline.standard = standard ridgeline = blank_subtract(ridgeline, vocs, session, blank=blank) glass.working_std = standard_run glass.standard = standard glass = blank_subtract(glass, vocs, session, blank=blank) room.working_std = standard_run room.standard = standard room = blank_subtract(room, vocs, session, blank=blank) room.quantify() ambient.working_std = standard_run ambient.standard = standard
standard = session.query(Standard).filter(Standard.name == 'cc416168').one() voc_standard_list = session.query(Standard).filter( Standard.name == 'vocs').one() vocs = [q.name for q in voc_standard_list.quantifications] quantlist = session.query(Standard).filter( Standard.name == 'quantlist').one().quantifications quantlist = [q.name for q in quantlist] room.working_std = standard_run room.standard = standard standard_run = blank_subtract(standard_run, vocs, session, blank=None, force_no_blank=True) room = blank_subtract(room, vocs, session, blank=None, force_no_blank=True) room.quantify() ambient.working_std = standard_run ambient.standard = standard ambient = blank_subtract(ambient, vocs, session, blank=None, force_no_blank=True) ambient.quantify()
Integration.filename == '2018_10_15_room_2500.D').one()) ambient = (session.query(GcRun).join( Integration, Integration.run_id == GcRun.id).filter( Integration.filename == '2018_10_15_ambient.D').one()) standard = session.query(Standard).filter(Standard.name == 'cc416168').one() voc_standard_list = session.query(Standard).filter( Standard.name == 'vocs').one() vocs = [q.name for q in voc_standard_list.quantifications] room.working_std = standard_run room.standard = standard room = blank_subtract(room, vocs, session, blank=blank) room.quantify() ambient.working_std = standard_run ambient.standard = standard ambient = blank_subtract(ambient, vocs, session, blank=blank) ambient.quantify() for run in [room, ambient]: session.merge(run) session.commit() compile_enhancement_comparison(ambient, room,