Beispiel #1
0
    def _export_spec_factory(self):
        # dc = self.collector
        # fb = dc.get_fit_block(-1, self.fits)

        # rs_name, rs_text = self._assemble_script_blob()
        rid = self.per_spec.run_spec.runid

        # blanks = self.get_previous_blanks()

        # dkeys = [d.name for d in self._active_detectors]
        # sf = dict(zip(dkeys, fb))
        # p = self._current_data_frame

        ic = self.per_spec.isotope_group.get_ic_factor('CDD')

        exp = MassSpecExportSpec(runid=rid,
                                 runscript_name=self.per_spec.runscript_name,
                                 runscript_text=self.per_spec.runscript_blob,
                                 # signal_fits=sf,
                                 mass_spectrometer=self.per_spec.run_spec.mass_spectrometer.capitalize(),
                                 # blanks=blanks,
                                 # data_path=p,
                                 isotopes=self.per_spec.isotope_group.isotopes,
                                 # signal_intercepts=si,
                                 # signal_intercepts=self._processed_signals_dict,
                                 is_peak_hop=self.per_spec.save_as_peak_hop,
                                 ic_factor_v=float(nominal_value(ic)),
                                 ic_factor_e=float(std_dev(ic)))
        exp.load_record(self.per_spec.run_spec)

        return exp
Beispiel #2
0
    def _export_spec_factory(self):
        # dc = self.collector
        # fb = dc.get_fit_block(-1, self.fits)

        # rs_name, rs_text = self._assemble_script_blob()
        rid = self.per_spec.run_spec.runid

        # blanks = self.get_previous_blanks()

        # dkeys = [d.name for d in self._active_detectors]
        # sf = dict(zip(dkeys, fb))
        # p = self._current_data_frame

        ic = self.per_spec.isotope_group.get_ic_factor('CDD')

        exp = MassSpecExportSpec(
            runid=rid,
            runscript_name=self.per_spec.runscript_name,
            runscript_text=self.per_spec.runscript_blob,
            # signal_fits=sf,
            mass_spectrometer=self.per_spec.run_spec.mass_spectrometer.
            capitalize(),
            # blanks=blanks,
            # data_path=p,
            isotopes=self.per_spec.isotope_group.isotopes,
            # signal_intercepts=si,
            # signal_intercepts=self._processed_signals_dict,
            is_peak_hop=self.per_spec.save_as_peak_hop,
            ic_factor_v=float(nominal_value(ic)),
            ic_factor_e=float(std_dev(ic)))
        exp.load_record(self.per_spec.run_spec)

        return exp
Beispiel #3
0
class ExportSpecTestCase(unittest.TestCase):
    def setUp(self):
        data_path = '/Users/ross/Sandbox/aaaa_isotope.h5'
        self.spec = MassSpecExportSpec(data_path=data_path)

    def test_sorted_iter_isotopes(self):
        e = self.spec
        with self.spec.open_file():
            isotopes = list(e.iter_isotopes())
            isotopes = sort_isotopes(isotopes, key=lambda x: x[0])

            for (iso,
                 det), siso in zip(isotopes,
                                   ('Ar40', 'Ar39', 'Ar38', 'Ar37', 'Ar36')):
                self.assertEqual(iso, siso)

    def test_non_fool_massspec(self):
        e = self.spec
        with e.open_file():
            det = e._get_baseline_detector('Ar40', 'H1')
            self.assertEqual(det, 'H1')

    def test_fool_massspec(self):
        e = self.spec
        with e.open_file():
            e.is_peak_hop = True
            det = e._get_baseline_detector('Ar40', 'H1')
            self.assertEqual(det, e.peak_hop_detector)

    def test_baseline(self):
        e = self.spec
        with e.open_file():
            det = 'H1'
            tb, vb = e.get_baseline_data('Ar40', det)
            self.assertEqual(len(tb), 10)

    def test_iter_isotopes(self):
        with self.spec.open_file():
            e = self.spec
            gen = e.iter_isotopes()
            iso, det = next(gen)
            self.assertEqual(iso, 'Ar36')
            self.assertEqual(det, 'CDD')

            iso, det = next(gen)
            self.assertEqual(iso, 'Ar37')
            self.assertEqual(det, 'CDD')

            iso, det = next(gen)
            self.assertEqual(iso, 'Ar38')
            self.assertEqual(det, 'CDD')

            iso, det = next(gen)
            self.assertEqual(iso, 'Ar39')
            self.assertEqual(det, 'CDD')

            iso, det = next(gen)
            self.assertEqual(iso, 'Ar40')
            self.assertEqual(det, 'CDD')
