Example #1
0
 def _write_settings_dataset(self):
     """
     Writes a dataset containing the settings of the measurement instruments.
     """
     self._settings = self._data_file.add_textlist('settings')
     settings = waf.get_instrument_settings(self._data_file.get_filepath())
     self._settings.append(settings)
Example #2
0
    def _prepare_measurement_file(self):
        '''
        creates the output .h5-file with distinct dataset structures for each measurement type.
        at this point all measurement parameters are known and put in the output file
        '''

        self._data_file = hdf.Data(name=self._file_name, mode='a')
        self._measurement_object.uuid = self._data_file._uuid
        self._measurement_object.hdf_relpath = self._data_file._relpath
        self._measurement_object.instruments = qkit.instruments.get_instrument_names(
        )

        self._measurement_object.save()
        self._mo = self._data_file.add_textlist('measurement')
        self._mo.append(self._measurement_object.get_JSON())

        # instrument settings and logfile
        self._settings = self._data_file.add_textlist('settings')
        settings = waf.get_instrument_settings(self._data_file.get_filepath())
        self._settings.append(settings)

        self._log_file = waf.open_log_file(self._data_file.get_filepath())
Example #3
0
 def _write_settings_dataset(self):
     self._settings = self._data_file.add_textlist('settings')
     settings = waf.get_instrument_settings(self._data_file.get_filepath())
     self._settings.append(settings)
Example #4
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 #5
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 #6
0
 def _write_settings_dataset(self):
     self._settings = self._data_file.add_textlist('settings')
     settings = waf.get_instrument_settings(self._data_file.get_filepath())
     self._settings.append(settings)
Example #7
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'])