def output(self, c, name = None, state = None): """To turn off and on the dds. Turning off the DDS sets the frequency and amplitude to the off_parameters provided in the configuration. """ if self.ddsLock and state is not None: raise dds_access_locked() channel = self._getChannel(c, name) if state is not None: yield self._setOutput(channel, state) channel.state = state self.notifyOtherListeners(c, (name, 'state', channel.state), self.on_dds_param) returnValue(channel.state)
def frequency(self, c, name = None, frequency = None): """Get or set the frequency of the named channel or the selected channel""" #get the hardware channel if self.ddsLock and frequency is not None: raise dds_access_locked() channel = self._getChannel(c, name) if frequency is not None: #setting the frequency frequency = frequency['MHz'] self._checkRange('frequency', channel, frequency) if channel.state: #only send to hardware if the channel is on yield self._setFrequency(channel, frequency) channel.frequency = frequency self.notifyOtherListeners(c, (name, 'frequency', channel.frequency), self.on_dds_param) frequency = WithUnit(channel.frequency, 'MHz') returnValue(frequency)
def amplitude(self, c, name = None, amplitude = None): """Get or set the amplitude of the named channel or the selected channel""" #get the hardware channel if self.ddsLock and amplitude is not None: raise dds_access_locked() channel = self._getChannel(c, name) if amplitude is not None: #setting the ampplitude amplitude = amplitude['dBm'] self._checkRange('amplitude', channel, amplitude) if channel.state: #only send to hardware if the channel is on yield self._setAmplitude(channel, amplitude) channel.amplitude = amplitude self.notifyOtherListeners(c, (name, 'amplitude', channel.amplitude), self.on_dds_param) amplitude = WithUnit(channel.amplitude, 'dBm') returnValue(amplitude)
def movinglattice(self, c, parameter = None, returns = None): """set parameters for moving lattice""" #get the hardware channel if self.ddsLock and parameter is not None: raise dds_access_locked() channel = self._getChannel(c, 'Moving Lattice') if parameter is not None: #self._checkRange('frequency', channel, frequency) if channel.state: #only send to hardware if the channel is on yield self._setMovingLatticeParameter(channel, parameter) channel.lattice_parameter = parameter #channel.t2 = parameter self.notifyOtherListeners(c, ('Moving Lattice', 'parameter', channel.lattice_parameter), self.on_dds_param) param = channel.lattice_parameter print "param is", param returnValue(param)
def frequency(self, c, name=None, frequency=None): """Get or set the frequency of the named channel or the selected channel""" #get the hardware channel if self.ddsLock and frequency is not None: raise dds_access_locked() channel = self._getChannel(c, name) if frequency is not None: #setting the frequency frequency = frequency['MHz'] self._checkRange('frequency', channel, frequency) if channel.state: #only send to hardware if the channel is on yield self._setFrequency(channel, frequency) channel.frequency = frequency self.notifyOtherListeners(c, (name, 'frequency', channel.frequency), self.on_dds_param) frequency = WithUnit(channel.frequency, 'MHz') returnValue(frequency)
def amplitude(self, c, name=None, amplitude=None): """Get or set the amplitude of the named channel or the selected channel""" #get the hardware channel if self.ddsLock and amplitude is not None: raise dds_access_locked() channel = self._getChannel(c, name) if amplitude is not None: #setting the ampplitude amplitude = amplitude['dBm'] self._checkRange('amplitude', channel, amplitude) if channel.state: #only send to hardware if the channel is on yield self._setAmplitude(channel, amplitude) channel.amplitude = amplitude self.notifyOtherListeners(c, (name, 'amplitude', channel.amplitude), self.on_dds_param) amplitude = WithUnit(channel.amplitude, 'dBm') returnValue(amplitude)
def movinglattice(self, c, parameter=None, returns=None): """set parameters for moving lattice""" #get the hardware channel if self.ddsLock and parameter is not None: raise dds_access_locked() channel = self._getChannel(c, 'Moving Lattice') if parameter is not None: #self._checkRange('frequency', channel, frequency) if channel.state: #only send to hardware if the channel is on yield self._setMovingLatticeParameter(channel, parameter) channel.lattice_parameter = parameter #channel.t2 = parameter self.notifyOtherListeners( c, ('Moving Lattice', 'parameter', channel.lattice_parameter), self.on_dds_param) param = channel.lattice_parameter print "param is", param returnValue(param)