def map_dac_to_mass(self, dac, detname): """ convert a DAC value (voltage) to mass for a given detector use the mftable :param dac: float, voltage (0-10V) :param detname: str, name of a detector, e.g H1 :return: float, mass """ from pychron.spectrometer.mftable import get_detector_name, mass_cal_func detname = get_detector_name(detname) d = self.mftable.get_table() _, xs, ys, p = d[detname] def func(x, *args): c = list(p) c[-1] -= dac return mass_cal_func(c, x) try: mass = optimize.brentq(func, 0, 200) return mass except ValueError, e: self.debug('DAC does not map to an isotope. DAC={}, Detector={}'.format(dac, detname))
def map_dac_to_mass(self, dac, detname): """ convert a DAC value (voltage) to mass for a given detector use the mftable :param dac: float, voltage (0-10V) :param detname: str, name of a detector, e.g H1 :return: float, mass """ from pychron.spectrometer.mftable import get_detector_name, mass_cal_func detname = get_detector_name(detname) d = self.mftable.get_table() _, xs, ys, p = d[detname] def func(x, *args): c = list(p) c[-1] -= dac return mass_cal_func(c, x) try: mass = optimize.brentq(func, 0, 200) return mass except ValueError, e: import traceback traceback.print_exc() self.debug('DAC does not map to an isotope. DAC={}, Detector={}'.format(dac, detname))
def map_mass_to_dac(self, mass, detname): detname = get_detector_name(detname) d = self.mftable.get_table() _, xs, ys, p = d[detname] dac = mass_cal_func(p, mass) self.debug('map mass to dac {} >> {}'.format(mass, dac)) return dac
def map_dac_to_mass(self, dac, detname): detname = get_detector_name(detname) d = self.mftable.get_table() _, xs, ys, p = d[detname] def func(x, *args): c = list(p) c[-1] -= dac return mass_cal_func(c, x) mass = optimize.brentq(func, 0, 200) return mass
def map_mass_to_dac(self, mass, detname): """ convert a mass value from amu to dac for a given detector :param mass: float, amu :param detname: std, name of a detector, e.g. H1 :return: float, dac voltage """ from pychron.spectrometer.mftable import get_detector_name, mass_cal_func detname = get_detector_name(detname) d = self.mftable.get_table() _, xs, ys, p = d[detname] dac = mass_cal_func(p, mass) self.debug('map mass to dac {} >> {}'.format(mass, dac)) return dac