コード例 #1
0
    def _update(self):
        if not MonitorInstrument._update(self):
            return False

        temp = self.get_temperature()
        alarm = self.get_alarm_state() 
        t_num = time.time() 
        t_str = time.asctime()
        print('current time: %s'%t_str)
        print 'current alarm state: ', alarm
        print('current platform temperature:')
        print'{:.2f} K'.format(temp)

        if self.get_recording():
            self._data.add_data_point((t_num-self._T0)/3600., temp)


        if (temp > self.get_max_temperature()) or (alarm and not(self.get_ignore_alarm_state())):
            subject= 'Warning from ' + self.get_name()
            message = 'Warning from ' + self.get_name() +': \n'+\
                      'current Platform Temperature Reading:\n' + \
                      ' {:.2f} \n'.format(temp) + \
                      'current alarm state: ' + str(alarm) + '.\n' + \
                      'Please help me!!!\n xxx'
            #recipients  = ['*****@*****.**', '*****@*****.**', '*****@*****.**','*****@*****.**', '*****@*****.**']
            recipients  = ['*****@*****.**', '*****@*****.**', '*****@*****.**','*****@*****.**']
            print message
            if self.get_send_email():
                    if self._mailer.send_email(recipients,subject,message):
						print 'Warning email message sent'					

        return True
コード例 #2
0
    def __init__(self, name, **kw):
		
        MonitorInstrument.__init__(self, name)
		
        self._levelmeter = visa.instrument('GPIB::8::INSTR')
        self._keithley =  visa.instrument('GPIB::11::INSTR')
        self._mailer = qt.instruments['gmailer']
        
        self._keithleyMM = qt.instruments['keithleyMM']
				
        self.add_parameter('he2_lvl_min',
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='cm')
				
        self.add_parameter('temp_voltage_min',
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='V')
        
        self.add_parameter('temperature',
                type=types.FloatType,
                flags=Instrument.FLAG_GET,
                units='K')
		
		#
        self.set_he2_lvl_min(0.5)	#cm corr to about 2 hour response time
        self.set_temp_voltage_min(1.5) #1.5 V corr to T > 6 K

        # load the temperature calibration from file
        
        try:
            self.temp_calib = np.loadtxt(os.path.join(qt.config['execdir'], 
                '..', 'user', 'calib', 'DT-670.txt'))
        except:
            print "could not get T-calibration data."
            self.temp_calib = None
        
		
		#override from config:
        self._parlist.extend(['he2_lvl_min','temp_voltage_min'])
        self.load_cfg()
        self.save_cfg()
コード例 #3
0
    def __init__(self, name, montana_ins_name='montana_cryostation', mailer='gmailer'):
		
        MonitorInstrument.__init__(self, name)
		
        self._montana = qt.instruments[montana_ins_name]
        self._mailer = qt.instruments[mailer]
                
        self.add_parameter('temperature',
                type=types.FloatType,
                flags=Instrument.FLAG_GET,
                units='K')

        self.add_parameter('alarm_state',
                type = types.BooleanType,
                flags=Instrument.FLAG_GET,)

        self.add_parameter('ignore_alarm_state',
                type = types.BooleanType,
                flags=Instrument.FLAG_GETSET,)

        self.add_parameter('max_temperature',
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='K')

        self.add_parameter('recording',
                flags=Instrument.FLAG_GETSET,
                type=types.BooleanType)

        self.add_function('restart_recording')

        self._max_temperature = 300.
        self._ignore_alarm_state = False

        self._recording = False
        self.set_recording(True)

		#override from config:
        self._parlist.extend(['max_temperature', 'ignore_alarm_state'])
        self.load_cfg()
        self.save_cfg()
