Exemple #1
0
 def fetch_info(self, metainfo):
     value = DeviceValuePlaceholder('Distances',
                                    self.component).fetch_info(metainfo)
     sample = DeviceValuePlaceholder('Distances',
                                     'sample').fetch_info(metainfo)
     if sample and isinstance(sample[0], float) and \
             value and isinstance(value[0], float):
         dist = sample[0] - value[0]
         return (dist, '%s' % dist, value[2], value[3])
     else:
         return (self.defaultval, '%s' % self.defaultval, 'mm', 'general')
Exemple #2
0
 def __init__(self,
              device,
              dtype,
              separate_log=False,
              parameter='value',
              **attr):
     KafkaStream.__init__(self, **attr)
     DeviceValuePlaceholder.__init__(self, device, parameter)
     self.set('type', dtype)
     self.set('writer_module', 'ns10')
     self.separate_log = separate_log
Exemple #3
0
    def fetch_info(self, metainfo):
        """ Returns the slit geometry [top-bottom, left-right]
        """
        num = self.slit
        top = DeviceValuePlaceholder('d%st' % num).fetch_info(metainfo)
        bottom = DeviceValuePlaceholder('d%sb' % num).fetch_info(metainfo)
        left = DeviceValuePlaceholder('d1l').fetch_info(metainfo)
        right = DeviceValuePlaceholder('d1r').fetch_info(metainfo)

        h = self.defaultval if None in [top, bottom] else top[0] - bottom[0]
        w = self.defaultval if None in [left, right] else left[0] - right[0]

        if None in [h, w]:
            return None

        val = [h, w]
        return val, '%s' % val, 'mm', ''
Exemple #4
0
 def fetch_info(self, metainfo):
     useremail, _, _, _ = DeviceValuePlaceholder.fetch_info(self, metainfo)
     usersplit = useremail.split('<')
     ret = ''
     if not self.getemail:
         ret = usersplit[0].strip()
     elif len(usersplit) > 1:
         ret = usersplit[1][:-1]
     return ret, ret, '', ''
Exemple #5
0
    def __init__(self,
                 device,
                 parameter='value',
                 dtype=None,
                 defaultval=None,
                 **attr):
        val = DeviceValuePlaceholder(device, parameter, defaultval)
        NXDataset.__init__(self, val, dtype, **attr)

        # Set the NICOS data as attributes
        if defaultval is not None:
            self.attrs["default_value"] = NXAttribute(defaultval)
        self.attrs["nicos_name"] = NXAttribute(device)
        self.attrs["nicos_param"] = NXAttribute(parameter)
Exemple #6
0
 def __init__(self, dev, parameter, getemail=False):
     DeviceValuePlaceholder.__init__(self, dev, parameter)
     self.getemail = getemail
Exemple #7
0
 def fetch_info(self, metainfo):
     start = DeviceValuePlaceholder(self.component).fetch_info(metainfo)[0]
     val = []
     for i in range(self.length):
         val.append(start + i * self.step)
     return val, '', 'degree', 'general'
Exemple #8
0
 def __init__(self, device, parameter='value', dtype=None, defaultval=None):
     val = DeviceValuePlaceholder(device, parameter, defaultval)
     NXAttribute.__init__(self, val, dtype)
Exemple #9
0
 def __init__(self, device, parameter='value', separate_log=True, **attr):
     KafkaStream.__init__(self, **attr)
     DeviceValuePlaceholder.__init__(self, device, parameter)
     self.separate_log = separate_log