Exemple #1
0
	def startmeasurement(self):		
		useinstruments.createinstruments(self.listsettings[0])

		print 'All instruments loaded.'

		measurementvectors.createvectors(self.listsettings[0])
		measurementvectors.createdatafile(self.listsettings[0])
		useinstruments.initinstruments(self.listsettings[0],measurementvectors.v_dac,measurementvectors.v_vec,measurementvectors.instrument_array)
		measurementvectors.createplots(self.listsettings[0])

		qt.mstart()
		
		print 'measurement started...'				
		measurementvectors.measurementloop(self.listsettings[0])
		useinstruments.rampback(self.listsettings[0])				
		print 'measurement finished!'
		print 'ALL other Voltages and Fields hanging at last value'

		qt.mend()
		self.delete_from_waitinglist()
Exemple #2
0
    def startmeasurement(self):
        useinstruments.createinstruments(self.listsettings[0])

        print 'All instruments loaded.'

        measurementvectors.createvectors(self.listsettings[0])
        measurementvectors.createdatafile(self.listsettings[0])
        useinstruments.initinstruments(self.listsettings[0],
                                       measurementvectors.v_dac,
                                       measurementvectors.v_vec,
                                       measurementvectors.instrument_array)
        measurementvectors.createplots(self.listsettings[0])

        qt.mstart()

        print 'measurement started...'
        measurementvectors.measurementloop(self.listsettings[0])
        useinstruments.rampback(self.listsettings[0])
        print 'measurement finished!'
        print 'ALL other Voltages and Fields hanging at last value'

        qt.mend()
        self.delete_from_waitinglist()
Exemple #3
0
	def on_measure_clicked(self,widget):

		from numpy import pi, random, arange, size		
		# Get entries and save them. Then DONT close the input-window.
		self.blank_activate()
		initgui.get_entries(self.xml,self.settings)
		self.pkl_out_file = open('cleanlastsettings.pkl', 'wb')
		pickle.dump(self.settings, self.pkl_out_file)
		self.pkl_out_file.close()

		if self.settings['number_of_measurements']==0:
			print 'no measurement selected'
				
##		self.checkMW = self.settings['checkMW']
##		self.checkRF1 = self.settings['checkRF1']		
##		self.checkRF2 = self.settings['checkRF2']
##		self.checkMag = self.settings['checkMag']
##		self.checkTemp = self.settings['checkTemp']
##		self.checkLaser = self.settings['checkLaser']		

		# Create instruments 'dac' used as a general term, can be time/field etc
##		print 'loading instruments...'
####		self.ivvi = qt.instruments.create('ivvi','IVVI',address='COM1')
##		print 'dacs OK'
####		self.NIDev1 = qt.instruments.create('NIDev1','NI_DAQ',id='Dev1',samples=self.settings['num_samples'],freq=self.settings['samplerate'])
##		print 'adcs OK'

		useinstruments.createinstruments(self.settings)
		
##		if self.checkRF1:
##			try:
##				print self.HPPulse1.get_all()
##			except:
##				print 'Pulser 1 not set up yet...'
##				self.HPPulse1 = qt.instruments.create('HPPulse1','HP_8131A',address=self.settings['addr1'],reset=False)
##			print 'Pulser 1 OK'
##
##		if self.checkRF2:
##			try:
##				print self.HPPulse2.get_all()
##			except:
##				print 'Pulser 2 not set up yet...'
##				self.HPPulse2 = qt.instruments.create('HPPulse2','HP_8131A',address=self.settings['addr2'],reset=False)
##			print 'Pulser 2 OK'
##
##		if self.checkMW:
##			try:
##				print self.MWgen.get_all()
##			except:
##				print 'MW generator not set up yet...'
##				self.MWgen = qt.instruments.create('MWgen','Agilent_E8257C',address=self.settings['addr3'],reset=False)
##			print 'MW generator OK'
##			
##		if self.checkMag:
##			try:
##				print self.OXMag.get_all()
##			except:
##				print 'Magnet not set up yet...'
##				self.OXMag = qt.instruments.create('OXMag','OxfordInstruments_IPS120',address=self.settings['addr4'])
##			print 'Magnet OK'
##
##		if self.checkTemp:
##			##try:
##				##print self.OXtemp.get_all()
##			##except:
##				##print 'Instrument not set up yet...'
##				##self.OXtemp = qt.instruments.create('?','?',address=self.settings['addr5'])
##			print 'Temperature controller cannot be used at the moment'
##
##		if self.checkLaser:
##			try:
##				print self.jdsu.get_all()
##			except:
##				print 'Laser not set up yet...'
##				self.jdsu = qt.instruments.create('jdsu','JDSU_SWS15101',address=self.settings['addr6'])
##			print 'Laser OK'

		print 'All instruments loaded.'

		#initialise things