コード例 #4
0
    def _update(self):
        if not MonitorInstrument._update(self):
            return False
		
        t_num = time.time()	
        t_str = time.asctime()
        print('current time: %s'%t_str)
        print('current cryovac levelmeter reading:')
        self._levelmeter.write('chan 2')
        lev1 = self._levelmeter.ask('meas?')
        lev1_flt=float((lev1.split(' '))[0])
        print('  LHe1 (upper tank): %s'%(lev1))
        self._levelmeter.write('chan 1')
        lev2 = self._levelmeter.ask('meas?')
        lev2_flt=float((lev2.split(' '))[0])
        print('  LHe2 (lower tank): %s'%(lev2))
    
        volt = 'n/a'
        keith_meas = self._keithley.ask(':func?')
        if keith_meas == '"VOLT:DC"':
            volt = float(self._keithley.ask(':data?'))
            print('current sensor voltage: %.3f'%(volt))
            print('current temperature: %.3f'%(self.get_temperature()))
		
        if self.get_save_data():
            with open('//tudelft.net/staff-groups/tnw/ns/qt/Diamond/setups/LT2/cryo.txt','a') as f:
                f.write('%.0f\t%s\t%s\t%s\t%.3f V\n'%(t_num,t_str,lev1,lev2,volt))
                f.close()
        
        if (lev2_flt < self.get_he2_lvl_min()) or (volt != 'n/a' and volt < self.get_temp_voltage_min()):
            subject= 'Warning from Cryo LT2!'
            message = 'Warning from Cryo LT2: Measured levels: \n'+\
                      'current cryovac levelmeter reading:\n' + \
                      '  LHe1 (upper tank): %s'%(lev1) + '\n' + \
                      '  LHe2 (lower tank): %s'%(lev2) + '\n' + \
                      'current sensor voltage: %.3f'%(volt) + '.\n' + \
                      'current temperature:  %.3f'%(self.get_temperature()) + '.\n' + \
                      'This is below minimum values (LHe2 < %.3f'%(self.get_he2_lvl_min()) + ' cm' +\
                      ', voltage < %.3f'%(self.get_temp_voltage_min()) + 'V ( = 6 K)). \n' + \
                      'Please help me!!!\n xxx LT2'
            recipients  = ['*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**']
            #recipients  = '*****@*****.**'
            print message
            if self.get_send_email():
                    if self._mailer.send_email(recipients,subject,message):
						print 'Warning email message sent'					
        return True
