def process_data(self): self.proc_data_dict = OrderedDict() normalize_to_cal_points = self.options_dict.get( 'normalize_to_cal_points', True) cal_points = [ [[-4, -3], [-2, -1]], [[-4, -2], [-3, -1]], ] for idx in [0, 1]: yvals = list(self.raw_data_dict['measured_values_ord_dict'].values())[ idx][0] self.proc_data_dict['ylabel_{}'.format(idx)] = \ self.raw_data_dict['value_names'][0][idx] self.proc_data_dict['yunit'] = self.raw_data_dict['value_units'][0][idx] if normalize_to_cal_points: yvals = a_tools.normalize_data_v3(yvals, cal_zero_points=cal_points[idx][0], cal_one_points=cal_points[idx][1]) self.proc_data_dict['yvals_{}'.format(idx)] = yvals y0 = self.proc_data_dict['yvals_0'] y1 = self.proc_data_dict['yvals_1'] p_success = ((y0[0]*y1[0]) + (1-y0[1])*y1[1] + (y0[2])*(1-y1[2]) + (1-y0[3])*(1-y1[3]))/4 print(y0[0]*y1[0]) print((1-y0[1])*y1[1]) print((y0[2])*(1-y1[2])) print((1-y0[3])*(1-y1[3])) self.proc_data_dict['p_success'] = p_success
def process_data(self): """ selects the relevant acq channel based on "ch_idx_osc" and "ch_idx_spec" in the options dict and then splits the data for the off and on cases """ self.proc_data_dict = OrderedDict() # The channel containing the data must be specified in the options dict ch_idx_spec = self.options_dict.get('ch_idx_spec', 0) ch_idx_osc = self.options_dict.get('ch_idx_osc', 1) normalize_to_cal_points = self.options_dict.get( 'normalize_to_cal_points', True) cal_points = [ [[-4, -3], [-2, -1]], [[-4, -2], [-3, -1]], ] i = 0 for idx, type_str in zip([ch_idx_osc, ch_idx_spec], ['osc', 'spec']): yvals = list(self.raw_data_dict['measured_values_ord_dict'].values( ))[idx][0] self.proc_data_dict['ylabel_{}'.format( type_str)] = self.raw_data_dict['value_names'][0][idx] self.proc_data_dict['yunit'] = self.raw_data_dict['value_units'][ 0][idx] if normalize_to_cal_points: yvals = a_tools.normalize_data_v3( yvals, cal_zero_points=cal_points[i][0], cal_one_points=cal_points[i][1]) i += 1 self.proc_data_dict['yvals_{}_off'.format( type_str)] = yvals[::2] self.proc_data_dict['yvals_{}_on'.format( type_str)] = yvals[1::2] self.proc_data_dict['xvals_off'] = self.raw_data_dict['xvals'][ 0][::2] self.proc_data_dict['xvals_on'] = self.raw_data_dict['xvals'][ 0][1::2] else: self.proc_data_dict['yvals_{}_off'.format( type_str)] = yvals[::2] self.proc_data_dict['yvals_{}_on'.format( type_str)] = yvals[1::2] self.proc_data_dict['xvals_off'] = self.raw_data_dict['xvals'][ 0][::2] self.proc_data_dict['xvals_on'] = self.raw_data_dict['xvals'][ 0][1::2]
def process_data(self): self.proc_data_dict = OrderedDict() idx = self.ch_idx normalize_to_cal_points = self.options_dict.get( 'normalize_to_cal_points', False) cal_points = [ [[-4, -3], [-2, -1]], [[-4, -2], [-3, -1]], ] yvals = list( self.raw_data_dict['measured_values_ord_dict'].values())[idx][0] if normalize_to_cal_points: yvals = a_tools.normalize_data_v3( yvals, cal_zero_points=cal_points[idx][0], cal_one_points=cal_points[idx][1]) self.proc_data_dict['yvals'] = yvals self.proc_data_dict['ylabel'] = self.raw_data_dict['value_names'][0][idx] self.proc_data_dict['yunit'] = self.raw_data_dict['value_units'][0][idx]
def process_data(self): ''' This takes care of rotating and normalizing the data if required. this should work for several input types. - I/Q values (2 quadratures + cal points) - weight functions (1 quadrature + cal points) - counts (no cal points) There are several options possible to specify the normalization using the options dict. cal_points (tuple) of indices of the calibration points zero_coord, one_coord ''' cal_points = self.options_dict.get('cal_points', None) zero_coord = self.options_dict.get('zero_coord', None) one_coord = self.options_dict.get('one_coord', None) # FIXME THIS IS A HACK related to recent issue self.data_dict = self.raw_data_dict if cal_points is None: # default for all standard Timedomain experiments cal_points = [list(range(-4, -2)), list(range(-2, 0))] if len(self.raw_data_dict['measured_values']) == 1: # if only one weight function is used rotation is not required self.proc_data_dict['corr_data'] = a_tools.normalize_data_v3( self.raw_data_dict['measured_values'][0], cal_zero_points=cal_points[0], cal_one_points=cal_points[1]) else: self.proc_data_dict['corr_data'], zero_coord, one_coord = \ a_tools.rotate_and_normalize_data( data=self.raw_data_dict['measured_values'][0:2], zero_coord=zero_coord, one_coord=one_coord, cal_zero_points=cal_points[0], cal_one_points=cal_points[1])
def process_data(self): """ selects the relevant acq channel based on "ch_idx_osc" and "ch_idx_spec" in the options dict and then splits the data for the off and on cases """ self.proc_data_dict = OrderedDict() # values stored in quantities of interest will be saved in the data file self.proc_data_dict['quantities_of_interest'] = {} qoi = self.proc_data_dict['quantities_of_interest'] # The channel containing the data must be specified in the options dict ch_idx_spec = self.options_dict.get('ch_idx_spec', 0) ch_idx_osc = self.options_dict.get('ch_idx_osc', 1) qoi['ch_idx_osc'] = ch_idx_osc qoi['ch_idx_spec'] = ch_idx_spec normalize_to_cal_points = self.options_dict.get( 'normalize_to_cal_points', True) if self.cal_points == 'gef': # calibration point indices are when ignoring the f-state cal pts cal_points = [ [[-7, -6], [-5, -4], [-2, -1]], # oscillating qubit [[-7, -5], [-6, -4], [-3, -1]], # spec qubits ] elif self.cal_points == 'ge': # calibration point indices are when ignoring the f-state cal pts cal_points = [ [[-4, -3], [-2, -1]], # spec qubit [[-4, -2], [-3, -1]], # oscillating qubits ] for idx, type_str in zip([ch_idx_osc, ch_idx_spec], ['osc', 'spec']): yvals = list(self.raw_data_dict['measured_values_ord_dict'].values())[ idx][0] self.proc_data_dict['ylabel_{}'.format( type_str)] = self.raw_data_dict['value_names'][0][idx] self.proc_data_dict['yunit'] = self.raw_data_dict['value_units'][0][idx] if normalize_to_cal_points: yvals = a_tools.normalize_data_v3( yvals, cal_zero_points=cal_points[idx][0], cal_one_points=cal_points[idx][1]) self.proc_data_dict['yvals_{}_off'.format( type_str)] = yvals[::2] self.proc_data_dict['yvals_{}_on'.format( type_str)] = yvals[1::2] self.proc_data_dict['xvals_off'] = self.raw_data_dict['xvals'][0][::2] self.proc_data_dict['xvals_on'] = self.raw_data_dict['xvals'][0][1::2] else: self.proc_data_dict['yvals_{}_off'.format( type_str)] = yvals[::2] self.proc_data_dict['yvals_{}_on'.format( type_str)] = yvals[1::2] self.proc_data_dict['xvals_off'] = self.raw_data_dict['xvals'][0][::2] self.proc_data_dict['xvals_on'] = self.raw_data_dict['xvals'][0][1::2] V0 = np.mean(yvals[cal_points[idx][0]]) V1 = np.mean(yvals[cal_points[idx][1]]) if self.cal_points != 'gef': V2 = np.mean(yvals[cal_points[idx][2]]) else: V2 = V1 self.proc_data_dict['V0_{}'.format(type_str)] = V0 self.proc_data_dict['V1_{}'.format(type_str)] = V1 self.proc_data_dict['V2_{}'.format(type_str)] = V2 if type_str == 'osc': # The offset in the oscillation is the leakage indicator SI = [np.mean(self.proc_data_dict[ 'yvals_{}_on'.format(type_str)])] # The mean of the oscillation SI is the same as SX SX = SI P0, P1, P2, M_inv = populations_using_rate_equations( SI, SX, V0, V1, V2) # Leakage based on the average of the oscillation qoi['leak_avg'] = P2[0] # list with 1 elt...