##		if self.checkMag:
##			self.OXMag.init_magnet(min(self.settings['magrate'],1))	#specify sweeprate in T/min	hardlimit of 1T/min

		#!! DONT Ramp all dacs back to zero!!
		
##		pauseT1 = float(self.settings['pause1'])
##		pauseT2 = float(self.settings['pause2'])
##
##		CurrentLim = float(self.settings['current_lim'])

		measurementvectors.createvectors(self.settings)
				
## 		v_dac = []
## 		v_vec = []
##		number_of_sweeps = self.settings['number_of_sweeps']
##		number_of_inputs = self.settings['number_of_measurements']
##
##		# Set gain		
##		self.I_gain = []
##		for idx in range(3):
##			if self.settings['input'][idx] != 0:
##				self.I_gain.append(float(self.settings['inputgain'][idx]))
##			else:
##				self.I_gain.append('none')
##
##		#Create measurement vectors for dacs		
##		for idx in range(16):
##			print self.settings['outputdac'][idx]
##			if self.settings['dynamic'][idx] != 0:
##				v_dac.append('dac%d' % self.settings['outputdac'][idx])
##				incrval = abs(float(self.settings['incr'][idx]))
##				if float(self.settings['start'][idx]) - float(self.settings['stop'][idx]) > 0:
##					incrval = -1*incrval
##				v_vec.append(arange(float(self.settings['start'][idx]),float(self.settings['stop'][idx])+0.01*incrval,incrval))
##			elif self.settings['outputdac'][idx] != 0:
##				v_dac.append('dac%d' % self.settings['outputdac'][idx])
##				v_vec.append(float(self.settings['start'][idx]))
##			else:
##				v_dac.append('dac0')
##				v_vec.append([0])
##
##		instrument_array= []
##		vector_array= []
##		label_array= []
##			
##		for idx in range(number_of_sweeps):
##			for jdx in range(16):
##				if self.settings['order'][jdx] == '%d' % (idx+1):
##					instrument_array.append(v_dac[jdx])
##					vector_array.append(v_vec[jdx])
##					label_array.append(self.settings['outputlabel'][jdx])

		# Next a new data object is made.
		# The file will be placed in the folder:
		# <datadir>/<datestamp>/<timestamp>_testmeasurement/
		# and will be called:
		# <timestamp>_testmeasurement.dat
		# to find out what 'datadir' is set to, type: qt.config.get('datadir')

		measurementvectors.createdatafile(self.settings)
		
##		data = qt.Data(name=self.settings['filename'])
##
##		# Now you provide the information of what data will be saved in the
##		# datafile. A distinction is made between 'coordinates', and 'values'.
##		# Coordinates are the parameters that you sweep, values are the
##		# parameters that you readout (the result of an experiment). This
##		# information is used later for plotting purposes.
##		# Adding coordinate and value info is optional, but recommended.
##		# If you don't supply it, the data class will guess your data format.
##
##		for idx in range (self.settings['number_of_sweeps']):		
##			data.add_coordinate(name=measurementvectors.label_array[idx])
##		for idx in range (3):
##			if self.settings['input'][idx]!=0:
##				data.add_value(name=self.settings['inputlabel'][idx])
##			else:
##				data.add_value(name='no measurement')

		useinstruments.initinstruments(self.settings,measurementvectors.v_dac,measurementvectors.v_vec,measurementvectors.instrument_array)

##		for idx,dac in enumerate(v_dac):
##			if idx > (number_of_dynamic_dacs-1):
##				self.execute_set(dac,v_vec[idx])				print v_vec[idx]
##			else:
##				self.execute_set(dac,v_vec[idx][0])				print v_vec[idx][0]
		
		