コード例 #5
0
    def _update(self):
        if not MonitorInstrument._update(self):
            return False

        MAXLVLTRIES = 3

        i = 0
        self._levelmeter.write('chan 2')
        lev1 = self._levelmeter.ask('meas?')
        lev1_flt=float((lev1.split(' '))[0])
        while lev1_flt < 1.0 and i < MAXLVLTRIES:
            self._levelmeter.write('chan 2')
            self._levelmeter.write('meas')
            
            # TODO make sure readout is actually finished

            lev1 = self._levelmeter.ask('meas?')
            lev1_flt=float((lev1.split(' '))[0])
            i+= 1
            # time.sleep(0.1)

        if lev1_flt < -1.0:
            lev1_flt = -1.0

        i = 0
        self._levelmeter.write('chan 1')
        lev2 = self._levelmeter.ask('meas?')
        lev2_flt=float((lev2.split(' '))[0])
        while lev2_flt < 1.0 and i < MAXLVLTRIES:
            self._levelmeter.write('chan 1')
            self._levelmeter.write('meas')

            # TODO make sure readout is actually finished

            lev2 = self._levelmeter.ask('meas?')
            lev2_flt=float((lev2.split(' '))[0])
            i+= 1
            # time.sleep(0.1)

        if lev2_flt < -1.0:
            lev2_flt = -1.0
	
        t_num = time.time()	
        t_str = time.asctime()
        
        self._rate_times.append((t_num-self._T0)/3600.)
        self._rate_levels1.append(lev1_flt)
        self._rate_levels2.append(lev2_flt)
        i = 0
        while self._rate_times[i] < (((t_num-self._T0)/3600.) - self._rate_update_interval):
            self._rate_times = self._rate_times[1:]
            self._rate_levels1 = self._rate_levels1[1:]
            self._rate_levels2 = self._rate_levels2[1:]

        if len(self._rate_times) > 1:
            rate1 = (self._rate_levels1[0] - self._rate_levels1[-1])/(self._rate_times[-1] - self._rate_times[0])
            rate2 = (self._rate_levels2[0] - self._rate_levels2[-1])/(self._rate_times[-1] - self._rate_times[0])
        else:
            rate1 = 0
            rate2 = 0

        print('current time: %s'%t_str)
        print('current cryovac levelmeter reading:')
        print('  LHe1 (upper tank): %s'%(lev1))
        print('  LHe2 (lower tank): %s'%(lev2))

        volt = 'n/a'
        keith_meas = self._keithley.ask(':func?')
        if keith_meas == '"VOLT:DC"':
            volt = float(self._keithley.ask(':data?'))
            print('current sensor voltage: %.3f'%(volt))
            print('current temperature: %.3f'%(self.get_temperature()))
		
        if self.get_save_data():
            try:
                with open('//tudelft.net/staff-groups/tnw/ns/qt/Diamond/setups/LT2/cryo.txt','a') as f:
                    f.write('%.0f\t%s\t%s\t%s\t%.3f V\n'%(t_num,t_str,lev1,lev2,volt))
                    f.close()
            except Exception:
                print ' error writing on network disk'
                
        if self.get_send_email():
            try:
                params = urllib.urlencode({'entry_312373567': lev1, 'entry_941467047': lev2, 'ss-submit': 'Submit'})
                urllib.urlopen('https://docs.google.com/forms/d/1T0ZY1G08LPWRn3M_-yq--PAdrz_8LtqzQJn9AL3qZVs/formResponse', params)
            except Exception:
                print ' error publishing levels'
          
        if (lev2_flt < self.get_he2_lvl_min()) or (volt != 'n/a' and volt < self.get_temp_voltage_min()) or (-0.1 < lev1_flt < self.get_he1_lvl_min()):
            subject= 'Warning from Cryo LT2!'
            message = 'Warning from Cryo LT2: Measured levels: \n'+\
                      'current cryovac levelmeter reading:\n' + \
                      '  LHe1 (upper tank): %s'%(lev1) + '\n' + \
                      '  LHe2 (lower tank): %s'%(lev2) + '\n' + \
                      'current sensor voltage: %.3f'%(volt) + '.\n' + \
                      'current temperature:  %.3f'%(self.get_temperature()) + '.\n' + \
                      'This is below minimum values (LHe2 < %.3f'%(self.get_he2_lvl_min()) + ' cm'+ ', LHe1 < %.3f'%(self.get_he1_lvl_min()) +\
                      ', voltage < %.3f'%(self.get_temp_voltage_min()) + 'V ( = 6 K)). \n' + \
                      'Please help me!!!\n xxx LT2'
            recipients  = ['*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**','*****@*****.**']
            #recipients  = '*****@*****.**'
            print message
            if self.get_send_email():
                    if self._mailer.send_email(recipients,subject,message):
						print 'Warning email message sent'					
        
        if self._monitor_lt1:
            temp_A=self._temp_lt1.get_kelvinA()
            temp_B=self._temp_lt1.get_kelvinB()
            print('LT1 temperature A: %.3f K'%(temp_A))
            print('LT1 temperature B: %.3f K'%(temp_B))

            if self.get_save_data():
                with open('//tudelft.net/staff-groups/tnw/ns/qt/Diamond/setups/LT1/cryo.txt','a') as f:
                    f.write('%.0f\t%s\t%.3f K\t%.3f K \n'%(t_num,t_str,temp_A,temp_B))
                    f.close()
            if temp_A>self.get_lt1_temp_A_max():

                subject= 'Warning from Cryo LT1!'
                message = 'Warning from Cryo LT1: \n'+\
                          'LT1 temperature A: %.3f K'%(temp_A) + '\n'+\
                          'LT1 temperature B: %.3f K'%(temp_B) + '\n'+\
                          'This is below minimum value (temp_A < %.3f)' %(self.get_lt1_temp_A_max()) + ' K \n'+\
                          'Please help me!!!\n xxx LT1'
                recipients  = ['*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**']
                if temp_A>self.get_lt1_temp_A_max()+3:
                    subject=subject+' - LT1 WARMING UP!!!'
                    self.warmup_lt1()
                #recipients  = '*****@*****.**'
                print message
                if self.get_send_email():
                    if self._mailer.send_email(recipients,subject,message):
						print 'Warning email message sent'

            if self.get_recording():
                self._data.add_data_point((t_num-self._T0)/3600., lev1_flt, lev2_flt, self.get_temperature(), rate1, rate2, temp_A, temp_B)
        else:
            if self.get_recording():
                self._data.add_data_point((t_num-self._T0)/3600., lev1_flt, lev2_flt, self.get_temperature(), rate1, rate2)

        return True
