示例#1
0
文件: spec.py 项目: NMGRL/pychron
    def overlap(self, v):
        if isinstance(v, (list, tuple)):
            args = v
        else:
            try:
                args = csv_to_ints(v)
            except ValueError:
                logger.debug('Invalid overlap string "{}". Should be of the form "10,60" or "10" '.format(v))
                return

        if len(args) == 1:
            self._overlap = args[0]
        elif len(args) == 2:
            self._overlap, self._min_ms_pumptime = args
示例#2
0
    def overlap(self, v):
        if isinstance(v, (list, tuple)):
            args = v
        else:
            try:
                args = csv_to_ints(v)
            except ValueError:
                logger.debug('Invalid overlap string "{}". Should be of the form "10,60" or "10" '.format(v))
                return

        if len(args) == 1:
            self._overlap = args[0]
        elif len(args) == 2:
            self._overlap, self._min_ms_pumptime = args
示例#3
0
def increment_position(pos):
    for regex, sfunc, ifunc, _ in (SLICE_REGEX, SSLICE_REGEX,
                                   PSLICE_REGEX, CSLICE_REGEX, TRANSECT_REGEX):
        if regex.match(pos):
            return ifunc(pos)
    else:
        m = csv_to_ints(pos)
        ms = []
        offset = max(m) - min(m)
        inc = 1
        for i, mi in enumerate(m):
            try:
                inc = m[i + 1] - mi
            except IndexError:
                pass
            ms.append(mi + offset + inc)
        return ','.join(map(str, ms))
示例#4
0
    def load(self, path):
        config = self.get_configuration(path)
        for attr in ['acceleration',
                     'deceleration',
                     # 'emergency_deceleration',
                     'jerk',
                     'velocity',
                     ]:
            self.set_attribute(config, attr, 'General', attr, cast='float')

        self.set_attribute(config, 'id', 'General', 'id', cast='int')

        axes = self.config_get(config, 'General', 'axes')
        self.axes = tuple(csv_to_ints(axes))
        self.nominal_velocity = self.velocity
        self.nominal_acceleration = self.acceleration
        self.nominal_deceleration = self.deceleration
示例#5
0
    def load(self, path):
        config = self.get_configuration(path)
        for attr in [
                'acceleration',
                'deceleration',
                # 'emergency_deceleration',
                'jerk',
                'velocity',
        ]:
            self.set_attribute(config, attr, 'General', attr, cast='float')

        self.set_attribute(config, 'id', 'General', 'id', cast='int')

        axes = self.config_get(config, 'General', 'axes')
        self.axes = tuple(csv_to_ints(axes))
        self.nominal_velocity = self.velocity
        self.nominal_acceleration = self.acceleration
        self.nominal_deceleration = self.deceleration
示例#6
0
    def _selection_str_changed(self, new):
        if new:
            fs = [(ps.labnumber, pp) for ps in self.positions
                  for pp in ps.positions]

            def func(idx):
                pp = next((p for p in fs if p[1] == idx))
                return LoadPosition(labnumber=pp[0], positions=[idx])

            ss = []
            for r in new.split(','):
                if '-' in r:
                    s, e = csv_to_ints(r, '-')
                    e += 1
                else:
                    s = int(r)
                    e = s + 1

                ss.extend([func(i) for i in range(s, e)])

            self.selected_positions = ss
示例#7
0
    def _selection_str_changed(self, new):
        if new:
            fs = [(ps.labnumber, pp) for ps in self.positions
                  for pp in ps.positions]

            def func(idx):
                pp = next((p for p in fs if p[1] == idx))
                return LoadPosition(labnumber=pp[0], positions=[idx])

            ss = []
            for r in new.split(','):
                if '-' in r:
                    s, e = csv_to_ints(r, '-')
                    e += 1
                else:
                    s = int(r)
                    e = s + 1

                ss.extend([func(i) for i in range(s, e)])

            self.selected_positions = ss
示例#8
0
 def _set_position(self, pos):
     if pos:
         if ',' in pos:
             self._position = csv_to_ints(pos)
         else:
             self._position = pos