示例#1
0
 def __init__(self, pulser, config, configName, globalDict, parent=None):
     self.isSetup = False
     dacBase.__init__(self, parent)
     dacForm.__init__(self)
     self.config = config
     self.dac = DAC(pulser)
     self.channelsConfigName = '{0}.dacExpressionChannels'.format(
         configName)
     self.autoApplyConfigName = '{0}.autoApply'.format(configName)
     self.guiStateConfigName = '{0}.guiState'.format(configName)
     self.dacChannels = self.config.get(self.channelsConfigName)
     if not self.dacChannels or len(
             self.dacChannels) != self.dac.numChannels:
         self.dacChannels = [
             DACChannelSetting(globalDict=globalDict)
             for _ in range(self.dac.numChannels)
         ]
     for index, channel in enumerate(self.dacChannels):
         channel.globalDict = globalDict
         channel.onChange = partial(self.onChange, index)
     self.autoApply = self.config.get(self.autoApplyConfigName, True)
     self.decimation = defaultdict(lambda: StaticDecimation(Q(30, 's')))
     self.persistence = DBPersist()
     self.globalDict = globalDict
     self.pulser = pulser
示例#2
0
 def __init__(self,
              pulser,
              config,
              configName='DDSUi',
              globalDict=dict(),
              parent=None):
     DDSBase.__init__(self, parent)
     DDSForm.__init__(self)
     if pulser.pulserConfiguration():
         self.channelInfo = sorted(list(
             pulser.pulserConfiguration().ddsChannels.values()),
                                   key=lambda x: x.channel)
     else:
         self.channelInfo = []
     self.numChannels = len(self.channelInfo)
     self.config = config
     self.channelConfigName = '{0}.ddsChannels'.format(configName)
     self.autoApplyConfigName = '{0}.autoApply'.format(configName)
     self.guiStateConfigName = '{0}.guiState'.format(configName)
     self.ad9912 = Ad9912.Ad9912(pulser)
     oldDDSChannels = self.config.get(self.channelConfigName, [])
     self.ddsChannels = [
         oldDDSChannels[i]
         if i < len(oldDDSChannels) else DDSChannelSettings()
         for i in range(self.numChannels)
     ]
     self.autoApply = self.config.get(self.autoApplyConfigName, True)
     self.decimation = defaultdict(lambda: StaticDecimation(Q(30, 's')))
     self.persistence = DBPersist()
     self.globalDict = globalDict
     self.pulser = pulser
     self.persistSpace = 'DDS'
     for index, channelinfo in enumerate(self.channelInfo):
         self.ddsChannels[index].channel = channelinfo.channel
         self.ddsChannels[index].shutter = channelinfo.shutter
示例#3
0
 def __init__(self, name, value=Q(0), categories=None):
     super(GlobalVariable, self).__init__()
     self.decimation = StaticDecimation(Q(10, 's'))
     self.history = deque(maxlen=10)
     self._value = value
     self._name = name
     self.categories = categories
示例#4
0
 def __setstate__(self, state):
     super(GlobalVariable, self).__init__()
     self.decimation = StaticDecimation(Q(10, 's'))
     self._name, self._value, self.categories, self.history = state