##		if self.checkRF1:
##			self.HPPulse1.on(1)
##			self.HPPulse1.on(2)
##		if self.checkRF2:
##			self.HPPulse2.on(1)
##		if self.checkMW:
##			self.MWgen.on()
##		if self.checkMag:
##			heateroff = True
##			for idx in range(number_of_sweeps):
##				if instrument_array[idx] == ('dac%d' % instrumentsused.Magpos):
##					heateroff = False
##			# Switch heater off if magnet is not swept
##			if heateroff:
##				if self.OXMag.get_switch_heater() == 1:
##						self.OXMag.set_switch_heater(0)
##		if self.checkTemp:
			
##		if self.checkLaser:
			
		measurementvectors.createplots(self.settings)

##
##		# The next command will actually create the dirs and files, based
##		# on the information provided above. Additionally a settingsfile
##		# is created containing the current settings of all the instruments.
##
##		data.create_file()
##
##		# Next two plot-objects are created. First argument is the data object
##		# that needs to be plotted. To prevent new windows from popping up each
##		# measurement a 'name' can be provided so that window can be reused.
##		# If the 'name' doesn't already exists, a new window with that name
##		# will be created. For 3d plots, a plotting style is set.
##		
##		if self.settings['plot2d'][0] and self.settings['input'][0]!=0:
##			self.plot2d1=(qt.Plot2D(data, name='measure2D_1', coorddim=0, valdim=number_of_sweeps, maxtraces=2))
##		if self.settings['plot3d'][0] and number_of_sweeps > 1 and self.settings['input'][0]!=0:
##			self.plot3d1=(qt.Plot3D(data, name='measure3D_1', coorddims=(0,1), valdim=number_of_sweeps, style='image'))
##		if self.settings['plot2d'][1] and self.settings['input'][1]!=0:
##			self.plot2d2 = qt.Plot2D(data, name='measure2D_2', coorddim=0, valdim=number_of_sweeps+1, maxtraces=2)
##		if self.settings['plot3d'][1] and number_of_sweeps > 1 and self.settings['input'][1]!=0:
##			self.plot3d2 = qt.Plot3D(data, name='measure3D_2', coorddim=(0,1), valdim=number_of_sweeps+1, style='image')
##		if self.settings['plot2d'][2] and self.settings['input'][2]!=0:
##			self.plot2d3 = qt.Plot2D(data, name='measure2D_3', coorddim=0, valdim=number_of_sweeps+2, maxtraces=2)
##		if self.settings['plot3d'][2] and number_of_sweeps > 1 and self.settings['input'][2]!=0:
##			self.plot3d3 = qt.Plot3D(data, name='measure3D_3', coorddim=(0,1), valdim=number_of_sweeps+2, style='image')
##		
		qt.mstart()
		print 'measurement started...'				

		# preparation is done, now start the measurement.

		print 'BUGFIX: press ctrl-c once if graph not seen on first run'

		measurementvectors.measurementloop(self.settings)
		