コード例 #6
0
    def __init__(self, name, monitor_lt1=False, **kw):
		
        MonitorInstrument.__init__(self, name)
		
        self._levelmeter = visa.instrument('GPIB::8::INSTR')
        self._keithley =  visa.instrument('GPIB::11::INSTR')
        self._mailer = qt.instruments['gmailer']
        
        self._keithleyMM = qt.instruments['keithleyMM']
        
        self._monitor_lt1=monitor_lt1
        if monitor_lt1:
            self._temp_lt1 = qt.instruments['TemperatureController_lt1']
            self._lt1_positioner = qt.instruments['AttoPositioner_lt1']
            self._adwin_lt1=qt.instruments['adwin_lt1']
				
        self.add_parameter('he2_lvl_min',
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='cm')
        
        self.add_parameter('he1_lvl_min',
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='cm')

				
        self.add_parameter('temp_voltage_min',
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='V')

        self.add_parameter('lt1_temp_A_max',
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='K')
        
        self.add_parameter('temperature',
                type=types.FloatType,
                flags=Instrument.FLAG_GET,
                units='K')

        self.add_parameter('recording',
                type=types.BooleanType)

        self.add_function('restart_recording')
		
		#
        self.set_he2_lvl_min(0.5)	#cm corr to about 1 hour response time
        self.set_he1_lvl_min(1.0)   #cm corr to about 1 hour response time
        self.set_temp_voltage_min(1.5) #1.5 V corr to T > 6 K
        self.set_lt1_temp_A_max(7.0)
        self._recording = False
        self.set_recording(True)
        
        # load the temperature calibration from file
        try:
            self.temp_calib = np.loadtxt(os.path.join(qt.config['execdir'], 
                '..', 'measurement', 'calib', 'DT-670.txt'))
        except:
            print "could not get T-calibration data."
            self.temp_calib = None
        
		
		#override from config:
        self._parlist.extend(['he2_lvl_min','temp_voltage_min', 'lt1_temp_A_max'])
        self.load_cfg()
        self.save_cfg()