Beispiel #4
0
class ExportSpecTestCase(unittest.TestCase):
    def setUp(self):
        data_path = '/Users/ross/Sandbox/aaaa_isotope.h5'
        self.spec = MassSpecExportSpec(data_path=data_path)

    def test_sorted_iter_isotopes(self):
        e = self.spec
        with self.spec.open_file():
            isotopes = list(e.iter_isotopes())
            isotopes = sort_isotopes(isotopes, key=lambda x: x[0])

            for (iso, det), siso in zip(isotopes, ('Ar40', 'Ar39',
                                                   'Ar38', 'Ar37', 'Ar36')):
                self.assertEqual(iso, siso)

    def test_non_fool_massspec(self):
        e = self.spec
        with e.open_file():
            det = e._get_baseline_detector('Ar40', 'H1')
            self.assertEqual(det, 'H1')

    def test_fool_massspec(self):
        e = self.spec
        with e.open_file():
            e.is_peak_hop = True
            det = e._get_baseline_detector('Ar40', 'H1')
            self.assertEqual(det, e.peak_hop_detector)

    def test_baseline(self):
        e = self.spec
        with e.open_file():
            det = 'H1'
            tb, vb = e.get_baseline_data('Ar40', det)
            self.assertEqual(len(tb), 10)

    def test_iter_isotopes(self):
        with self.spec.open_file():
            e = self.spec
            gen = e.iter_isotopes()
            iso, det = next(gen)
            self.assertEqual(iso, 'Ar36')
            self.assertEqual(det, 'CDD')

            iso, det = next(gen)
            self.assertEqual(iso, 'Ar37')
            self.assertEqual(det, 'CDD')

            iso, det = next(gen)
            self.assertEqual(iso, 'Ar38')
            self.assertEqual(det, 'CDD')

            iso, det = next(gen)
            self.assertEqual(iso, 'Ar39')
            self.assertEqual(det, 'CDD')

            iso, det = next(gen)
            self.assertEqual(iso, 'Ar40')
            self.assertEqual(det, 'CDD')
    def _make_spec(self, ai):
        rs_name, rs_text = '', ''
        rid = ai.record_id
        exp = MassSpecExportSpec(runid=rid,
                                 runscript_name=rs_name,
                                 runscript_text=rs_text,
                                 mass_spectrometer=ai.mass_spectrometer.capitalize(),
                                 isotopes=ai.isotopes)

        exp.load_record(ai)
        return exp
    def _make_spec(self, ai):
        rs_name, rs_text = '', ''
        rid = ai.record_id
        exp = MassSpecExportSpec(
            runid=rid,
            runscript_name=rs_name,
            runscript_text=rs_text,
            mass_spectrometer=ai.mass_spectrometer.capitalize(),
            isotopes=ai.isotopes)

        exp.load_record(ai)
        return exp
Beispiel #7
0
 def setUp(self):
     data_path = '/Users/ross/Sandbox/aaaa_isotope.h5'
     self.spec = MassSpecExportSpec(data_path=data_path)
Beispiel #8
0
 def setUp(self):
     data_path = '/Users/ross/Sandbox/aaaa_isotope.h5'
     self.spec = MassSpecExportSpec(data_path=data_path)