Example #1
0
    def measure_2D(self):
        '''
        measure method to record a (averaged) VNA trace, S11 or S21 according to the setting on the VNA
        for all parameters x_vec in x_obj
        '''

        if not self.x_set_obj:
            logging.error('axes parameters not properly set...aborting')
            return
        self._scan_1D = False
        self._scan_2D = True
        self._scan_3D = False

        if not self.dirname:
            self.dirname = self.x_coordname
        self._file_name = '2D_' + self.dirname.replace(' ', '').replace(',','_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name

        self._p = Progress_Bar(len(self.x_vec),'2D VNA sweep '+self.dirname,self.vna.get_sweeptime())

        self._prepare_measurement_vna()
        self._prepare_measurement_file()

        """opens qviewkit to plot measurement, amp and pha are opened by default"""
        if self._nop < 10:
            qviewkit.plot(self._data_file.get_filepath(), datasets=['amplitude_midpoint', 'phase_midpoint'])
        else:
            qviewkit.plot(self._data_file.get_filepath(), datasets=['amplitude', 'phase'])
        if self._fit_resonator:
            self._resonator = resonator(self._data_file.get_filepath())
        self._measure()
Example #2
0
    def measure_1D2(self):
        '''
        measure full window of vna while sweeping x_set_obj with parameters x_vec
        '''

        if not self.x_set_obj:
            logging.error('axes parameters not properly set...aborting')
            return
        self._scan_1D = False
        self._scan_1D2 = True
        self._scan_2D = False
        self.data_complex = False

        if self.dirname == None:
            self.dirname = self.x_coordname.replace()
        self._file_name = '1D2_' + self.dirname
        if self.exp_name:
            self._file_name += '_' + self.exp_name

        self._p = Progress_Bar(len(self.x_vec),self.dirname)

        self._prepare_measurement_vna()
        if self.save_dat:
            self._prepare_measurement_dat_file()
        if self.save_hdf:
            self._prepare_measurement_hdf_file()
            """opens qviewkit to plot measurement, amp and pha are opened by default"""
            qviewkit.plot(self._data_hdf.get_filepath(), datasets=['amplitude', 'phase'])
            if self._fit_resonator:
                self._resonator = resonator(self._data_hdf)

        self._measure()
        self._end_measurement()
Example #3
0
    def measure_1D(self):
        '''
        measure method to record a single (averaged) VNA trace, S11 or S21 according to the setting on the VNA
        '''
        self._scan_1D = True
        self._scan_2D = False
        self._scan_3D = False

        if not self.dirname:
            self.dirname = 'VNA_tracedata'
        self._file_name = self.dirname.replace(' ', '').replace(',','_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name
        self._prepare_measurement_vna()
        self._prepare_measurement_file()

        """opens qviewkit to plot measurement, amp and pha are opened by default"""
        if self.open_qviewkit:
            qviewkit.plot(self._data_file.get_filepath(), datasets=['amplitude', 'phase'])
        if self._fit_resonator:
            self._resonator = resonator(self._data_file.get_filepath())

        print 'recording trace...'
        sys.stdout.flush()

        qt.mstart()
        self.vna.avg_clear()
        if self.vna.get_averages() == 1 or self.vna.get_Average() == False:   #no averaging
            self._p = Progress_Bar(1,self.dirname,self.vna.get_sweeptime())
            qt.msleep(self.vna.get_sweeptime())      #wait single sweep
            self._p.iterate()
        else:   #with averaging
            self._p = Progress_Bar(self.vna.get_averages(),self.dirname,self.vna.get_sweeptime())
            if "avg_status" in self.vna.get_function_names():
                for a in range(self.vna.get_averages()):
                    while self.vna.avg_status() <= a:
                        qt.msleep(.2) #maybe one would like to adjust this at a later point
                    self._p.iterate()
            else: #old style
                for a in range(self.vna.get_averages()):
                    qt.msleep(self.vna.get_sweeptime())      #wait single sweep time
                    self._p.iterate()

        data_amp, data_pha = self.vna.get_tracedata()
        data_real, data_imag = self.vna.get_tracedata('RealImag')

        self._data_amp.append(data_amp)
        self._data_pha.append(data_pha)
        self._data_real.append(data_real)
        self._data_imag.append(data_imag)
        if self._fit_resonator:
            self._do_fit_resonator()

        qt.mend()
        self._end_measurement()
Example #4
0
    def measure_2D(self, web_visible=True):
        '''
        measure method to record a (averaged) VNA trace, S11 or S21 according to the setting on the VNA
        for all parameters x_vec in x_obj
        '''

        if not self.x_set_obj:
            logging.error('axes parameters not properly set...aborting')
            return
        if len(self.x_vec) == 0:
            logging.error(
                'No points to measure given. Check your x vector... aborting')
            return
        self._scan_1D = False
        self._scan_2D = True
        self._scan_3D = False
        self._scan_time = False

        self._measurement_object.measurement_func = 'measure_2D'
        self._measurement_object.x_axis = self.x_coordname
        self._measurement_object.y_axis = 'frequency'
        self._measurement_object.z_axis = ''
        self._measurement_object.web_visible = web_visible

        if not self.dirname:
            self.dirname = self.x_coordname
        self._file_name = '2D_' + self.dirname.replace(' ', '').replace(
            ',', '_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name

        if self.progress_bar:
            self._p = Progress_Bar(len(self.x_vec),
                                   '2D VNA sweep ' + self.dirname,
                                   self.vna.get_sweeptime_averages())

        self._prepare_measurement_vna()
        self._prepare_measurement_file()
        """opens qviewkit to plot measurement, amp and pha are opened by default"""
        if self._nop < 10:
            if self.open_qviewkit:
                self._qvk_process = qviewkit.plot(
                    self._data_file.get_filepath(),
                    datasets=['amplitude_midpoint', 'phase_midpoint'])
        else:
            if self.open_qviewkit:
                self._qvk_process = qviewkit.plot(
                    self._data_file.get_filepath(),
                    datasets=['amplitude', 'phase'])
        if self._fit_resonator:
            self._resonator = resonator(self._data_file.get_filepath())
        self._measure()
Example #5
0
    def start_depmon(self):
        """
        Starts the main sputter deposition monitoring function background process (depmon).

        Records the film resistance, thickness and deposition rate live during the sputter process.
        Stores everything into a h5 file.
        Provides measures to estimate the resulting resistance of the final film and thereby
        facilitates live adjustments to the sputter parameters.

        Note:
            set_duration and set_resolution should be called before to set the monitoring length and time resolution.
            set_filmparameters should be called before to provide the actual target values.

        Hint:
            Check with 'list_depmon_threads()'
            Stop with 'stop_depmon()'
        """
        print('Monitoring deposition...')
        sys.stdout.flush()

        self._init_depmon()

        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(
                self._data_file.get_filepath(),
                datasets=['views/resistance_thickness'],
                refresh=1.)

        self._depmon = Thread(target=self._monitor_depo_bg, name="depmon-1")
        self._depmon.daemon = True
        self._depmon.start()
Example #6
0
    def measure_3D(self, web_visible=True):
        '''
        measure full window of vna while sweeping x_set_obj and y_set_obj with parameters x_vec/y_vec. sweep over y_set_obj is the inner loop, for every value x_vec[i] all values y_vec are measured.

        optional: measure method to perform the measurement according to landscape, if set
        self.span is the range (in units of the vertical plot axis) data is taken around the specified funtion(s)
        note: make sure to have properly set x,y vectors before generating traces
        '''
        if not self.x_set_obj or not self.y_set_obj:
            logging.error('axes parameters not properly set...aborting')
            return
        self._scan_1D = False
        self._scan_2D = False
        self._scan_3D = True
        self._scan_time = False

        self._measurement_object.measurement_func = 'measure_3D'
        self._measurement_object.x_axis = self.x_coordname
        self._measurement_object.y_axis = self.y_coordname
        self._measurement_object.z_axis = 'frequency'
        self._measurement_object.web_visible = web_visible

        if not self.dirname:
            self.dirname = self.x_coordname + ', ' + self.y_coordname
        self._file_name = '3D_' + self.dirname.replace(' ', '').replace(
            ',', '_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name

        if self.progress_bar:
            self._p = Progress_Bar(
                len(self.x_vec) * len(self.y_vec),
                '3D VNA sweep ' + self.dirname,
                self.vna.get_sweeptime_averages())

        self._prepare_measurement_vna()
        self._prepare_measurement_file()
        """opens qviewkit to plot measurement, amp and pha are opened by default"""
        """only middle point in freq array is plotted vs x and y"""
        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(self._data_file.get_filepath(),
                                              datasets=['amplitude', 'phase'])
        if self._fit_resonator:
            self._resonator = resonator(self._data_file.get_filepath())

        if self.landscape:
            self.center_freqs = np.array(self.landscape).T
        else:
            self.center_freqs = []  #load default sequence
            for i in range(len(self.x_vec)):
                self.center_freqs.append([0])

        self._measure()
Example #7
0
    def measure_3D(self):
        '''
        measure full window of vna while sweeping x_set_obj and y_set_obj with parameters x_vec/y_vec. sweep over y_set_obj is the inner loop, for every value x_vec[i] all values y_vec are measured.

        optional: measure method to perform the measurement according to landscape, if set
        self.span is the range (in units of the vertical plot axis) data is taken around the specified funtion(s)
        note: make sure to have properly set x,y vectors before generating traces
        '''
        if not self.x_set_obj or not self.y_set_obj:
            logging.error('axes parameters not properly set...aborting')
            return
        self._scan_1D = False
        self._scan_2D = False
        self._scan_3D = True

        if not self.dirname:
            self.dirname = self.x_coordname + ', ' + self.y_coordname
        self._file_name = '3D_' + self.dirname.replace(' ', '').replace(',','_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name

        self._p = Progress_Bar(len(self.x_vec)*len(self.y_vec),'3D VNA sweep '+self.dirname,self.vna.get_sweeptime())

        self._prepare_measurement_vna()
        self._prepare_measurement_file()
        """opens qviewkit to plot measurement, amp and pha are opened by default"""
        """only middle point in freq array is plotted vs x and y"""
        qviewkit.plot(self._data_file.get_filepath(), datasets=['amplitude', 'phase'])
        if self._fit_resonator:
            self._resonator = resonator(self._data_file.get_filepath())

        if self.landscape:
            self.center_freqs = np.array(self.landscape).T
        else:
            self.center_freqs = []     #load default sequence
            for i in range(len(self.x_vec)):
                self.center_freqs.append([0])

        self._measure()
Example #8
0
    def measure_1D(self, sweep_type=1):
        '''
        measure method to record a single (averaged) VNA trace, S11 or S21 according to the setting on the VNA
        rescan: If True (default), the averages on the VNA are cleared and a new measurement is started. 
                If False, it will directly take the data from the VNA without waiting.
        '''
        
        self._sweep_type = sweep_type
        self._scan_1D = True
        self._scan_2D = False
        self._scan_3D = False
        self._scan_time = False
        
        self._measurement_object.measurement_func = 'measure_1D'
        self._measurement_object.x_axis = 'frequency'
        self._measurement_object.y_axis = ''
        self._measurement_object.z_axis = ''
        self._measurement_object.web_visible = self._web_visible
        if not self.dirname:
            self.dirname = 'IVD_tracedata'
        self._file_name = self.dirname.replace(' ', '').replace(',','_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name
            
        # prepare storage
        self._prepare_measurement_IVD()
        self._prepare_measurement_file()


        """opens qviewkit to plot measurement, amp and pha are opened by default"""
        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(self._data_file.get_filepath(), datasets=['I_0', 'V_0'])
        print('recording trace...')
        sys.stdout.flush()

        qt.mstart()
        
        self.sweep.create_iterator()
        self.IVD.set_status(True)
        for st in range(self.sweep.get_nos()):
            #print st
            self.IVD.set_sweep_parameters(self.sweep.get_sweep())
            data_bias, data_sense = self.IVD.take_IV()
            self._data_I[st].append(data_bias)
            self._data_V[st].append(data_sense)
            #self._data_dVdI[st].append(np.gradient(self._data_V[st])/np.gradient(self._data_I[st]))
        self.IVD.set_status(False)


        qt.mend()
        self._end_measurement()
Example #9
0
    def view(self, file_id=None):
        """
        view a datafile with qviewkit
        =============================
    
        Args:
           file_id (str):  identifier for a data file.
           
           file_id can be 
           
           None (empty): then the latest file is opened
           
           int: e.g. -1, 100 
                then the number is opened from the last list
           list: e.g ['UUID1' , 'UUID2']
               each UUID is opened
           uuid:
               the data file is looked up via the h5_db and opened
           path:
               the data file is opened using the path 

        Returns:
            None
        """
        #print("hallo",type(file_id))
        if file_id is None:
            return None
        elif type(file_id) is int:
            return (None)
        elif type(file_id) is pd.Index or type(file_id) is list:
            for i in file_id:
                filepath = self.h5_db.get(i, False)
                if filepath:
                    plot(filepath, live=False)
        elif type(file_id) is str:
            filepath = self.h5_db.get(file_id, False)
            if filepath:
                plot(filepath, live=False)
Example #10
0
    def measure_2D(self, web_visible=True):
        '''
        measure method to record a (averaged) VNA trace, S11 or S21 according to the setting on the VNA
        for all parameters x_vec in x_obj
        '''

        if not self.x_set_obj:
            logging.error('axes parameters not properly set...aborting')
            return
        self._scan_1D = False
        self._scan_2D = True
        self._scan_3D = False
        self._scan_time = False

        self._measurement_object.measurement_func = 'measure_2D'
        self._measurement_object.x_axis = self.x_coordname
        self._measurement_object.y_axis = 'frequency'
        self._measurement_object.z_axis = ''
        self._measurement_object.web_visible = web_visible

        if not self.dirname:
            self.dirname = self.x_coordname
        self._file_name = '2D_' + self.dirname.replace(' ', '').replace(
            ',', '_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name

        if self.progress_bar:
            self._p = Progress_Bar(len(self.x_vec),
                                   '2D signal analyzer sweep ' + self.dirname,
                                   self.sig_analyzer.get_sweeptime_averages())

        self._prepare_measurement_sig_analyzer()
        self._prepare_measurement_file()
        """opens qviewkit to plot measurement, amp and pha are opened by default"""

        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(self._data_file.get_filepath(),
                                              datasets=self.traces_names)
        self._measure()
Example #11
0
    def _prepare_measurement_file(self):
        if self.dirname == None:
            self.dirname = self.x_coordname

        self.ndev = len(readout.get_tone_freq())   #returns array of readout frequencies (=1 for non-multiplexed readout)
        
        self._hdf = hdf.Data(name=self.dirname)
        self._hdf_x = self._hdf.add_coordinate(self.x_coordname, unit = self.x_unit)
        self._hdf_x.add(self.x_vec)
        
        self._settings = self._hdf.add_textlist('settings')
        settings = waf.get_instrument_settings(self._hdf.get_filepath())
        self._settings.append(settings)
        
        self._log = waf.open_log_file(self._hdf.get_filepath())
        

        self._hdf_readout_frequencies = self._hdf.add_value_vector(self.multiplex_attribute, unit = self.multiplex_unit)
        self._hdf_readout_frequencies.append(readout.get_tone_freq())
        
        if self.ReadoutTrace:
            self._hdf_TimeTraceAxis = self._hdf.add_coordinate('recorded timepoint', unit = 's')
            self._hdf_TimeTraceAxis.add(np.arange(mspec.get_samples())/readout.get_adc_clock())
        
        if self.mode == 1: #1D
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(self._hdf.add_value_vector('amplitude_%i'%i, x = self._hdf_x, unit = 'V'))
                self._hdf_pha.append(self._hdf.add_value_vector('phase_%i'%i, x = self._hdf_x, unit='rad'))
            if self.ReadoutTrace:
                self._hdf_I = self._hdf.add_value_matrix('I_TimeTrace', x = self._hdf_x, y = self._hdf_TimeTraceAxis, unit = 'V', save_timestamp = False)
                self._hdf_Q = self._hdf.add_value_matrix('Q_TimeTrace', x = self._hdf_x, y = self._hdf_TimeTraceAxis, unit = 'V', save_timestamp = False)
        
        elif self.mode == 2: #2D
            self._hdf_y = self._hdf.add_coordinate(self.y_coordname, unit = self.y_unit)
            self._hdf_y.add(self.y_vec)
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(self._hdf.add_value_matrix('amplitude_%i'%i, x = self._hdf_x, y = self._hdf_y, unit = 'V'))
                self._hdf_pha.append(self._hdf.add_value_matrix('phase_%i'%i, x = self._hdf_x, y = self._hdf_y, unit = 'rad'))
                
        elif self.mode == 3: #1D_AWG/2D_AWG
    
            self._hdf_y = self._hdf.add_coordinate(self.y_coordname, unit = self.y_unit)
            self._hdf_y.add(self.y_vec)
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(self._hdf.add_value_matrix('amplitude_%i'%i, x = self._hdf_y, y = self._hdf_x, unit = 'V'))
                self._hdf_pha.append(self._hdf.add_value_matrix('phase_%i'%i, x = self._hdf_y, y = self._hdf_x, unit='rad'))
            if self.ReadoutTrace:
                self._hdf_I = self._hdf.add_value_box('I_TimeTrace', x = self._hdf_y, y = self._hdf_x, z = self._hdf_TimeTraceAxis, unit = 'V', save_timestamp = False)
                self._hdf_Q = self._hdf.add_value_box('Q_TimeTrace', x = self._hdf_y, y = self._hdf_x, z = self._hdf_TimeTraceAxis, unit = 'V', save_timestamp = False)
        
        if self.create_averaged_data:
            self._hdf_amp_avg = []
            self._hdf_pha_avg = []
            for i in range(self.ndev):
                self._hdf_amp_avg.append(self._hdf.add_value_vector('amplitude_avg_%i'%i, x = self._hdf_x, unit = 'V'))
                self._hdf_pha_avg.append(self._hdf.add_value_vector('phase_avg_%i'%i, x = self._hdf_x, unit='rad'))

        if self.comment:
            self._hdf.add_comment(self.comment)
        if self.qviewkit_singleInstance and self.open_qviewkit and self._qvk_process:
            self._qvk_process.terminate() #terminate an old qviewkit instance
        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(self._hdf.get_filepath(), datasets=['amplitude', 'phase'])
Example #12
0
    def _prepare_measurement_file(self):
        if self.dirname == None:
            self.dirname = self.x_coordname

        self.ndev = len(
            readout.get_tone_freq()
        )  #returns array of readout frequencies (=1 for non-multiplexed readout)

        self._hdf = hdf.Data(name=self.dirname)
        self._hdf_x = self._hdf.add_coordinate(self.x_coordname,
                                               unit=self.x_unit)
        self._hdf_x.add(self.x_vec)

        self._settings = self._hdf.add_textlist('settings')
        settings = waf.get_instrument_settings(self._hdf.get_filepath())
        self._settings.append(settings)

        self._log = waf.open_log_file(self._hdf.get_filepath())

        self._hdf_readout_frequencies = self._hdf.add_value_vector(
            self.multiplex_attribute, unit=self.multiplex_unit)
        self._hdf_readout_frequencies.append(readout.get_tone_freq())

        if self.ReadoutTrace:
            self._hdf_TimeTraceAxis = self._hdf.add_coordinate(
                'recorded timepoint', unit='s')
            self._hdf_TimeTraceAxis.add(
                np.arange(mspec.get_samples()) / readout.get_adc_clock())

        if self.mode == 1:  #1D
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(
                    self._hdf.add_value_vector('amplitude_%i' % i,
                                               x=self._hdf_x,
                                               unit='V'))
                self._hdf_pha.append(
                    self._hdf.add_value_vector('phase_%i' % i,
                                               x=self._hdf_x,
                                               unit='rad'))
            if self.ReadoutTrace:
                self._hdf_I = self._hdf.add_value_matrix(
                    'I_TimeTrace',
                    x=self._hdf_x,
                    y=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)
                self._hdf_Q = self._hdf.add_value_matrix(
                    'Q_TimeTrace',
                    x=self._hdf_x,
                    y=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)

        elif self.mode == 2:  #2D
            self._hdf_y = self._hdf.add_coordinate(self.y_coordname,
                                                   unit=self.y_unit)
            self._hdf_y.add(self.y_vec)
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(
                    self._hdf.add_value_matrix('amplitude_%i' % i,
                                               x=self._hdf_x,
                                               y=self._hdf_y,
                                               unit='V'))
                self._hdf_pha.append(
                    self._hdf.add_value_matrix('phase_%i' % i,
                                               x=self._hdf_x,
                                               y=self._hdf_y,
                                               unit='rad'))

        elif self.mode == 3:  #1D_AWG/2D_AWG

            self._hdf_y = self._hdf.add_coordinate(self.y_coordname,
                                                   unit=self.y_unit)
            self._hdf_y.add(self.y_vec)
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(
                    self._hdf.add_value_matrix('amplitude_%i' % i,
                                               x=self._hdf_y,
                                               y=self._hdf_x,
                                               unit='V'))
                self._hdf_pha.append(
                    self._hdf.add_value_matrix('phase_%i' % i,
                                               x=self._hdf_y,
                                               y=self._hdf_x,
                                               unit='rad'))
            if self.ReadoutTrace:
                self._hdf_I = self._hdf.add_value_box(
                    'I_TimeTrace',
                    x=self._hdf_y,
                    y=self._hdf_x,
                    z=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)
                self._hdf_Q = self._hdf.add_value_box(
                    'Q_TimeTrace',
                    x=self._hdf_y,
                    y=self._hdf_x,
                    z=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)

        if self.create_averaged_data:
            self._hdf_amp_avg = []
            self._hdf_pha_avg = []
            for i in range(self.ndev):
                self._hdf_amp_avg.append(
                    self._hdf.add_value_vector('amplitude_avg_%i' % i,
                                               x=self._hdf_x,
                                               unit='V'))
                self._hdf_pha_avg.append(
                    self._hdf.add_value_vector('phase_avg_%i' % i,
                                               x=self._hdf_x,
                                               unit='rad'))

        if self.comment:
            self._hdf.add_comment(self.comment)
        if self.qviewkit_singleInstance and self.open_qviewkit and self._qvk_process:
            self._qvk_process.terminate()  #terminate an old qviewkit instance
        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(self._hdf.get_filepath(),
                                              datasets=['amplitude', 'phase'])
Example #13
0
    def monitor_depo(self):
        """
        Main sputter deposition monitoring function.

        Consider using the threaded version by calling start_depmon().

        Records the film resistance, thickness and deposition rate live during the sputter process.
        Stores everything into a h5 file.
        Provides measures to estimate the resulting resistance of the final film and thereby
        facilitates live adjustments to the sputter parameters.

        Note:
            set_duration and set_resolution should be called before to set the monitoring length and time resolution.
            set_filmparameters should be called before to provide the actual target values.
        """

        self._init_depmon()

        if self.progress_bar:
            self._p = Progress_Bar(
                self._duration / self._resolution,
                'EVAP_timetrace ' + self.dirname,
                self._resolution)  # FIXME: Doesn't make much sense...

        print('Monitoring deposition...')
        sys.stdout.flush()

        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(
                self._data_file.get_filepath(),
                datasets=['views/resistance_thickness'])

        try:
            """
            Initialize the data lists.
            """
            class MonData(object):
                resistance = np.array([])
                thickness = np.array([])

            mon_data = MonData()
            """
            Main loop:
            """
            mon_data.t0 = time.time(
            )  # note: Windows has limitations on time precision (about 16ms)
            for mon_data.it, _ in enumerate(self.x_vec):
                self._acquire(mon_data)

                if self.progress_bar:
                    self._p.iterate()

                # calculate the time when the next iteration should take place
                ti = mon_data.t0 + (float(mon_data.it) + 1) * self._resolution
                # wait until the total dt(iteration) has elapsed
                while time.time() < ti:
                    time.sleep(0.05)

        except KeyboardInterrupt:
            print('Monitoring interrupted by user.')

        except Exception as e:
            print(e)
            print(e.__doc__)
            print(e.message)

        finally:
            self._end_measurement()
Example #14
0
    def measure_1D(self, rescan = True, web_visible = True):
        '''
        measure method to record a single (averaged) VNA trace, S11 or S21 according to the setting on the VNA
        rescan: If True (default), the averages on the VNA are cleared and a new measurement is started. 
                If False, it will directly take the data from the VNA without waiting.
        '''
        self._scan_1D = True
        self._scan_2D = False
        self._scan_3D = False
        self._scan_time = False
        
        self._measurement_object.measurement_func = 'measure_1D'
        self._measurement_object.x_axis = 'frequency'
        self._measurement_object.y_axis = ''
        self._measurement_object.z_axis = ''
        self._measurement_object.web_visible = web_visible

        if not self.dirname:
            self.dirname = 'VNA_tracedata'
        self._file_name = self.dirname.replace(' ', '').replace(',','_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name
        self._prepare_measurement_vna()
        self._prepare_measurement_file()

        """opens qviewkit to plot measurement, amp and pha are opened by default"""
        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(self._data_file.get_filepath(), datasets=['amplitude', 'phase'])
        if self._fit_resonator:
            self._resonator = resonator(self._data_file.get_filepath()) 
        print 'recording trace...'
        sys.stdout.flush()

        qt.mstart()
        if rescan:
            if self.averaging_start_ready:
                self.vna.start_measurement()
                ti = time()
                if self.progress_bar: self._p = Progress_Bar(self.vna.get_averages(),self.dirname,self.vna.get_sweeptime())
                qt.msleep(.2)
                while not self.vna.ready():
                    if time()-ti > self.vna.get_sweeptime(query=False):
                        if self.progress_bar: self._p.iterate()
                        ti = time()
                    qt.msleep(.2)
                if self.progress_bar:
                    while self._p.progr < self._p.max_it:
                        self._p.iterate()
            else:
                self.vna.avg_clear()
                if self.vna.get_averages() == 1 or self.vna.get_Average() == False:   #no averaging
                    if self.progress_bar:self._p = Progress_Bar(1,self.dirname,self.vna.get_sweeptime())
                    qt.msleep(self.vna.get_sweeptime())      #wait single sweep
                    if self.progress_bar: self._p.iterate()
                else:   #with averaging
                    if self.progress_bar: self._p = Progress_Bar(self.vna.get_averages(),self.dirname,self.vna.get_sweeptime())
                    if "avg_status" in self.vna.get_function_names():
                        for a in range(self.vna.get_averages()):
                            while self.vna.avg_status() <= a:
                                qt.msleep(.2) #maybe one would like to adjust this at a later point
                            if self.progress_bar: self._p.iterate()
                    else: #old style
                        for a in range(self.vna.get_averages()):
                            qt.msleep(self.vna.get_sweeptime())      #wait single sweep time
                            if self.progress_bar: self._p.iterate()

        data_amp, data_pha = self.vna.get_tracedata()
        data_real, data_imag = self.vna.get_tracedata('RealImag')

        self._data_amp.append(data_amp)
        self._data_pha.append(data_pha)
        self._data_real.append(data_real)
        self._data_imag.append(data_imag)
        if self._fit_resonator:
            self._do_fit_resonator()

        qt.mend()
        self._end_measurement()
Example #15
0
    def measure_1D(self, rescan=True, web_visible=True):
        '''
        measure method to record a single (averaged) VNA trace, S11 or S21 according to the setting on the VNA
        rescan: If True (default), the averages on the VNA are cleared and a new measurement is started. 
                If False, it will directly take the data from the VNA without waiting.
        '''
        self._scan_1D = True
        self._scan_2D = False
        self._scan_3D = False
        self._scan_time = False

        self._measurement_object.measurement_func = 'measure_1D'
        self._measurement_object.x_axis = 'frequency'
        self._measurement_object.y_axis = ''
        self._measurement_object.z_axis = ''
        self._measurement_object.web_visible = web_visible

        if not self.dirname:
            self.dirname = 'VNA_tracedata'
        self._file_name = self.dirname.replace(' ', '').replace(',', '_')
        if self.exp_name:
            self._file_name += '_' + self.exp_name
        self._prepare_measurement_vna()
        self._prepare_measurement_file()
        """opens qviewkit to plot measurement, amp and pha are opened by default"""
        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(self._data_file.get_filepath(),
                                              datasets=['amplitude', 'phase'])
        if self._fit_resonator:
            self._resonator = resonator(self._data_file.get_filepath())
        print 'recording trace...'
        sys.stdout.flush()

        qt.mstart()
        if rescan:
            if self.averaging_start_ready:
                self.vna.start_measurement()
                ti = time()
                if self.progress_bar:
                    self._p = Progress_Bar(self.vna.get_averages(),
                                           self.dirname,
                                           self.vna.get_sweeptime())
                qt.msleep(.2)
                while not self.vna.ready():
                    if time() - ti > self.vna.get_sweeptime(query=False):
                        if self.progress_bar: self._p.iterate()
                        ti = time()
                    qt.msleep(.2)
                if self.progress_bar:
                    while self._p.progr < self._p.max_it:
                        self._p.iterate()
            else:
                self.vna.avg_clear()
                if self.vna.get_averages() == 1 or self.vna.get_Average(
                ) == False:  #no averaging
                    if self.progress_bar:
                        self._p = Progress_Bar(1, self.dirname,
                                               self.vna.get_sweeptime())
                    qt.msleep(self.vna.get_sweeptime())  #wait single sweep
                    if self.progress_bar: self._p.iterate()
                else:  #with averaging
                    if self.progress_bar:
                        self._p = Progress_Bar(self.vna.get_averages(),
                                               self.dirname,
                                               self.vna.get_sweeptime())
                    if "avg_status" in self.vna.get_function_names():
                        for a in range(self.vna.get_averages()):
                            while self.vna.avg_status() <= a:
                                qt.msleep(
                                    .2
                                )  #maybe one would like to adjust this at a later point
                            if self.progress_bar: self._p.iterate()
                    else:  #old style
                        for a in range(self.vna.get_averages()):
                            qt.msleep(self.vna.get_sweeptime()
                                      )  #wait single sweep time
                            if self.progress_bar: self._p.iterate()

        data_amp, data_pha = self.vna.get_tracedata()
        data_real, data_imag = self.vna.get_tracedata('RealImag')

        self._data_amp.append(data_amp)
        self._data_pha.append(data_pha)
        self._data_real.append(data_real)
        self._data_imag.append(data_imag)
        if self._fit_resonator:
            self._do_fit_resonator()

        qt.mend()
        self._end_measurement()
Example #16
0
    def _prepare_measurement_file(self):
        qkit.flow.start()
        if self.dirname is None:
            self.dirname = self.x_coordname

        self.ndev = len(self.readout.get_tone_freq(
        ))  # returns array of readout freqs (=1 for non-multiplexed readout)

        self._hdf = hdf.Data(name=self.dirname, mode='a')
        self._hdf_x = self._hdf.add_coordinate(self.x_coordname,
                                               unit=self.x_unit)
        self._hdf_x.add(self.x_vec)

        self._settings = self._hdf.add_textlist('settings')
        settings = waf.get_instrument_settings(self._hdf.get_filepath())
        self._settings.append(settings)

        self._log = waf.open_log_file(self._hdf.get_filepath())

        self._hdf_readout_frequencies = self._hdf.add_coordinate(
            self.multiplex_attribute, unit=self.multiplex_unit)
        self._hdf_readout_frequencies.add(self.readout.get_tone_freq())

        if self.ReadoutTrace:
            self._hdf_TimeTraceAxis = self._hdf.add_coordinate(
                'recorded timepoint', unit='s')
            self._hdf_TimeTraceAxis.add(
                np.arange(self.sample.mspec.get_samples()) /
                self.readout.get_adc_clock())

        if self.mode == 1:  # 1D
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(
                    self._hdf.add_value_vector('amplitude_%i' % i,
                                               x=self._hdf_x,
                                               unit='a.u.'))
                self._hdf_pha.append(
                    self._hdf.add_value_vector('phase_%i' % i,
                                               x=self._hdf_x,
                                               unit='rad'))
            if self.ReadoutTrace:
                self._hdf_I = self._hdf.add_value_matrix(
                    'I_TimeTrace',
                    x=self._hdf_x,
                    y=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)
                self._hdf_Q = self._hdf.add_value_matrix(
                    'Q_TimeTrace',
                    x=self._hdf_x,
                    y=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)

        elif self.mode == 2:  # 2D
            self._hdf_y = self._hdf.add_coordinate(self.y_coordname,
                                                   unit=self.y_unit)
            self._hdf_y.add(self.y_vec)
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(
                    self._hdf.add_value_matrix('amplitude_%i' % i,
                                               x=self._hdf_x,
                                               y=self._hdf_y,
                                               unit='a.u.'))
                self._hdf_pha.append(
                    self._hdf.add_value_matrix('phase_%i' % i,
                                               x=self._hdf_x,
                                               y=self._hdf_y,
                                               unit='rad'))
            if self.ReadoutTrace:
                # TODO: One dimension missing here?
                self._hdf_I = self._hdf.add_value_matrix(
                    'I_TimeTrace',
                    x=self._hdf_y,
                    y=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)
                self._hdf_Q = self._hdf.add_value_matrix(
                    'Q_TimeTrace',
                    x=self._hdf_y,
                    y=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)

        elif self.mode == 3:  # 1D_AWG/2D_AWG
            self._hdf_y = self._hdf.add_coordinate(self.y_coordname,
                                                   unit=self.y_unit)
            self._hdf_y.add(self.y_vec)
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(
                    self._hdf.add_value_matrix('amplitude_%i' % i,
                                               x=self._hdf_y,
                                               y=self._hdf_x,
                                               unit='a.u.'))
                self._hdf_pha.append(
                    self._hdf.add_value_matrix('phase_%i' % i,
                                               x=self._hdf_y,
                                               y=self._hdf_x,
                                               unit='rad'))
            if self.ReadoutTrace:
                self._hdf_I = self._hdf.add_value_box(
                    'I_TimeTrace',
                    x=self._hdf_y,
                    y=self._hdf_x,
                    z=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)
                self._hdf_Q = self._hdf.add_value_box(
                    'Q_TimeTrace',
                    x=self._hdf_y,
                    y=self._hdf_x,
                    z=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)

        elif self.mode == 4:  # 3D_AWG
            self._hdf_y = self._hdf.add_coordinate(self.y_coordname,
                                                   unit=self.y_unit)
            self._hdf_y.add(self.y_vec)
            self._hdf_z = self._hdf.add_coordinate(self.z_coordname,
                                                   unit=self.z_unit)
            self._hdf_z.add(self.z_vec)
            self._hdf_amp = []
            self._hdf_pha = []
            for i in range(self.ndev):
                self._hdf_amp.append(
                    self._hdf.add_value_box('amplitude_%i' % i,
                                            x=self._hdf_z,
                                            y=self._hdf_y,
                                            z=self._hdf_x,
                                            unit='a.u.'))
                self._hdf_pha.append(
                    self._hdf.add_value_box('phase_%i' % i,
                                            x=self._hdf_z,
                                            y=self._hdf_y,
                                            z=self._hdf_x,
                                            unit='rad'))
            if self.ReadoutTrace:
                self._hdf_I = self._hdf.add_value_box(
                    'I_TimeTrace',
                    x=self._hdf_z,
                    y=self._hdf_y,
                    z=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)
                self._hdf_Q = self._hdf.add_value_box(
                    'Q_TimeTrace',
                    x=self._hdf_y,
                    y=self._hdf_y,
                    z=self._hdf_TimeTraceAxis,
                    unit='V',
                    save_timestamp=False)

        if self.create_averaged_data:
            self._hdf_amp_avg = []
            self._hdf_pha_avg = []
            for i in range(self.ndev):
                self._hdf_amp_avg.append(
                    self._hdf.add_value_vector('amplitude_avg_%i' % i,
                                               x=self._hdf_x,
                                               unit='a.u.'))
                self._hdf_pha_avg.append(
                    self._hdf.add_value_vector('phase_avg_%i' % i,
                                               x=self._hdf_x,
                                               unit='rad'))

        if self.comment:
            self._hdf.add_comment(self.comment)
        self._hdf.hf.hf.attrs['default_ds'] = ['data0/amplitude_%i' % i for i in range(min(5,self.ndev))] +\
                                              ['data0/phase_%i' % i for i in range(min(5,self.ndev))]
        if self.qviewkit_singleInstance and self.open_qviewkit and self._qvk_process:
            self._qvk_process.terminate()  # terminate an old qviewkit instance
        if self.open_qviewkit:
            self._qvk_process = qviewkit.plot(
                self._hdf.get_filepath(),
                datasets=[
                    'amplitude_%i' % i for i in range(min(5, self.ndev))
                ] + ['phase_%i' % i for i in range(min(5, self.ndev))])

        try:
            self.readout.start()
        except AttributeError:
            pass
Example #17
0
	def _prepare_measurement_dat_file(self,mode):
	
		if self.dirname == None:
			self.dirname = self.x_coordname
			
		if self.save_dat:
			self.data_raw = qt.Data(name='%s_%s'%(mode,self.dirname))
			
			if mode == '2dAWG':
				self.data_raw.add_coordinate(self.y_coordname)
			
			if self.comment:
				self.data_raw.add_comment(self.comment)
				
			self.data_raw.add_coordinate(self.x_coordname)
			self.ndev = len(readout.get_tone_freq())   #returns array of readout frequencies (=1 for non-multiplexed readout)
			for i in range(self.ndev):
				self.data_raw.add_value('amp_%d'%i)
			for i in range(self.ndev):
				self.data_raw.add_value('pha_%d'%i)
			self.data_raw.add_value('timestamp')
			self.data_raw.create_file()
			
			self.data_fn, self.data_fext = os.path.splitext(self.data_raw.get_filepath())
			if mode == '2dAWG':
				self.data_avg = qt.Data(name='avga_%s'%self.dirname)
				if self.comment:
					self.data_avg.add_comment(self.comment)
				self.data_avg.add_coordinate(self.x_coordname)
				for i in range(self.ndev):
					self.data_avg.add_value('amp_%d'%i)
				for i in range(self.ndev):
					self.data_avg.add_value('pha_%d'%i)
				#self.data_avg.create_file(None, '%s_avg.dat'%self.data_fn, False)
			
			if self.time_data:
				self.data_time = qt.Data(name='avgt_%s'%self.dirname)
				# data_time columns: [iteration, coordinate, Is[nSamples], Qs[nSamples], timestamp]
				if self.comment:
					self.data_time.add_comment(self.comment)
				self.data_time.add_coordinate(self.x_coordname)
				if mode == '2d': self.data_time.add_coordinate(self.y_coordname)
				for i in range(mspec.get_samples()):
					self.data_time.add_coordinate('I%3d'%i)
				for i in range(mspec.get_samples()):
					self.data_time.add_coordinate('Q%3d'%i)
				self.data_time.add_value('timestamp')
				if self.save_dat: self.data_time.create_file(None, '%s_time.dat'%self.data_fn, False)
				
		if self.save_hdf:
			if self.save_dat:
				filename = str(self.data_raw.get_filepath()).replace('.dat','.h5')   #get same filename as in dat file
			else:
				filename = str(self.dirname) + '.h5'
			self._data_hdf = hdf.Data(name=self.dirname, path=filename)
			self._hdf_x = self._data_hdf.add_coordinate(self.x_coordname, unit = self.x_unit)
			self._hdf_x.add(self.x_vec)
			if mode == '2d' or mode == '2dAWG':
				self._hdf_y = self._data_hdf.add_coordinate(self.y_coordname, unit = self.y_unit)
				self._hdf_y.add(self.y_vec)
				self._hdf_amp = self._data_hdf.add_value_matrix('amplitude', x = self._hdf_y, y = self._hdf_x, unit = 'V')
				self._hdf_pha = self._data_hdf.add_value_matrix('phase', x = self._hdf_y, y = self._hdf_x, unit='rad')
			else:   #1d
				self._hdf_amp = self._data_hdf.add_value_vector('amplitude', x = self._hdf_x, unit = 'V')
				self._hdf_pha = self._data_hdf.add_value_vector('phase', x = self._hdf_x, unit='rad')
			if self.comment:
				self._data_hdf.add_comment(self.comment)
			qviewkit.close('all')
			qviewkit.plot(self._data_hdf.get_filepath(), datasets=['amplitude', 'phase'])
Example #18
0
 def plotif(filename):
     if filename:
         plot(filename, live=False)