Exemplo n.º 1
0
    def axes_factory(self, config=None):
        if config is None:
            config = self.get_configuration(self.config_path)

        mapping = self.config_get(config, 'General', 'mapping')
        if mapping is not None:
            mapping = mapping.split(',')
        else:
            mapping = 'x,y,z'

        lp = self.config_get(config, 'General', 'loadposition')
        if lp is not None:
            loadposition = csv_to_floats(lp)
        else:
            loadposition = [0, 0, 0]

        config_path = self.configuration_dir_path
        for i, a in enumerate(mapping):
            self.info('loading axis {},{}'.format(i, a))
            limits = csv_to_floats(config.get('Axes Limits', a))

            na = self._axis_factory(config_path,
                                    name=a,
                                    id=i + 1,
                                    negative_limit=limits[0],
                                    positive_limit=limits[1],
                                    loadposition=loadposition[i])

            self.axes[a] = na
Exemplo n.º 2
0
    def _lookup_species_temp(self, v):
        """
        valid v

        He_freeze
        freeze
        pump
        release


        :param v:
        :return:
        """

        if v in ('freeze', 'pump', 'release'):
            s = 'Ar' if self.species == 'Ar/Ar' else self.species
            v = '{}_{}'.format(s, v)

        p = os.path.join(paths.device_dir, 'cryotemps.yaml')
        if os.path.isfile(p):
            with open(p, 'r') as fp:
                yd = yaml.load(fp)
                return csv_to_floats(yd[v])
        else:
            self.warning('File {} does not exist. Cryostat setpoint can not be set')
Exemplo n.º 3
0
    def _get_center_guess(self):
        path = self.stage_map.center_guess_path

        if os.path.isfile(path):
            try:
                guess = pathtolist(path)
                return csv_to_floats(guess[0])
            except BaseException as e:
                self.debug(
                    'Failed parsing center guess file {}. error={}'.format(
                        path, e))
Exemplo n.º 4
0
    def get_position(self):
        xyz = self._ask('GetPosition')
        if xyz:
            try:
                x, y, z = csv_to_floats(xyz)
                return x, y, z
            except Exception as e:
                print('pychron laser manager get_position', e)
                return 0, 0, 0

        if self.communicator.simulation:
            return 0, 0, 0
Exemplo n.º 5
0
    def _move_to_calibrated_position(self, pos):
        try:
            args = csv_to_floats(pos)
        except ValueError:
            self.warning('invalid calibrated position "{}". Could not convert to floats'.format(pos))
            return

        if len(args) == 2:
            x, y = args
            self.linear_move(x, y, use_calibration=True, block=False)
        else:
            self.warning('invalid calibrated position. incorrect number of arguments "{}"'.format(args))
Exemplo n.º 6
0
    def _move_to_calibrated_position(self, pos):
        try:
            args = csv_to_floats(pos)
        except ValueError:
            self.warning('invalid calibrated position "{}". Could not convert to floats'.format(pos))
            return

        if len(args) == 2:
            x, y = args
            self.linear_move(x, y, use_calibration=True, block=False)
        else:
            self.warning('invalid calibrated position. incorrect number of arguments "{}"'.format(args))
Exemplo n.º 7
0
    def get_position(self):
        xyz = self._ask('GetPosition')
        if xyz:
            try:
                x,y,z = csv_to_floats(xyz)
                return x, y, z
            except Exception as e:
                print('pychron laser manager get_position', e)
                return 0, 0, 0

        if self.communicator.simulation:
            return 0, 0, 0
Exemplo n.º 8
0
    def load(self):
        config = self.get_configuration()
        for a in ('x', 'y', 'z'):
            low, high = csv_to_floats(config.get('Axes Limits', a))
            setattr(self, '{}min'.format(a), low)
            setattr(self, '{}max'.format(a), high)

            v = config.get('Signs', a)
            setattr(self, '{}_sign'.format(a), int(v))

        self.set_attribute(config, 'use_sign_position_correction', 'Signs', 'use_sign_position_correction')

        return super(ChromiumStageManager, self).load()
            def cmpfunc(xyz):
                try:
                    if not self._alive:
                        return True

                    # ps = [float(p) for p in xyz.split(',')]
                    ps = csv_to_floats(xyz)
                    # return not all([abs(ab[0] - ab[1]) <= 2 for ab in zip(list(map(float, xyz.split(','))),
                    #                        (xm, ym, zm))])

                    return not all(
                        abs(a - b) <= 10 for a, b in zip(ps, (xm, ym, zm)))
                except ValueError as e:
                    print('_moving exception {}'.format(e))