##		number_of_traces = 1		
##		for idx in range(self.settings['number_of_sweeps']-1):
##			number_of_traces = number_of_traces*len(measurementvectors.vector_array[idx+1])
##
##		print('total number of traces: %d' %(number_of_traces))
##		total_traces=number_of_traces
##		starttime = time.time()		
##						
##		for v1 in vector_array[number_of_sweeps-1]:
####			execute_set(instrument_array[number_of_sweeps-1],v1)
##			if number_of_sweeps > 1:
##				for v2 in vector_array[number_of_sweeps-2]:
####					execute_set(instrument_array[number_of_sweeps-2],v2)
##					if number_of_sweeps > 2:
##						for v3 in vector_array[number_of_sweeps-3]:
####							execute_set(instrument_array[number_of_sweeps-3],v3)
##							if number_of_sweeps > 3:
##								for v4 in vector_array[number_of_sweeps-4]:
####									execute_set(instrument_array[number_of_sweeps-2],v4)
##									if number_of_sweeps > 4:
##										for v5 in vector_array[number_of_sweeps-5]:
####											execute_set(instrument_array[number_of_sweeps-5],v5)
##											self.measure_inputs()
##											data.add_data_point(v5,v4,v3,v2,v1,self.result[0],self.result[1],self.result[2])
##											self.update_2d_plots()
##											sleep(pauseT2)
##										data.new_block()
##										self.update_3d_plots()
##										sleep(pauseT1)
##										totaltime= number_of_traces*(time.time()-starttime)/(total_traces-number_of_traces+1)
##										print ('Time of measurement left: %d hours, %d minutes and %d seconds' %(floor(totaltime/3600),floor(fmod(totaltime,3600)/60),fmod(totaltime,60)))
##										number_of_traces= number_of_traces-1
##									else:
##										self.measure_inputs()
##										data.add_data_point(v4,v3,v2,v1,self.result[0],self.result[1],self.result[2])
##										self.update_2d_plots()
##										sleep(pauseT2)
##								if number_of_sweeps==4:
##									data.new_block()
##									self.update_3d_plots()
##									sleep(pauseT1)
##									totaltime= number_of_traces*(time.time()-starttime)/(total_traces-number_of_traces+1)
##									print ('Time of measurement left: %d hours, %d minutes and %d seconds' %(floor(totaltime/3600),floor(fmod(totaltime,3600)/60),fmod(totaltime,60)))
##									number_of_traces= number_of_traces-1
##							else:
##								self.measure_inputs()
##								data.add_data_point(v3,v2,v1,self.result[0],self.result[1],self.result[2])
##								self.update_2d_plots()
##								sleep(pauseT2)
##						if number_of_sweeps==3:
##							data.new_block()
##							self.update_3d_plots()
##							sleep(pauseT1)
##							totaltime= number_of_traces*(time.time()-starttime)/(total_traces-number_of_traces+1)
##							print ('Time of measurement left: %d hours, %d minutes and %d seconds' %(floor(totaltime/3600),floor(fmod(totaltime,3600)/60),fmod(totaltime,60)))
##							number_of_traces= number_of_traces-1
##					else:
##						self.measure_inputs()
##						data.add_data_point(v2,v1,self.result[0],self.result[1],self.result[2])
##						self.update_2d_plots()
##						sleep(pauseT2)
##				if number_of_sweeps==2:
##					data.new_block()
##					self.update_3d_plots()
##					sleep(pauseT1)
##					totaltime= number_of_traces*(time.time()-starttime)/(total_traces-number_of_traces+1)
##					print ('Time of measurement left: %d hours, %d minutes and %d seconds' %(floor(totaltime/3600),floor(fmod(totaltime,3600)/60),fmod(totaltime,60)))
##					number_of_traces= number_of_traces-1
##			else:
##				self.measure_inputs()
##				data.add_data_point(v1,self.result[0],self.result[1],self.result[2])
##				self.update_2d_plots()
##				sleep(pauseT2)
##
##		if self.settings['plot2d'][0] and self.settings['input'][0]!=0:		
##			plot2d1_end = qt.Plot2D(data, name='measure2D1_end', coorddim=0, valdim=number_of_sweeps, maxpoints=1e6 ,maxtraces=1e3)
##			plot2d1_end.update()
##		if self.settings['plot2d'][1] and self.settings['input'][1]!=0:		
##			plot2d2_end = qt.Plot2D(data, name='measure2D2_end', coorddim=0, valdim=number_of_sweeps+1, maxpoints=1e6 ,maxtraces=1e3)
##			plot2d2_end.update()
##		if self.settings['plot2d'][2] and self.settings['input'][2]!=0:		
##			plot2d3_end = qt.Plot2D(data, name='measure2D3_end', coorddim=0, valdim=number_of_sweeps+2, maxpoints=1e6 ,maxtraces=1e3)
##			plot2d3_end.update()

##
##		# after the measurement ends, you need to close the data file.
##
##		data.close_file()
##
##		if self.settings['plot2d'][0] and self.settings['input'][0]!=0:
##			plot2d1_end.save_png()
##		if self.settings['plot2d'][1] and self.settings['input'][1]!=0:
##			plot2d2_end.save_png()
##		if self.settings['plot2d'][2] and self.settings['input'][2]!=0:
##			plot2d3_end.save_png()
##		if self.settings['plot3d'][0] and self.settings['input'][0]!=0:
##			self.plot3d1.save_png()
##		if self.settings['plot3d'][1] and self.settings['input'][1]!=0:
##			self.plot3d2.save_png()
##		if self.settings['plot3d'][2] and self.settings['input'][2]!=0:
##			self.plot3d3.save_png()
			
		#!DONT ramp dacs back to zero!

		useinstruments.rampback(self.settings)				
##		if self.checkMW:
##			self.MWgen.off()
##			sleep(0.1)
##
##		if self.checkRF1:
##			pass
##			#self.HPPulse1.off()
##
##		if self.checkRF2:
##			#self.HPPulse2.off(1)
##			pass
##
##		if self.checkMag:
##			if self.OXMag.get_switch_heater() == 1:
##				self.OXMag.set_switch_heater(0)	

		print 'measurement finished!'
		
		print 'ALL other Voltages and Fields hanging at last value'

		qt.mend()