コード例 #7
0
ファイル: monitor_cryo.py プロジェクト: caizikun/measurement
    def _update(self):
        if not MonitorInstrument._update(self):
            return False

        MAXLVLTRIES = 3

        i = 0
        self._levelmeter.write('chan 2')
        lev1 = self._levelmeter.ask('meas?')
        lev1_flt = float((lev1.split(' '))[0])
        while lev1_flt < 1.0 and i < MAXLVLTRIES:
            self._levelmeter.write('chan 2')
            self._levelmeter.write('meas')

            # TODO make sure readout is actually finished

            lev1 = self._levelmeter.ask('meas?')
            lev1_flt = float((lev1.split(' '))[0])
            i += 1
            # time.sleep(0.1)

        if lev1_flt < -1.0:
            lev1_flt = -1.0

        i = 0
        self._levelmeter.write('chan 1')
        lev2 = self._levelmeter.ask('meas?')
        lev2_flt = float((lev2.split(' '))[0])
        while lev2_flt < 1.0 and i < MAXLVLTRIES:
            self._levelmeter.write('chan 1')
            self._levelmeter.write('meas')

            # TODO make sure readout is actually finished

            lev2 = self._levelmeter.ask('meas?')
            lev2_flt = float((lev2.split(' '))[0])
            i += 1
            # time.sleep(0.1)

        if lev2_flt < -1.0:
            lev2_flt = -1.0

        t_num = time.time()
        t_str = time.asctime()

        self._rate_times.append((t_num - self._T0) / 3600.)
        self._rate_levels1.append(lev1_flt)
        self._rate_levels2.append(lev2_flt)
        i = 0
        while self._rate_times[i] < ((
            (t_num - self._T0) / 3600.) - self._rate_update_interval):
            self._rate_times = self._rate_times[1:]
            self._rate_levels1 = self._rate_levels1[1:]
            self._rate_levels2 = self._rate_levels2[1:]

        if len(self._rate_times) > 1:
            rate1 = (self._rate_levels1[0] - self._rate_levels1[-1]) / (
                self._rate_times[-1] - self._rate_times[0])
            rate2 = (self._rate_levels2[0] - self._rate_levels2[-1]) / (
                self._rate_times[-1] - self._rate_times[0])
        else:
            rate1 = 0
            rate2 = 0

        print('current time: %s' % t_str)
        print('current cryovac levelmeter reading:')
        print('  LHe1 (upper tank): %s' % (lev1))
        print('  LHe2 (lower tank): %s' % (lev2))

        volt = 'n/a'
        keith_meas = self._keithley.ask(':func?')
        if keith_meas == '"VOLT:DC"':
            volt = float(self._keithley.ask(':data?'))
            print('current sensor voltage: %.3f' % (volt))
            print('current temperature: %.3f' % (self.get_temperature()))

        if self.get_save_data():
            try:
                with open(
                        '//tudelft.net/staff-groups/tnw/ns/qt/Diamond/setups/LT2/cryo.txt',
                        'a') as f:
                    f.write('%.0f\t%s\t%s\t%s\t%.3f V\n' %
                            (t_num, t_str, lev1, lev2, volt))
                    f.close()
            except Exception:
                print ' error writing on network disk'

        if self.get_send_email():
            try:
                params = urllib.urlencode({
                    'entry_312373567': lev1,
                    'entry_941467047': lev2,
                    'ss-submit': 'Submit'
                })
                urllib.urlopen(
                    'https://docs.google.com/forms/d/1T0ZY1G08LPWRn3M_-yq--PAdrz_8LtqzQJn9AL3qZVs/formResponse',
                    params)
            except Exception:
                print ' error publishing levels'

        if (lev2_flt < self.get_he2_lvl_min()) or (
                volt != 'n/a' and volt < self.get_temp_voltage_min()) or (
                    -0.1 < lev1_flt < self.get_he1_lvl_min()):
            subject = 'Warning from Cryo LT2!'
            message = 'Warning from Cryo LT2: Measured levels: \n'+\
                      'current cryovac levelmeter reading:\n' + \
                      '  LHe1 (upper tank): %s'%(lev1) + '\n' + \
                      '  LHe2 (lower tank): %s'%(lev2) + '\n' + \
                      'current sensor voltage: %.3f'%(volt) + '.\n' + \
                      'current temperature:  %.3f'%(self.get_temperature()) + '.\n' + \
                      'This is below minimum values (LHe2 < %.3f'%(self.get_he2_lvl_min()) + ' cm'+ ', LHe1 < %.3f'%(self.get_he1_lvl_min()) +\
                      ', voltage < %.3f'%(self.get_temp_voltage_min()) + 'V ( = 6 K)). \n' + \
                      'Please help me!!!\n xxx LT2'
            recipients = [
                '*****@*****.**', '*****@*****.**',
                '*****@*****.**', '*****@*****.**',
                '*****@*****.**', '*****@*****.**'
            ]
            #recipients  = '*****@*****.**'
            print message
            if self.get_send_email():
                if self._mailer.send_email(recipients, subject, message):
                    print 'Warning email message sent'

        if self._monitor_lt1:
            temp_A = self._temp_lt1.get_kelvinA()
            temp_B = self._temp_lt1.get_kelvinB()
            print('LT1 temperature A: %.3f K' % (temp_A))
            print('LT1 temperature B: %.3f K' % (temp_B))

            if self.get_save_data():
                with open(
                        '//tudelft.net/staff-groups/tnw/ns/qt/Diamond/setups/LT1/cryo.txt',
                        'a') as f:
                    f.write('%.0f\t%s\t%.3f K\t%.3f K \n' %
                            (t_num, t_str, temp_A, temp_B))
                    f.close()
            if temp_A > self.get_lt1_temp_A_max():

                subject = 'Warning from Cryo LT1!'
                message = 'Warning from Cryo LT1: \n'+\
                          'LT1 temperature A: %.3f K'%(temp_A) + '\n'+\
                          'LT1 temperature B: %.3f K'%(temp_B) + '\n'+\
                          'This is below minimum value (temp_A < %.3f)' %(self.get_lt1_temp_A_max()) + ' K \n'+\
                          'Please help me!!!\n xxx LT1'
                recipients = [
                    '*****@*****.**', '*****@*****.**',
                    '*****@*****.**', '*****@*****.**',
                    '*****@*****.**'
                ]
                if temp_A > self.get_lt1_temp_A_max() + 3:
                    subject = subject + ' - LT1 WARMING UP!!!'
                    self.warmup_lt1()
                #recipients  = '*****@*****.**'
                print message
                if self.get_send_email():
                    if self._mailer.send_email(recipients, subject, message):
                        print 'Warning email message sent'

            if self.get_recording():
                self._data.add_data_point(
                    (t_num - self._T0) / 3600., lev1_flt, lev2_flt,
                    self.get_temperature(), rate1, rate2, temp_A, temp_B)
        else:
            if self.get_recording():
                self._data.add_data_point((t_num - self._T0) / 3600.,
                                          lev1_flt, lev2_flt,
                                          self.get_temperature(), rate1, rate2)

        return True