Exemplo n.º 10
0
    def load(self):
        config = self.get_configuration()
        for a in ('x', 'y', 'z'):
            low, high = csv_to_floats(config.get('Axes Limits', a))
            setattr(self, '{}min'.format(a), low)
            setattr(self, '{}max'.format(a), high)

            v = config.get('Signs', a)
            setattr(self, '{}_sign'.format(a), int(v))

        self.set_attribute(config, 'use_sign_position_correction', 'Signs', 'use_sign_position_correction',
                           cast='boolean')

        return super(ChromiumStageManager, self).load()
Exemplo n.º 11
0
    def _get_watt_calibration(self, config):
        coeffs = [1, 0]
        nmapping = False
        section = 'PowerOutput'
        if config.has_section(section):
            cs = config.get(section, 'coefficients')
            try:
                coeffs = csv_to_floats(cs)
            except ValueError:
                self.warning_dialog('Invalid power calibration {}'.format(cs))
                return

            if config.has_option(section, 'normal_mapping'):
                nmapping = config.getboolean(section, 'normal_mapping')

        return coeffs, nmapping
Exemplo n.º 12
0
    def _get_watt_calibration(self, config):
        coeffs = [1, 0]
        nmapping = False
        section = 'PowerOutput'
        if config.has_section(section):
            cs = config.get(section, 'coefficients')
            try:
                coeffs = csv_to_floats(cs)
            except ValueError:
                self.warning_dialog('Invalid power calibration {}'.format(cs))
                return

            if config.has_option(section, 'normal_mapping'):
                nmapping = config.getboolean(section, 'normal_mapping')

        return coeffs, nmapping
Exemplo n.º 13
0
 def read_trap_current(self):
     resp = self.ask('GSO TC')
     actual = 0
     if ',' in resp:
         setpoint, actual = csv_to_floats(resp)
     return actual
Exemplo n.º 14
0
Arquivo: ngx.py Projeto: NMGRL/pychron
 def read_emission(self):
     resp = self.ask('GSO EC')
     actual = 0
     if ',' in resp:
         setpoint, actual = csv_to_floats(resp)
     return actual
Exemplo n.º 15
0
Arquivo: ngx.py Projeto: NMGRL/pychron
 def read_trap_current(self):
     resp = self.ask('GSO TC')
     actual = 0
     if ',' in resp:
         setpoint, actual = csv_to_floats(resp)
     return actual
Exemplo n.º 16
0
Arquivo: ngx.py Projeto: NMGRL/pychron
 def read_hv(self):
     resp = self.ask('GSO IE', verbose=True)
     actual = 0
     if ',' in resp:
         setpoint, actual = csv_to_floats(resp)
     return actual
Exemplo n.º 17
0
 def parse_coefficient_string(self, s):
     self.set_coefficients(csv_to_floats(s))
Exemplo n.º 18
0
 def _parse_coeff_string(self, coeffs):
     try:
         return csv_to_floats(coeffs)
     except:
         pass
Exemplo n.º 19
0
 def parse_coefficient_string(self, s):
     self.set_coefficients(csv_to_floats(s))
Exemplo n.º 20
0
 def _parse_coeff_string(self, coeffs):
     try:
         return csv_to_floats(coeffs)
     except:
         pass
Exemplo n.º 21
0
 def _parse_word(self, word):
     try:
         x = csv_to_floats(word)
     except (AttributeError, ValueError):
         x = []
     return x
Exemplo n.º 22
0
 def read_hv(self):
     resp = self.ask('GSO IE', verbose=True)
     actual = 0
     if ',' in resp:
         setpoint, actual = csv_to_floats(resp)
     return actual
Exemplo n.º 23
0
 def read_emission(self):
     resp = self.ask('GSO EC')
     actual = 0
     if ',' in resp:
         setpoint, actual = csv_to_floats(resp)
     return actual