Exemple #4
0
    def on_measure_clicked(self, widget):

        from numpy import pi, random, arange, size
        # Get entries and save them. Then DONT close the input-window.
        self.blank_activate()
        initgui.get_entries(self.xml, self.settings)
        self.pkl_out_file = open('cleanlastsettings.pkl', 'wb')
        pickle.dump(self.settings, self.pkl_out_file)
        self.pkl_out_file.close()

        if self.settings['number_of_measurements'] == 0:
            print 'no measurement selected'

##		self.checkMW = self.settings['checkMW']
##		self.checkRF1 = self.settings['checkRF1']
##		self.checkRF2 = self.settings['checkRF2']
##		self.checkMag = self.settings['checkMag']
##		self.checkTemp = self.settings['checkTemp']
##		self.checkLaser = self.settings['checkLaser']

# Create instruments 'dac' used as a general term, can be time/field etc
##		print 'loading instruments...'
####		self.ivvi = qt.instruments.create('ivvi','IVVI',address='COM1')
##		print 'dacs OK'
####		self.NIDev1 = qt.instruments.create('NIDev1','NI_DAQ',id='Dev1',samples=self.settings['num_samples'],freq=self.settings['samplerate'])
##		print 'adcs OK'

        useinstruments.createinstruments(self.settings)

        ##		if self.checkRF1:
        ##			try:
        ##				print self.HPPulse1.get_all()
        ##			except:
        ##				print 'Pulser 1 not set up yet...'
        ##				self.HPPulse1 = qt.instruments.create('HPPulse1','HP_8131A',address=self.settings['addr1'],reset=False)
        ##			print 'Pulser 1 OK'
        ##
        ##		if self.checkRF2:
        ##			try:
        ##				print self.HPPulse2.get_all()
        ##			except:
        ##				print 'Pulser 2 not set up yet...'
        ##				self.HPPulse2 = qt.instruments.create('HPPulse2','HP_8131A',address=self.settings['addr2'],reset=False)
        ##			print 'Pulser 2 OK'
        ##
        ##		if self.checkMW:
        ##			try:
        ##				print self.MWgen.get_all()
        ##			except:
        ##				print 'MW generator not set up yet...'
        ##				self.MWgen = qt.instruments.create('MWgen','Agilent_E8257C',address=self.settings['addr3'],reset=False)
        ##			print 'MW generator OK'
        ##
        ##		if self.checkMag:
        ##			try:
        ##				print self.OXMag.get_all()
        ##			except:
        ##				print 'Magnet not set up yet...'
        ##				self.OXMag = qt.instruments.create('OXMag','OxfordInstruments_IPS120',address=self.settings['addr4'])
        ##			print 'Magnet OK'
        ##
        ##		if self.checkTemp:
        ##			##try:
        ##				##print self.OXtemp.get_all()
        ##			##except:
        ##				##print 'Instrument not set up yet...'
        ##				##self.OXtemp = qt.instruments.create('?','?',address=self.settings['addr5'])
        ##			print 'Temperature controller cannot be used at the moment'
        ##
        ##		if self.checkLaser:
        ##			try:
        ##				print self.jdsu.get_all()
        ##			except:
        ##				print 'Laser not set up yet...'
        ##				self.jdsu = qt.instruments.create('jdsu','JDSU_SWS15101',address=self.settings['addr6'])
        ##			print 'Laser OK'

        print 'All instruments loaded.'

        #initialise things
        ##		if self.checkMag:
        ##			self.OXMag.init_magnet(min(self.settings['magrate'],1))	#specify sweeprate in T/min	hardlimit of 1T/min

        #!! DONT Ramp all dacs back to zero!!

        ##		pauseT1 = float(self.settings['pause1'])
        ##		pauseT2 = float(self.settings['pause2'])
        ##
        ##		CurrentLim = float(self.settings['current_lim'])

        measurementvectors.createvectors(self.settings)

        ## 		v_dac = []
        ## 		v_vec = []
        ##		number_of_sweeps = self.settings['number_of_sweeps']
        ##		number_of_inputs = self.settings['number_of_measurements']
        ##
        ##		# Set gain
        ##		self.I_gain = []
        ##		for idx in range(3):
        ##			if self.settings['input'][idx] != 0:
        ##				self.I_gain.append(float(self.settings['inputgain'][idx]))
        ##			else:
        ##				self.I_gain.append('none')
        ##
        ##		#Create measurement vectors for dacs
        ##		for idx in range(16):
        ##			print self.settings['outputdac'][idx]
        ##			if self.settings['dynamic'][idx] != 0:
        ##				v_dac.append('dac%d' % self.settings['outputdac'][idx])
        ##				incrval = abs(float(self.settings['incr'][idx]))
        ##				if float(self.settings['start'][idx]) - float(self.settings['stop'][idx]) > 0:
        ##					incrval = -1*incrval
        ##				v_vec.append(arange(float(self.settings['start'][idx]),float(self.settings['stop'][idx])+0.01*incrval,incrval))
        ##			elif self.settings['outputdac'][idx] != 0:
        ##				v_dac.append('dac%d' % self.settings['outputdac'][idx])
        ##				v_vec.append(float(self.settings['start'][idx]))
        ##			else:
        ##				v_dac.append('dac0')
        ##				v_vec.append([0])
        ##
        ##		instrument_array= []
        ##		vector_array= []
        ##		label_array= []
        ##
        ##		for idx in range(number_of_sweeps):
        ##			for jdx in range(16):
        ##				if self.settings['order'][jdx] == '%d' % (idx+1):
        ##					instrument_array.append(v_dac[jdx])
        ##					vector_array.append(v_vec[jdx])
        ##					label_array.append(self.settings['outputlabel'][jdx])

        # Next a new data object is made.
        # The file will be placed in the folder:
        # <datadir>/<datestamp>/<timestamp>_testmeasurement/
        # and will be called:
        # <timestamp>_testmeasurement.dat
        # to find out what 'datadir' is set to, type: qt.config.get('datadir')

        measurementvectors.createdatafile(self.settings)

        ##		data = qt.Data(name=self.settings['filename'])
        ##
        ##		# Now you provide the information of what data will be saved in the
        ##		# datafile. A distinction is made between 'coordinates', and 'values'.
        ##		# Coordinates are the parameters that you sweep, values are the
        ##		# parameters that you readout (the result of an experiment). This
        ##		# information is used later for plotting purposes.
        ##		# Adding coordinate and value info is optional, but recommended.
        ##		# If you don't supply it, the data class will guess your data format.
        ##
        ##		for idx in range (self.settings['number_of_sweeps']):
        ##			data.add_coordinate(name=measurementvectors.label_array[idx])
        ##		for idx in range (3):
        ##			if self.settings['input'][idx]!=0:
        ##				data.add_value(name=self.settings['inputlabel'][idx])
        ##			else:
        ##				data.add_value(name='no measurement')

        useinstruments.initinstruments(self.settings, measurementvectors.v_dac,
                                       measurementvectors.v_vec,
                                       measurementvectors.instrument_array)

        ##		for idx,dac in enumerate(v_dac):
        ##			if idx > (number_of_dynamic_dacs-1):
        ##				self.execute_set(dac,v_vec[idx])				print v_vec[idx]
        ##			else:
        ##				self.execute_set(dac,v_vec[idx][0])				print v_vec[idx][0]

        ##		if self.checkRF1:
        ##			self.HPPulse1.on(1)
        ##			self.HPPulse1.on(2)
        ##		if self.checkRF2:
        ##			self.HPPulse2.on(1)
        ##		if self.checkMW:
        ##			self.MWgen.on()
        ##		if self.checkMag:
        ##			heateroff = True
        ##			for idx in range(number_of_sweeps):
        ##				if instrument_array[idx] == ('dac%d' % instrumentsused.Magpos):
        ##					heateroff = False
        ##			# Switch heater off if magnet is not swept
        ##			if heateroff:
        ##				if self.OXMag.get_switch_heater() == 1:
        ##						self.OXMag.set_switch_heater(0)
        ##		if self.checkTemp:

        ##		if self.checkLaser:

        measurementvectors.createplots(self.settings)

        ##
        ##		# The next command will actually create the dirs and files, based
        ##		# on the information provided above. Additionally a settingsfile
        ##		# is created containing the current settings of all the instruments.
        ##
        ##		data.create_file()
        ##
        ##		# Next two plot-objects are created. First argument is the data object
        ##		# that needs to be plotted. To prevent new windows from popping up each
        ##		# measurement a 'name' can be provided so that window can be reused.
        ##		# If the 'name' doesn't already exists, a new window with that name
        ##		# will be created. For 3d plots, a plotting style is set.
        ##
        ##		if self.settings['plot2d'][0] and self.settings['input'][0]!=0:
        ##			self.plot2d1=(qt.Plot2D(data, name='measure2D_1', coorddim=0, valdim=number_of_sweeps, maxtraces=2))
        ##		if self.settings['plot3d'][0] and number_of_sweeps > 1 and self.settings['input'][0]!=0:
        ##			self.plot3d1=(qt.Plot3D(data, name='measure3D_1', coorddims=(0,1), valdim=number_of_sweeps, style='image'))
        ##		if self.settings['plot2d'][1] and self.settings['input'][1]!=0:
        ##			self.plot2d2 = qt.Plot2D(data, name='measure2D_2', coorddim=0, valdim=number_of_sweeps+1, maxtraces=2)
        ##		if self.settings['plot3d'][1] and number_of_sweeps > 1 and self.settings['input'][1]!=0:
        ##			self.plot3d2 = qt.Plot3D(data, name='measure3D_2', coorddim=(0,1), valdim=number_of_sweeps+1, style='image')
        ##		if self.settings['plot2d'][2] and self.settings['input'][2]!=0:
        ##			self.plot2d3 = qt.Plot2D(data, name='measure2D_3', coorddim=0, valdim=number_of_sweeps+2, maxtraces=2)
        ##		if self.settings['plot3d'][2] and number_of_sweeps > 1 and self.settings['input'][2]!=0:
        ##			self.plot3d3 = qt.Plot3D(data, name='measure3D_3', coorddim=(0,1), valdim=number_of_sweeps+2, style='image')
        ##
        qt.mstart()
        print 'measurement started...'

        # preparation is done, now start the measurement.

        print 'BUGFIX: press ctrl-c once if graph not seen on first run'

        measurementvectors.measurementloop(self.settings)

        ##		number_of_traces = 1
        ##		for idx in range(self.settings['number_of_sweeps']-1):
        ##			number_of_traces = number_of_traces*len(measurementvectors.vector_array[idx+1])
        ##
        ##		print('total number of traces: %d' %(number_of_traces))
        ##		total_traces=number_of_traces
        ##		starttime = time.time()
        ##
        ##		for v1 in vector_array[number_of_sweeps-1]:
        ####			execute_set(instrument_array[number_of_sweeps-1],v1)
        ##			if number_of_sweeps > 1:
        ##				for v2 in vector_array[number_of_sweeps-2]:
        ####					execute_set(instrument_array[number_of_sweeps-2],v2)
        ##					if number_of_sweeps > 2:
        ##						for v3 in vector_array[number_of_sweeps-3]:
        ####							execute_set(instrument_array[number_of_sweeps-3],v3)
        ##							if number_of_sweeps > 3:
        ##								for v4 in vector_array[number_of_sweeps-4]:
        ####									execute_set(instrument_array[number_of_sweeps-2],v4)
        ##									if number_of_sweeps > 4:
        ##										for v5 in vector_array[number_of_sweeps-5]:
        ####											execute_set(instrument_array[number_of_sweeps-5],v5)
        ##											self.measure_inputs()
        ##											data.add_data_point(v5,v4,v3,v2,v1,self.result[0],self.result[1],self.result[2])
        ##											self.update_2d_plots()
        ##											sleep(pauseT2)
        ##										data.new_block()
        ##										self.update_3d_plots()
        ##										sleep(pauseT1)
        ##										totaltime= number_of_traces*(time.time()-starttime)/(total_traces-number_of_traces+1)
        ##										print ('Time of measurement left: %d hours, %d minutes and %d seconds' %(floor(totaltime/3600),floor(fmod(totaltime,3600)/60),fmod(totaltime,60)))
        ##										number_of_traces= number_of_traces-1
        ##									else:
        ##										self.measure_inputs()
        ##										data.add_data_point(v4,v3,v2,v1,self.result[0],self.result[1],self.result[2])
        ##										self.update_2d_plots()
        ##										sleep(pauseT2)
        ##								if number_of_sweeps==4:
        ##									data.new_block()
        ##									self.update_3d_plots()
        ##									sleep(pauseT1)
        ##									totaltime= number_of_traces*(time.time()-starttime)/(total_traces-number_of_traces+1)
        ##									print ('Time of measurement left: %d hours, %d minutes and %d seconds' %(floor(totaltime/3600),floor(fmod(totaltime,3600)/60),fmod(totaltime,60)))
        ##									number_of_traces= number_of_traces-1
        ##							else:
        ##								self.measure_inputs()
        ##								data.add_data_point(v3,v2,v1,self.result[0],self.result[1],self.result[2])
        ##								self.update_2d_plots()
        ##								sleep(pauseT2)
        ##						if number_of_sweeps==3:
        ##							data.new_block()
        ##							self.update_3d_plots()
        ##							sleep(pauseT1)
        ##							totaltime= number_of_traces*(time.time()-starttime)/(total_traces-number_of_traces+1)
        ##							print ('Time of measurement left: %d hours, %d minutes and %d seconds' %(floor(totaltime/3600),floor(fmod(totaltime,3600)/60),fmod(totaltime,60)))
        ##							number_of_traces= number_of_traces-1
        ##					else:
        ##						self.measure_inputs()
        ##						data.add_data_point(v2,v1,self.result[0],self.result[1],self.result[2])
        ##						self.update_2d_plots()
        ##						sleep(pauseT2)
        ##				if number_of_sweeps==2:
        ##					data.new_block()
        ##					self.update_3d_plots()
        ##					sleep(pauseT1)
        ##					totaltime= number_of_traces*(time.time()-starttime)/(total_traces-number_of_traces+1)
        ##					print ('Time of measurement left: %d hours, %d minutes and %d seconds' %(floor(totaltime/3600),floor(fmod(totaltime,3600)/60),fmod(totaltime,60)))
        ##					number_of_traces= number_of_traces-1
        ##			else:
        ##				self.measure_inputs()
        ##				data.add_data_point(v1,self.result[0],self.result[1],self.result[2])
        ##				self.update_2d_plots()
        ##				sleep(pauseT2)
        ##
        ##		if self.settings['plot2d'][0] and self.settings['input'][0]!=0:
        ##			plot2d1_end = qt.Plot2D(data, name='measure2D1_end', coorddim=0, valdim=number_of_sweeps, maxpoints=1e6 ,maxtraces=1e3)
        ##			plot2d1_end.update()
        ##		if self.settings['plot2d'][1] and self.settings['input'][1]!=0:
        ##			plot2d2_end = qt.Plot2D(data, name='measure2D2_end', coorddim=0, valdim=number_of_sweeps+1, maxpoints=1e6 ,maxtraces=1e3)
        ##			plot2d2_end.update()
        ##		if self.settings['plot2d'][2] and self.settings['input'][2]!=0:
        ##			plot2d3_end = qt.Plot2D(data, name='measure2D3_end', coorddim=0, valdim=number_of_sweeps+2, maxpoints=1e6 ,maxtraces=1e3)
        ##			plot2d3_end.update()

        ##
        ##		# after the measurement ends, you need to close the data file.
        ##
        ##		data.close_file()
        ##
        ##		if self.settings['plot2d'][0] and self.settings['input'][0]!=0:
        ##			plot2d1_end.save_png()
        ##		if self.settings['plot2d'][1] and self.settings['input'][1]!=0:
        ##			plot2d2_end.save_png()
        ##		if self.settings['plot2d'][2] and self.settings['input'][2]!=0:
        ##			plot2d3_end.save_png()
        ##		if self.settings['plot3d'][0] and self.settings['input'][0]!=0:
        ##			self.plot3d1.save_png()
        ##		if self.settings['plot3d'][1] and self.settings['input'][1]!=0:
        ##			self.plot3d2.save_png()
        ##		if self.settings['plot3d'][2] and self.settings['input'][2]!=0:
        ##			self.plot3d3.save_png()

        #!DONT ramp dacs back to zero!

        useinstruments.rampback(self.settings)
        ##		if self.checkMW:
        ##			self.MWgen.off()
        ##			sleep(0.1)
        ##
        ##		if self.checkRF1:
        ##			pass
        ##			#self.HPPulse1.off()
        ##
        ##		if self.checkRF2:
        ##			#self.HPPulse2.off(1)
        ##			pass
        ##
        ##		if self.checkMag:
        ##			if self.OXMag.get_switch_heater() == 1:
        ##				self.OXMag.set_switch_heater(0)

        print 'measurement finished!'

        print 'ALL other Voltages and Fields hanging at last value'

        qt.mend()