def _prepare_measurement_file(self,trace=False): ''' 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) # write logfile and instrument settings self._write_settings_dataset() self._log = waf.open_log_file(self._data_file.get_filepath()) self._data_freq = self._data_file.add_coordinate('frequency', unit = 'Hz', dtype='float64') self._data_freq.add(self._freqpoints) if self._scan_1D: self._data_real = self._data_file.add_value_vector('real', x = self._data_freq, unit = '', save_timestamp = True) self._data_imag = self._data_file.add_value_vector('imag', x = self._data_freq, unit = '', save_timestamp = True) self._data_amp = self._data_file.add_value_vector('amplitude', x = self._data_freq, unit = 'arb. unit', save_timestamp = True) self._data_pha = self._data_file.add_value_vector('phase', x = self._data_freq, unit = 'rad', save_timestamp = True) if self._scan_2D: self._data_x = self._data_file.add_coordinate(self.x_coordname, unit = self.x_unit) self._data_x.add(self.x_vec) self._data_amp = self._data_file.add_value_matrix('amplitude', x = self._data_x, y = self._data_freq, unit = 'arb. unit', save_timestamp = True) self._data_pha = self._data_file.add_value_matrix('phase', x = self._data_x, y = self._data_freq, unit='rad', save_timestamp = True) if self.log_function != None: #use logging self._log_value = [] for i in range(len(self.log_function)): self._log_value.append(self._data_file.add_value_vector(self.log_name[i], x = self._data_x, unit = self.log_unit[i])) if self._nop < 10: """creates view: plot middle point vs x-parameter, for qubit measurements""" self._data_amp_mid = self._data_file.add_value_vector('amplitude_midpoint', unit = 'arb. unit', x = self._data_x, save_timestamp = True) self._data_pha_mid = self._data_file.add_value_vector('phase_midpoint', unit = 'rad', x = self._data_x, save_timestamp = True) #self._view = self._data_file.add_view("amplitude vs. " + self.x_coordname, x = self._data_x, y = self._data_amp[self._nop/2]) if self._scan_3D: self._data_x = self._data_file.add_coordinate(self.x_coordname, unit = self.x_unit) self._data_x.add(self.x_vec) self._data_y = self._data_file.add_coordinate(self.y_coordname, unit = self.y_unit) self._data_y.add(self.y_vec) if self._nop == 0: #saving in a 2D matrix instead of a 3D box HR: does not work yet !!! test things before you put them online. self._data_amp = self._data_file.add_value_matrix('amplitude', x = self._data_x, y = self._data_y, unit = 'arb. unit', save_timestamp = False) self._data_pha = self._data_file.add_value_matrix('phase', x = self._data_x, y = self._data_y, unit = 'rad', save_timestamp = False) else: self._data_amp = self._data_file.add_value_box('amplitude', x = self._data_x, y = self._data_y, z = self._data_freq, unit = 'arb. unit', save_timestamp = False) self._data_pha = self._data_file.add_value_box('phase', x = self._data_x, y = self._data_y, z = self._data_freq, unit = 'rad', save_timestamp = False) if self.log_function != None: #use logging self._log_value = [] for i in range(len(self.log_function)): self._log_value.append(self._data_file.add_value_vector(self.log_name[i], x = self._data_x, unit = self.log_unit[i])) if self.comment: self._data_file.add_comment(self.comment)
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())
def _prepare_monitoring_file(self): """ Creates the output .h5-file with distinct the required datasets and views. 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()) # write logfile and instrument settings self._write_settings_dataset() self._log = waf.open_log_file(self._data_file.get_filepath()) ''' Time record ''' self._data_time = self._data_file.add_value_vector('time', x=None, unit='s') ''' Quartz datasets ''' self._data_rate = self._data_file.add_value_vector( 'rate', x=self._data_time, unit='nm/s', save_timestamp=False) self._data_thickness = self._data_file.add_value_vector( 'thickness', x=self._data_time, unit='nm', save_timestamp=False) ''' Ohmmeter datasets ''' self._data_resistance = self._data_file.add_value_vector( 'resistance', x=self._data_time, unit='Ohm', save_timestamp=False) self._data_conductance = self._data_file.add_value_vector( 'conductance', x=self._data_time, unit='S', save_timestamp=False) self._data_deviation_abs = self._data_file.add_value_vector( 'deviation_absolute', x=self._data_time, unit='Ohm', save_timestamp=False) self._data_deviation_rel = self._data_file.add_value_vector( 'deviation_relative', x=self._data_time, unit='relative', save_timestamp=False) ''' MFC datasets ''' # FIXME: units? if self.mfc: self._data_pressure = self._data_file.add_value_vector( 'pressure', x=self._data_time, unit='ubar', save_timestamp=False) self._data_Ar_flow = self._data_file.add_value_vector( 'Ar_flow', x=self._data_time, unit='sccm', save_timestamp=False) self._data_ArO_flow = self._data_file.add_value_vector( 'ArO_flow', x=self._data_time, unit='sccm', save_timestamp=False) ''' Calculate ideal trend and create record ''' self._thickness_coord = self._data_file.add_coordinate( 'thickness_coord', unit='nm') self._thickness_coord.add(self.ideal_trend()[0]) if self._show_ideal: self._data_ideal = self._data_file.add_value_vector( 'ideal_resistance', x=self._thickness_coord, unit='Ohm', save_timestamp=False) self._data_ideal.append(self.ideal_trend()[1]) ''' Create target marker ''' if self._target_marker: self._target_thickness_line = self._data_file.add_value_vector( 'target_thickness', x=None, unit='nm', save_timestamp=False) self._target_thickness_line.append([ 0.8 * self._target_thickness, self._target_thickness, self._target_thickness, self._target_thickness, self._target_thickness, 1.2 * self._target_thickness ]) self._target_resistance_line = self._data_file.add_value_vector( 'target_resistance', x=None, unit='Ohm', save_timestamp=False) self._target_resistance_line.append([ self._target_resistance, self._target_resistance, 1.2 * self._target_resistance, 0.8 * self._target_resistance, self._target_resistance, self._target_resistance ]) self._target_conductance_line = self._data_file.add_value_vector( 'target_conductance', x=None, unit='S', save_timestamp=False) self._target_conductance_line.append([ 1. / self._target_resistance, 1. / self._target_resistance, 1. / 1.2 / self._target_resistance, 1. / 0.8 / self._target_resistance, 1. / self._target_resistance, 1. / self._target_resistance ]) ''' Estimation datasets ''' if self._fit_resistance: self._thickness_estimation = self._data_file.add_value_vector( 'thickness_estimation', x=None, unit='nm', save_timestamp=False) self._resistance_estimation = self._data_file.add_value_vector( 'resistance_estimation', x=None, unit='Ohm', save_timestamp=False) self._last_resistance_fit = self._data_file.add_value_vector( 'last_resistance_fit', x=None, unit='Ohm', save_timestamp=False) ''' Reference dataset ''' if not self._reference_uid == None: self._thickness_reference = self._data_file.add_value_vector( 'thickness_reference', x=None, unit='nm', save_timestamp=False) self._thickness_reference.append(self._ref_thickness) self._resistance_reference = self._data_file.add_value_vector( 'reference_' + self._reference_uid, x=None, unit='Ohm', save_timestamp=False) self._resistance_reference.append(self._ref_resistance) ''' Create Views ''' self._resist_view = self._data_file.add_view('resistance_thickness', x=self._data_thickness, y=self._data_resistance) if self._show_ideal: self._resist_view.add(x=self._thickness_coord, y=self._data_ideal) if self._target_marker: self._resist_view.add(x=self._target_thickness_line, y=self._target_resistance_line) if not self._reference_uid == None: self._resist_view.add(x=self._thickness_reference, y=self._resistance_reference) if self._fit_resistance: self._resist_view.add(x=self._thickness_coord, y=self._last_resistance_fit) self._conductance_view = self._data_file.add_view( 'conductance_thickness', x=self._data_thickness, y=self._data_conductance) if self._target_marker: self._conductance_view.add(x=self._target_thickness_line, y=self._target_conductance_line) self._deviation_abs_view = self._data_file.add_view( 'deviation_absolute', x=self._data_thickness, y=self._data_deviation_abs) self._deviation_rel_view = self._data_file.add_view( 'deviation_relative', x=self._data_thickness, y=self._data_deviation_rel) ''' Create comment ''' if self.comment: self._data_file.add_comment(self.comment) ''' Open GUI ''' if self.qviewkit_singleInstance and self.open_qviewkit and self._qvk_process: self._qvk_process.terminate() # terminate an old qviewkit instance
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) self._measurement_object.uuid = self._data_file._uuid self._measurement_object.hdf_relpath = self._data_file._relpath self._measurement_object.instruments = qt.instruments.get_instruments() self._measurement_object.save() self._mo = self._data_file.add_textlist('measurement') self._mo.append(self._measurement_object.get_JSON()) # write logfile and instrument settings self._write_settings_dataset() self._log = waf.open_log_file(self._data_file.get_filepath()) if not self._scan_time: self._data_freq = self._data_file.add_coordinate('frequency', unit='Hz') self._data_freq.add(self._freqpoints) if self._scan_1D: self._data_real = self._data_file.add_value_vector( 'real', x=self._data_freq, unit='', save_timestamp=True) self._data_imag = self._data_file.add_value_vector( 'imag', x=self._data_freq, unit='', save_timestamp=True) self._data_amp = self._data_file.add_value_vector( 'amplitude', x=self._data_freq, unit='arb. unit', save_timestamp=True) self._data_pha = self._data_file.add_value_vector( 'phase', x=self._data_freq, unit='rad', save_timestamp=True) if self._scan_2D: self._data_x = self._data_file.add_coordinate(self.x_coordname, unit=self.x_unit) self._data_x.add(self.x_vec) self._data_amp = self._data_file.add_value_matrix( 'amplitude', x=self._data_x, y=self._data_freq, unit='arb. unit', save_timestamp=True) self._data_pha = self._data_file.add_value_matrix( 'phase', x=self._data_x, y=self._data_freq, unit='rad', save_timestamp=True) if self.log_function != None: #use logging self._log_value = [] for i in range(len(self.log_function)): self._log_value.append( self._data_file.add_value_vector( self.log_name[i], x=self._data_x, unit=self.log_unit[i], dtype=self.log_dtype[i])) if self._nop < 10: """creates view: plot middle point vs x-parameter, for qubit measurements""" self._data_amp_mid = self._data_file.add_value_vector( 'amplitude_midpoint', unit='arb. unit', x=self._data_x, save_timestamp=True) self._data_pha_mid = self._data_file.add_value_vector( 'phase_midpoint', unit='rad', x=self._data_x, save_timestamp=True) #self._view = self._data_file.add_view("amplitude vs. " + self.x_coordname, x = self._data_x, y = self._data_amp[self._nop/2]) if self._scan_3D: self._data_x = self._data_file.add_coordinate(self.x_coordname, unit=self.x_unit) self._data_x.add(self.x_vec) self._data_y = self._data_file.add_coordinate(self.y_coordname, unit=self.y_unit) self._data_y.add(self.y_vec) if self._nop == 0: #saving in a 2D matrix instead of a 3D box HR: does not work yet !!! test things before you put them online. self._data_amp = self._data_file.add_value_matrix( 'amplitude', x=self._data_x, y=self._data_y, unit='arb. unit', save_timestamp=False) self._data_pha = self._data_file.add_value_matrix( 'phase', x=self._data_x, y=self._data_y, unit='rad', save_timestamp=False) else: self._data_amp = self._data_file.add_value_box( 'amplitude', x=self._data_x, y=self._data_y, z=self._data_freq, unit='arb. unit', save_timestamp=False) self._data_pha = self._data_file.add_value_box( 'phase', x=self._data_x, y=self._data_y, z=self._data_freq, unit='rad', save_timestamp=False) if self.log_function != None: #use logging self._log_value = [] for i in range(len(self.log_function)): self._log_value.append( self._data_file.add_value_vector( self.log_name[i], x=self._data_x, unit=self.log_unit[i], dtype=self.log_dtype[i])) if self._scan_time: self._data_freq = self._data_file.add_coordinate('frequency', unit='Hz') self._data_freq.add([self.vna.get_centerfreq()]) self._data_time = self._data_file.add_coordinate('time', unit='s') self._data_time.add( np.arange(0, self._nop, 1) * self.vna.get_sweeptime() / (self._nop - 1)) self._data_x = self._data_file.add_coordinate('trace_number', unit='') self._data_x.add(np.arange(0, self.number_of_timetraces, 1)) self._data_amp = self._data_file.add_value_matrix( 'amplitude', x=self._data_x, y=self._data_time, unit='lin. mag.', save_timestamp=False) self._data_pha = self._data_file.add_value_matrix( 'phase', x=self._data_x, y=self._data_time, unit='rad.', save_timestamp=False) if self.comment: self._data_file.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
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
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()) # write logfile and instrument settings self._write_settings_dataset() self._log = waf.open_log_file(self._data_file.get_filepath()) self._data_freq = self._data_file.add_coordinate('frequency', unit='Hz') self._data_freq.add(self._freqpoints) self._data = [] # empty list as we have a variable number of channels if self._scan_1D: for i in range(self.num_traces): self._data.append( self._data_file.add_value_vector(self.traces_names[i], x=self._data_freq, unit=self.units[i], save_timestamp=True)) if self._scan_2D: self._data_x = self._data_file.add_coordinate(self.x_coordname, unit=self.x_unit) self._data_x.add(self.x_vec) for i in range(self.num_traces): self._data.append( self._data_file.add_value_matrix(self.traces_names[i], x=self._data_x, y=self._data_freq, unit=self.units[i], save_timestamp=True)) if self.log_function != None: # use logging self._log_value = [] for i in range(len(self.log_function)): self._log_value.append( self._data_file.add_value_vector( self.log_name[i], x=self._data_x, unit=self.log_unit[i], dtype=self.log_dtype[i])) if self._scan_3D: self._data_x = self._data_file.add_coordinate(self.x_coordname, unit=self.x_unit) self._data_x.add(self.x_vec) self._data_y = self._data_file.add_coordinate(self.y_coordname, unit=self.y_unit) self._data_y.add(self.y_vec) for i in range(self.num_traces): self._data.append( self._data_file.add_value_box(self.traces_names[i], x=self._data_x, y=self.data_y, z=self._data_freq, unit=self.units[i], save_timestamp=True)) if self.log_function != None: # use logging self._log_value = [] for i in range(len(self.log_function)): self._log_value.append( self._data_file.add_value_vector( self.log_name[i], x=self._data_x, unit=self.log_unit[i], dtype=self.log_dtype[i])) if self.comment: self._data_file.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
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'])
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) self._measurement_object.uuid = self._data_file._uuid self._measurement_object.hdf_relpath = self._data_file._relpath self._measurement_object.instruments = qt.instruments.get_instruments() self._measurement_object.save() self._mo = self._data_file.add_textlist('measurement') self._mo.append(self._measurement_object.get_JSON()) # write logfile and instrument settings self._write_settings_dataset() self._log = waf.open_log_file(self._data_file.get_filepath()) if not self._scan_time: self._data_freq = self._data_file.add_coordinate('frequency', unit = 'Hz') self._data_freq.add(self._freqpoints) if self._scan_1D: self._data_real = self._data_file.add_value_vector('real', x = self._data_freq, unit = '', save_timestamp = True) self._data_imag = self._data_file.add_value_vector('imag', x = self._data_freq, unit = '', save_timestamp = True) self._data_amp = self._data_file.add_value_vector('amplitude', x = self._data_freq, unit = 'arb. unit', save_timestamp = True) self._data_pha = self._data_file.add_value_vector('phase', x = self._data_freq, unit = 'rad', save_timestamp = True) if self._scan_2D: self._data_x = self._data_file.add_coordinate(self.x_coordname, unit = self.x_unit) self._data_x.add(self.x_vec) self._data_amp = self._data_file.add_value_matrix('amplitude', x = self._data_x, y = self._data_freq, unit = 'arb. unit', save_timestamp = True) self._data_pha = self._data_file.add_value_matrix('phase', x = self._data_x, y = self._data_freq, unit='rad', save_timestamp = True) if self.log_function != None: #use logging self._log_value = [] for i in range(len(self.log_function)): self._log_value.append(self._data_file.add_value_vector(self.log_name[i], x = self._data_x, unit = self.log_unit[i], dtype=self.log_dtype[i])) if self._nop < 10: """creates view: plot middle point vs x-parameter, for qubit measurements""" self._data_amp_mid = self._data_file.add_value_vector('amplitude_midpoint', unit = 'arb. unit', x = self._data_x, save_timestamp = True) self._data_pha_mid = self._data_file.add_value_vector('phase_midpoint', unit = 'rad', x = self._data_x, save_timestamp = True) #self._view = self._data_file.add_view("amplitude vs. " + self.x_coordname, x = self._data_x, y = self._data_amp[self._nop/2]) if self._scan_3D: self._data_x = self._data_file.add_coordinate(self.x_coordname, unit = self.x_unit) self._data_x.add(self.x_vec) self._data_y = self._data_file.add_coordinate(self.y_coordname, unit = self.y_unit) self._data_y.add(self.y_vec) if self._nop == 0: #saving in a 2D matrix instead of a 3D box HR: does not work yet !!! test things before you put them online. self._data_amp = self._data_file.add_value_matrix('amplitude', x = self._data_x, y = self._data_y, unit = 'arb. unit', save_timestamp = False) self._data_pha = self._data_file.add_value_matrix('phase', x = self._data_x, y = self._data_y, unit = 'rad', save_timestamp = False) else: self._data_amp = self._data_file.add_value_box('amplitude', x = self._data_x, y = self._data_y, z = self._data_freq, unit = 'arb. unit', save_timestamp = False) self._data_pha = self._data_file.add_value_box('phase', x = self._data_x, y = self._data_y, z = self._data_freq, unit = 'rad', save_timestamp = False) if self.log_function != None: #use logging self._log_value = [] for i in range(len(self.log_function)): self._log_value.append(self._data_file.add_value_vector(self.log_name[i], x = self._data_x, unit = self.log_unit[i], dtype=self.log_dtype[i])) if self._scan_time: self._data_freq = self._data_file.add_coordinate('frequency', unit = 'Hz') self._data_freq.add([self.vna.get_centerfreq()]) self._data_time = self._data_file.add_coordinate('time', unit = 's') self._data_time.add(np.arange(0,self._nop,1)*self.vna.get_sweeptime()/(self._nop-1)) self._data_x = self._data_file.add_coordinate('trace_number', unit = '') self._data_x.add(np.arange(0, self.number_of_timetraces, 1)) self._data_amp = self._data_file.add_value_matrix('amplitude', x = self._data_x, y = self._data_time, unit = 'lin. mag.', save_timestamp = False) self._data_pha = self._data_file.add_value_matrix('phase', x = self._data_x, y = self._data_time, unit = 'rad.', save_timestamp = False) if self.comment: self._data_file.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
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'])