コード例 #8
0
ファイル: monitor_cryo.py プロジェクト: caizikun/measurement
    def __init__(self, name, monitor_lt1=False, **kw):

        MonitorInstrument.__init__(self, name)
        rm = visa.ResourceManager()
        self._levelmeter = rm.open_resource('GPIB::8::INSTR')
        self._keithley = rm.open_resource('GPIB::11::INSTR')
        self._mailer = qt.instruments['gmailer']

        self._keithleyMM = qt.instruments['keithleyMM']

        self._monitor_lt1 = monitor_lt1
        if monitor_lt1:
            self._temp_lt1 = qt.instruments['TemperatureController_lt1']
            self._lt1_positioner = qt.instruments['AttoPositioner_lt1']
            self._adwin_lt1 = qt.instruments['adwin_lt1']

        self.add_parameter('he2_lvl_min',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='cm')

        self.add_parameter('he1_lvl_min',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='cm')

        self.add_parameter('temp_voltage_min',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='V')

        self.add_parameter('lt1_temp_A_max',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='K')

        self.add_parameter('temperature',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GET,
                           units='K')

        self.add_parameter('recording', type=types.BooleanType)

        self.add_function('restart_recording')

        #
        self.set_he2_lvl_min(0.5)  #cm corr to about 1 hour response time
        self.set_he1_lvl_min(1.0)  #cm corr to about 1 hour response time
        self.set_temp_voltage_min(1.5)  #1.5 V corr to T > 6 K
        self.set_lt1_temp_A_max(7.0)
        self._recording = False
        self.set_recording(True)

        # load the temperature calibration from file
        try:
            self.temp_calib = np.loadtxt(
                os.path.join(qt.config['execdir'], '..', 'measurement',
                             'calib', 'DT-670.txt'))
        except:
            print "could not get T-calibration data."
            self.temp_calib = None

#override from config:
        self._parlist.extend(
            ['he2_lvl_min', 'temp_voltage_min', 'lt1_temp_A_max'])
        self.load_cfg()
        self.save_cfg()