def get_analysis_import_spec(self, delimiter=None): pspec = self.new_persistence_spec() rspec = pspec.run_spec f = self.file_gen(delimiter) row = next(f) rspec.identifier = row[0][:-1] rspec.aliquot = 1 rspec.step = row[0][-1] rspec.extract_device = make_ed(row[0]) rspec.irradiation = row[1] rspec.irradiation_position = get_int(f, 1) rspec.irradiation_level = 'A' for attr in ('sample', 'material', 'project'): setattr(rspec, attr, get_next(f, 1)) for attr in ('j', 'j_err'): setattr(pspec, attr, get_float(f, 1)) d = get_next(f, 1) t = get_next(f, 1) pspec.timestamp = datetime.strptime('{} {}'.format(d, t), '%m/%d/%Y %H:%M:%S') abundance_sens = get_float(f) abundance_sens_err = get_float(f) air = get_float(f) disc = 295.5 / air pspec.discrimination = disc row = next(f) # MD errpr row = next(f) # peakhop cycles n40 = get_int(f) n39 = get_int(f) n38 = get_int(f) n37 = get_int(f) n36 = get_int(f) n41 = get_int(f) n355 = get_int(f) _spare = next(f) int40 = next(f) int39 = next(f) int38 = next(f) int37 = next(f) int36 = next(f) int41 = next(f) int355 = next(f) bk40 = get_ufloat(f) bk39 = get_ufloat(f) bk38 = get_ufloat(f) bk37 = get_ufloat(f) bk36 = get_ufloat(f) bk41 = get_ufloat(f) bk40 += get_ufloat(f) bk39 += get_ufloat(f) bk38 += get_ufloat(f) bk37 += get_ufloat(f) bk36 += get_ufloat(f) bk41 += get_ufloat(f) bk40 += get_ufloat(f) bk39 += get_ufloat(f) bk38 += get_ufloat(f) bk37 += get_ufloat(f) bk36 += get_ufloat(f) bk41 += get_ufloat(f) isotopes = { 'Ar40': self._get_isotope(f, 'Ar40', n40, bk40), 'Ar39': self._get_isotope(f, 'Ar39', n39, bk39), 'Ar38': self._get_isotope(f, 'Ar38', n38, bk38), 'Ar37': self._get_isotope(f, 'Ar37', n37, bk37), 'Ar36': self._get_isotope(f, 'Ar36', n36, bk36), 'Ar41': self._get_isotope(f, 'Ar41', n41, bk41) } xs, ys = self._get_baseline(f, n355) for iso in isotopes.values(): bs = Baseline(iso.name, iso.detector) bs.set_fit('average') bs.set_fit_error_type('SEM') bs.xs = xs bs.ys = ys iso.baseline = bs try: next(f) self.warning('Extra data in file') except StopIteration: pass pspec.isotope_group = IsotopeGroup(isotopes=isotopes) return pspec
def get_analysis_import_spec(self, delimiter=None): pspec = self.new_persistence_spec() rspec = pspec.run_spec f = self.file_gen(delimiter) row = next(f) rspec.identifier = row[0][:-1] rspec.aliquot = 1 rspec.step = row[0][-1] rspec.extract_device = make_ed(row[0]) rspec.irradiation = row[1] rspec.irradiation_position = get_int(f, 1) rspec.irradiation_level = 'A' for attr in ('sample', 'material', 'project'): setattr(rspec, attr, get_next(f, 1)) for attr in ('j', 'j_err'): setattr(pspec, attr, get_float(f, 1)) d = get_next(f, 1) t = get_next(f, 1) pspec.timestamp = datetime.strptime('{} {}'.format(d, t), '%m/%d/%Y %H:%M:%S') abundance_sens = get_float(f) abundance_sens_err = get_float(f) air = get_float(f) disc = 295.5 / air pspec.discrimination = disc row = next(f) # MD errpr row = next(f) # peakhop cycles n40 = get_int(f) n39 = get_int(f) n38 = get_int(f) n37 = get_int(f) n36 = get_int(f) n41 = get_int(f) n355 = get_int(f) _spare = next(f) int40 = next(f) int39 = next(f) int38 = next(f) int37 = next(f) int36 = next(f) int41 = next(f) int355 = next(f) bk40 = get_ufloat(f) bk39 = get_ufloat(f) bk38 = get_ufloat(f) bk37 = get_ufloat(f) bk36 = get_ufloat(f) bk41 = get_ufloat(f) bk40 += get_ufloat(f) bk39 += get_ufloat(f) bk38 += get_ufloat(f) bk37 += get_ufloat(f) bk36 += get_ufloat(f) bk41 += get_ufloat(f) bk40 += get_ufloat(f) bk39 += get_ufloat(f) bk38 += get_ufloat(f) bk37 += get_ufloat(f) bk36 += get_ufloat(f) bk41 += get_ufloat(f) isotopes = {'Ar40': self._get_isotope(f, 'Ar40', n40, bk40), 'Ar39': self._get_isotope(f, 'Ar39', n39, bk39), 'Ar38': self._get_isotope(f, 'Ar38', n38, bk38), 'Ar37': self._get_isotope(f, 'Ar37', n37, bk37), 'Ar36': self._get_isotope(f, 'Ar36', n36, bk36), 'Ar41': self._get_isotope(f, 'Ar41', n41, bk41)} xs, ys = self._get_baseline(f, n355) for iso in isotopes.values(): bs = Baseline(iso.name, iso.detector) bs.set_fit('average') bs.set_fit_error_type('SEM') bs.xs = xs bs.ys = ys iso.baseline = bs try: next(f) self.warning('Extra data in file') except StopIteration: pass pspec.isotope_group = IsotopeGroup(isotopes=isotopes) return pspec