示例#1
0
def fingerprint(a=None,
                folder=None,
                disp_sim_spin=True,
                N=[8],
                el_trans='min',
                HF_perp=None,
                HF_par=None,
                B_list=[418]):

    # allowed params:
    # el_trans = ['min', 'plus']
    # N = 8, 16, 32, 64
    if (a == None) | (folder == None):
        print 'Folder path or data (a) missing fool!'
        return

    ### Load hyperfine params
    if disp_sim_spin == True:
        if (HF_perp == None) & (HF_par == None):
            HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms=el_trans,
                                                            NV='Pippin')
        elif el_trans == 'min':
            HF_par = [x * (-1) for x in HF_par]

        # security check could be removed
        if len(HF_perp) == len(HF_par):
            pass
        else:
            print 'Unequal amount of Parallel and Perpendicular HF parameters'

        print 'HF_perp = ' + str(HF_perp)
        print 'HF_par = ' + str(HF_par)

    else:
        print 'No HF simulation'

    print 'N = ' + str(N)

    for ii in range(len(N)):

        # bad way of dealing with complete loaded data
        if N[ii] == 8:
            i = 0
        elif N[ii] == 16:
            i = 1
        elif N[ii] == 32:
            i = 2
        elif N[ii] == 64:
            i = 3
        else:
            print 'N is not a standard value (8, 16, 32, 64)'
            return

        print i

        # print 'loading data'
        # a, folder = fp_funcs.load_mult_dat(timestamps[el_trans]['N'+str(N[i])],
        #             number_of_msmts = 100,
        #             x_axis_step     = 0.1,
        #             x_axis_start    = 3.5,
        #             x_axis_pts_per_msmnt= 51,
        #             ssro_calib_folder=ssro_calib_folder)

        # print 'data N' +str(N[i]) + ' loaded'
        ##########################
        ### 	 plot data ######
        #########################

        #lw default 0.4
        fig = a[i].default_fig(figsize=(35, 5))
        ax = a[i].default_ax(fig)
        ax.set_xlim(3.5, 13.5)
        start, end = ax.get_xlim()
        ax.xaxis.set_ticks(np.arange(start, end, 0.5))
        ax.set_ylim(-0.05, 1.05)
        ax.plot(a[i].sweep_pts, a[i].p0, '.-k', lw=0.4, label='data')

        #######################
        # Add simulated spins #
        #######################

        if disp_sim_spin == True:
            print 'Starting Simulation for N = ' + str(
                N[ii]) + ' on transition ' + str(el_trans)
            colors = cm.rainbow(np.linspace(0, 1, len(HF_par) + len(B_list)))
            for jj, B in enumerate(B_list):
                tau_lst = np.linspace(3.5e-6, 22.5e-6, 5000)
                Mt16 = SC.dyn_dec_signal(HFs_par=HF_par,
                                         HFs_orth=HF_perp,
                                         B_field=B,
                                         N=N[ii],
                                         tau=tau_lst)
                FP_signal16 = ((Mt16 + 1) / 2)

                # colors = ['m', 'b', 'r', 'g', 'c']
                for tt in range(len(HF_par)):
                    ax.plot(tau_lst * 1e6,
                            FP_signal16[tt, :],
                            '-',
                            lw=1,
                            label=str(tt + 1) + ': B = ' + str(B) +
                            ': HF_par = ' + str(HF_par[tt]) + '; HF_perp = ' +
                            str(HF_perp[tt]),
                            color=colors[tt + jj])

                print folder[i]
            plt.legend(loc=4)
def fingerprint(a = None, folder = None, disp_sim_spin = True, N = [8], el_trans = 'min', 
	HF_perp = None, HF_par = None, B_list = [418]):

	# allowed params:
	# el_trans = ['min', 'plus']
	# N = 8, 16, 32, 64
	if (a == None) | (folder == None):
		print 'Folder path or data (a) missing fool!'
		return

	### Load hyperfine params	
	if disp_sim_spin == True:	
		if (HF_perp == None) & (HF_par== None):
			HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms = el_trans, NV = 'Pippin')
		elif el_trans == 'min':
			HF_par =  [x * (-1) for x in HF_par]

		# security check could be removed
		if len(HF_perp) == len(HF_par):
			pass
		else:
			print 'Unequal amount of Parallel and Perpendicular HF parameters'

		print 'HF_perp = ' + str(HF_perp)
		print 'HF_par = ' + str(HF_par)

	else:
		print 'No HF simulation'

	
	print 'N = ' + str(N)

	for ii in range(len(N)):

		# bad way of dealing with complete loaded data
		if  N[ii] == 8:
			i = 0
		elif N[ii] == 16:
			i = 1
		elif N[ii] == 32:
			i = 2
		elif N[ii] == 64:
			i = 3
		else:
			print 'N is not a standard value (8, 16, 32, 64)'
			return

		print i
		
		# print 'loading data'
		# a, folder = fp_funcs.load_mult_dat(timestamps[el_trans]['N'+str(N[i])], 
		#             number_of_msmts = 100,
		#             x_axis_step     = 0.1,
		#             x_axis_start    = 3.5,
		#             x_axis_pts_per_msmnt= 51,
		#             ssro_calib_folder=ssro_calib_folder)

		# print 'data N' +str(N[i]) + ' loaded'
		##########################
		### 	 plot data ######
		#########################
		
		#lw default 0.4
		fig = a[i].default_fig(figsize=(35,5))
		ax = a[i].default_ax(fig)
		ax.set_xlim(3.5,13.5)
		start, end = ax.get_xlim()
		ax.xaxis.set_ticks(np.arange(start, end, 0.5))
		ax.set_ylim(-0.05,1.05)
		ax.plot(a[i].sweep_pts, a[i].p0, '.-k', lw=0.4,label = 'data')


		#######################
		# Add simulated spins #
		#######################

		if disp_sim_spin == True:
			print 'Starting Simulation for N = ' + str(N[ii]) + ' on transition ' + str(el_trans) 
			colors = cm.rainbow(np.linspace(0, 1, len(HF_par)+len(B_list)))
			for jj,B in enumerate(B_list):	
				tau_lst = np.linspace(3.5e-6, 22.5e-6, 5000)
				Mt16 = SC.dyn_dec_signal(HFs_par = HF_par, HFs_orth = HF_perp,
					B_field = B, N = N[ii], tau = tau_lst)
				FP_signal16 = ((Mt16+1)/2)
				
				# colors = ['m', 'b', 'r', 'g', 'c']
				for tt in range(len(HF_par)):
				  ax.plot(tau_lst*1e6, FP_signal16[tt,:] ,'-',lw=1,label =  str(tt + 1) + ': B = ' + str(B) + 
				  	': HF_par = ' +str(HF_par[tt]) + '; HF_perp = ' +str(HF_perp[tt]), color = colors[tt+jj])
				

				print folder[i]
			plt.legend(loc=4)
示例#3
0
def fingerprint(disp_sim_spin=True, RO='x'):

    ###################
    ## Data location ##
    ###################

    timestamp = '20160112_192510'
    ssro_calib_folder = 'd:\\measuring\\data\\20160107\\172632_AdwinSSRO_SSROCalibration_Pippin_SIL1'
    a, folder = fp_funcs.load_mult_dat(timestamp,
                                       number_of_msmts=120,
                                       x_axis_step=0.1,
                                       x_axis_start=3.5,
                                       x_axis_pts_per_msmnt=51,
                                       ssro_calib_folder=ssro_calib_folder)

    #######################
    # Add simulated spins #
    #######################

    if disp_sim_spin == True:

        print 'Starting Simulation'
        HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms='min', NV='Pippin')
        print 'HF_perp = ' + str(HF_perp)
        print 'HF_par = ' + str(HF_par)
        B_Field = 417.268
        tau_lst = np.linspace(0, 72e-6, 10000)
        Mt16 = SC.dyn_dec_signal(HFs_par=HF_par,
                                 HFs_orth=HF_perp,
                                 B_field=B_Field,
                                 N=16,
                                 tau=tau_lst)
        FP_signal16 = ((Mt16 + 1) / 2)

    ###############
    ## Plotting ###
    ###############

    fig = a.default_fig(figsize=(35, 5))
    ax = a.default_ax(fig)
    ax.set_xlim(3.5, 15.5)
    start, end = ax.get_xlim()
    ax.xaxis.set_ticks(np.arange(start, end, 0.5))

    ax.set_ylim(-0.05, 1.05)

    ax.plot(a.sweep_pts, a.p0, '.-k', lw=0.4, label='data')  #N = 16

    if disp_sim_spin == True:
        colors = cm.rainbow(np.linspace(0, 1, len(HF_par)))
        for tt in range(len(HF_par)):
            ax.plot(tau_lst * 1e6,
                    FP_signal16[tt, :],
                    '-',
                    lw=.8,
                    label='spin' + str(tt + 1),
                    color=colors[tt])
    if False:
        tot_signal = np.ones(len(tau_lst))
        for tt in range(len(HF_par)):
            tot_signal = tot_signal * Mt16[tt, :]
        fin_signal = (tot_signal + 1) / 2.0
        ax.plot(tau_lst * 1e6, fin_signal, ':g', lw=.8, label='tot')

    plt.legend(loc=4)

    print folder
    plt.savefig(os.path.join(folder,
                             str(disp_sim_spin) + 'fingerprint.pdf'),
                format='pdf')
    plt.savefig(os.path.join(folder,
                             str(disp_sim_spin) + 'fingerprint.png'),
                format='png')
def fingerprint(disp_sim_spin = True):
    

    ###################
    ## Data location ##
    ###################
    
    timestamp ='20160110_121238'
    ssro_calib_folder = 'd:\\measuring\\data\\20160107\\172632_AdwinSSRO_SSROCalibration_Pippin_SIL1'
    a, folder = fp_funcs.load_mult_dat(timestamp, 
              number_of_msmts = 150,
              x_axis_step     = 0.1,
              x_axis_start    = 3.5,
              x_axis_pts_per_msmnt= 51,
              ssro_calib_folder=ssro_calib_folder)

    #######################
    # Add simulated spins #
    #######################

    if disp_sim_spin == True:
        print 'Starting Simulation'  
        HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms = 'plus', NV = 'Pippin')
        print 'HF_perp = ' + str(HF_perp)
        print 'HF_par = ' + str(HF_par)
        B_Field = 417.268
        tau_lst = np.linspace(0, 20e-6, 5000)
        Mt16 = SC.dyn_dec_signal(HFs_par = HF_par, HFs_orth = HF_perp,
          B_field = B_Field, N = 8, tau = tau_lst)
        FP_signal16 = ((Mt16+1)/2)

    
    ############
    ## Plotting ###
    ############

    fig = a.default_fig(figsize=(35,5))
    ax = a.default_ax(fig)
    ax.set_xlim(a.sweep_pts[0],a.sweep_pts[-1])
    start, end = ax.get_xlim()
    ax.xaxis.set_ticks(np.arange(start, end, 0.5))

    ax.set_ylim(-0.05,1.05)
   
    ax.plot(a.sweep_pts, a.p0, '.-k', lw=0.4,label = 'data') #N = 16
    
    if disp_sim_spin == True:
      colors = cm.rainbow(np.linspace(0, 1, len(HF_par)))
      for tt in range(len(HF_par)):
        ax.plot(tau_lst*1e6, FP_signal16[tt,:] ,'-',lw=.8,label = 'spin' + str(tt+1), color = colors[tt])
    if False:
        tot_signal = np.ones(len(tau_lst))
        for tt in range(len(HF_par)):
          tot_signal = tot_signal * Mt16[tt,:]
        fin_signal = (tot_signal+1)/2.0   
        ax.plot(tau_lst*1e6, fin_signal,':g',lw=.8,label = 'tot')
    

    plt.legend(loc=4)

    print folder
    plt.savefig(os.path.join(folder, str(disp_sim_spin)+'fingerprint_short.pdf'),
        format='pdf')
    plt.savefig(os.path.join(folder, str(disp_sim_spin)+'fingerprint_short.png'),
        format='png')

    
def fingerprint(disp_sim_spin = True,xlim=None,xticks=0.5):
    
    ###################
    ## Data location ##
    ###################
    
    timestamp ='20160112_234557'#'20160111_165950'#
    ssro_calib_folder = 'd:\\measuring\\data\\20160107\\172632_AdwinSSRO_SSROCalibration_Pippin_SIL1'
    a, folder = fp_funcs.load_mult_dat(timestamp, 
              number_of_msmts = 120,
              x_axis_step     = 0.1,
              x_axis_start    = 3.5,
              x_axis_pts_per_msmnt= 51,
              ssro_calib_folder=ssro_calib_folder)


    #######################
    # Add simulated spins #
    #######################

    if disp_sim_spin == True:
            
            print 'Starting Simulation'  
            HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms = 'min', NV = 'Pippin')
            print 'HF_perp = ' + str(HF_perp)
            print 'HF_par = ' + str(HF_par)
            B_Field = 417.268
            tau_lst = np.linspace(0, 72e-6, 10000)
            Mt16 = SC.dyn_dec_signal(HFs_par = HF_par, HFs_orth = HF_perp,
              B_field = B_Field, N = 64, tau = tau_lst)
            FP_signal16 = ((Mt16+1)/2)
 
    ###############
    ## Plotting ###
    ###############

    fig = a.default_fig(figsize=(35,5))
    ax = a.default_ax(fig)
    if xlim == None:
        ax.set_xlim(3.5,15.5)
    else:
        ax.set_xlim(xlim)
    start, end = ax.get_xlim()
    ax.xaxis.set_ticks(np.arange(start, end, xticks))

    ax.set_ylim(-0.05,1.05)
    print a.sweep_pts
    ax.plot(a.sweep_pts, a.p0, '.-k', lw=0.4,label = 'data') #N = 16
    # ax.plot(b.sweep_pts, b.p0, '.-b', lw=0.4,label = 'data') #N = 16

    if disp_sim_spin == True:
      colors = cm.rainbow(np.linspace(0, 1, len(HF_par)))
      for tt in range(len(HF_par)):
        ax.plot(tau_lst*1e6, FP_signal16[tt,:] ,'-',lw=.8,label = 'spin' + str(tt+1), color = colors[tt])
    
    # # lOOK AT THIS PART. SEEMS TO HAVE NO FUNCTION
    # if False:
    #     tot_signal = np.ones(len(tau_lst))
    #     for tt in range(len(HF_par)):
    #       tot_signal = tot_signal * Mt16[tt,:]
    #     fin_signal = (tot_signal+1)/2.0   
    #     ax.plot(tau_lst*1e6, fin_signal,':g',lw=.8,label = 'tot')
    

    plt.legend(loc=4)

    print folder
    plt.savefig(os.path.join(folder, str(disp_sim_spin)+'fingerprint.pdf'),
        format='pdf')
    plt.savefig(os.path.join(folder, str(disp_sim_spin)+'fingerprint.png'),
        format='png')
示例#6
0
def fingerprint(disp_sim_spin=True,
                N=[8],
                el_trans='min',
                HF_perp=None,
                HF_par=None):

    # allowed params:
    # el_trans = ['min', 'plus']
    # N = 8, 16, 32, 64

    ###################
    ## Data location ##
    ###################

    timestamps = {}
    timestamps['min'] = {
        'N8': '20160229_114914',
        'N16': '20160229_133036',
        'N32': '20160229_152201',
        'N64': '20160229_174524'
    }
    timestamps['plus'] = {
        'N8': '20160110_121238',
        'N16': '20160110_143232',
        'N32': '20160110_170758',
        'N64': '20160110_202511'
    }
    ssro_calib_folder = 'd:\\measuring\\data\\20160107\\172632_AdwinSSRO_SSROCalibration_Pippin_SIL1'

    ### Load hyperfine params
    if disp_sim_spin == True:
        if (HF_perp == None) & (HF_par == None):
            HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms=el_trans,
                                                            NV='Pippin')
        elif el_trans == 'min':
            HF_par = [x * (-1) for x in HF_par]

        # security check could be removed
        if len(HF_perp) == len(HF_par):
            pass
        else:
            print 'Unequal amount of Parallel and Perpendicular HF parameters'

        print 'HF_perp = ' + str(HF_perp)
        print 'HF_par = ' + str(HF_par)

    else:
        print 'No HF simulation'

    a = []
    folder = []
    print N
    for i in range(len(N)):
        print i
        # load data removing append for memory error!
        print 'loading data'
        a, folder = fp_funcs.load_mult_dat(timestamps[el_trans]['N' +
                                                                str(N[i])],
                                           number_of_msmts=100,
                                           x_axis_step=0.1,
                                           x_axis_start=3.5,
                                           x_axis_pts_per_msmnt=51,
                                           ssro_calib_folder=ssro_calib_folder)

        print 'data N' + str(N[i]) + ' loaded'
        ##########################
        ### 	 plot data ######
        #########################

        fig = a.default_fig(figsize=(35, 5))
        ax = a.default_ax(fig)
        ax.set_xlim(3.5, 13.5)
        start, end = ax.get_xlim()
        ax.xaxis.set_ticks(np.arange(start, end, 0.5))
        ax.set_ylim(-0.05, 1.05)
        ax.plot(a.sweep_pts, a.p0, '.-k', lw=0.4, label='data')

        #######################
        # Add simulated spins #
        #######################

        if disp_sim_spin == True:
            print 'Starting Simulation for N = ' + str(
                N[i]) + ' on transtion ' + str(el_trans)
            B_Field = 417.22
            tau_lst = np.linspace(0, 72e-6, 10000)
            Mt16 = SC.dyn_dec_signal(HFs_par=HF_par,
                                     HFs_orth=HF_perp,
                                     B_field=B_Field,
                                     N=N[i],
                                     tau=tau_lst)
            FP_signal16 = ((Mt16 + 1) / 2)

            colors = cm.rainbow(np.linspace(0, 1, len(HF_par)))
            for tt in range(len(HF_par)):
                ax.plot(tau_lst * 1e6,
                        FP_signal16[tt, :],
                        '-',
                        lw=1.5,
                        label=str(tt + 1) + ': HF_par = ' + str(HF_par[tt]) +
                        '; HF_perp = ' + str(HF_perp[tt]),
                        color=colors[tt])
            plt.legend(loc=4)

            print folder
            plt.savefig(os.path.join(folder,
                                     str(disp_sim_spin) + 'fingerprint.pdf'),
                        format='pdf')
            plt.savefig(os.path.join(folder,
                                     str(disp_sim_spin) + 'fingerprint.png'),
                        format='png')
def fingerprint(a = None, folder = None, disp_sim_spin = True, N = [8], 
	el_trans = 'min', HF_perp = None, HF_par = None,xlim=None,xticks=None):

	# allowed params:
	# el_trans = ['min', 'plus']
	# N = 8, 16, 32, 64
	if (a == None) | (folder == None):
		print 'Folder path or data (a) missing fool!'
		return

	### Load hyperfine params	
	if disp_sim_spin == True:	
		if (HF_perp == None) & (HF_par == None):
			HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms = el_trans, NV = 'Pippin_SIL3')
		elif el_trans == 'min':
			# needs to be flipped for simulation
			HF_par =  [x * (-1) for x in HF_par]

		# security check could be removed
		if len(HF_perp) == len(HF_par):
			pass
		else:
			print 'Unequal amount of Parallel and Perpendicular HF parameters'

		print 'HF_perp = ' + str(HF_perp)
		print 'HF_par = ' + str(HF_par)

	else:
		print 'No HF simulation'

	
	print 'N = ' + str(N)

	N_keys = ['N'+str(pulse_no) for pulse_no in N]

	for pulses,data,datafolder in zip(N,[a[x] for x in N_keys],[folder[x] for x in N_keys]):

		##########################
		### 	 plot data ######
		#########################
		
		if xlim == None:
			fig = data.default_fig(figsize=(35,5))
			ax = data.default_ax(fig)
			ax.set_xlim(3.5,23.5)
			xlim = [3.5,23.5]
		else:
			# 5+30*(xlim[1]-xlim[0])
			# 5+5*(xlim[1]-xlim[0])
			fig = data.default_fig(figsize=(5+2*(xlim[1]-xlim[0]),5))
			ax = data.default_ax(fig)
			ax.set_xlim(xlim)

		start, end = ax.get_xlim()
		if xticks == None:
			ax.xaxis.set_ticks(np.arange(start, end, 0.5))
		else:
			ax.xaxis.set_ticks(np.arange(start, end, xticks))
		ax.set_ylim(-0.05,1.05)
		ax.plot(data.sweep_pts, data.p0, '.-k', lw=0.4,label = 'data')
		print 'these are the sweep_pts',data.sweep_pts

		#######################
		# Add simulated spins #
		#######################
		if disp_sim_spin == True:
			print 'Starting Simulation for N = ' + str(pulses) + ' on transition ' + str(el_trans) 
			B_Field = 417.05
			print B_Field
			tau_lst = np.linspace(xlim[0]*1e-6, xlim[1]*1e-6, 2000)
			Mt16 = SC.dyn_dec_signal(HFs_par = HF_par, HFs_orth = HF_perp,
				B_field = B_Field, N = pulses, tau = tau_lst)
			FP_signal16 = ((Mt16+1)/2)
			

			# plot simulated results
			# colors = ['m', 'b', 'r', 'g', 'c']
			colors = cm.rainbow(np.linspace(0, 1, len(HF_par)))

			
			if el_trans == 'min':
				# flip sign back after simulation for correct graph legend
				HF_par =  [x * (-1) for x in HF_par]
			for tt in range(len(HF_par)):
			  ax.plot(tau_lst*1e6, FP_signal16[tt,:] ,'-',lw=1,label = str(tt + 1) + ': HF_par = ' +str(HF_par[tt]) + '; HF_perp = ' +str(HF_perp[tt]), color = colors[tt])
			plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)

		print datafolder
		plt.savefig(os.path.join(datafolder, str(disp_sim_spin)+'fingerprint.pdf'),
		    format='pdf')
		plt.savefig(os.path.join(datafolder, str(disp_sim_spin)+'fingerprint.png'),
		    format='png')
def fingerprint_v2(a = None, folder = None, disp_sim_spin = True, N = [8], 
	el_trans = 'min', HF_perp = None, HF_par = None,xlim=None,xticks=None):

	# allowed params:
	# el_trans = ['min', 'plus']
	# N = 8, 16, 32, 64
	if (a == None) | (folder == None):
		print 'Folder path or data (a) missing fool!'
		return

	### Load hyperfine params	
	if disp_sim_spin == True:	
		if (HF_perp == None) & (HF_par == None):
			HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms = el_trans, NV = 'Pippin_SIL3')
		elif el_trans == 'min':
			# needs to be flipped for simulation
			HF_par =  [x * (-1) for x in HF_par]

		# security check could be removed
		if len(HF_perp) == len(HF_par):
			pass
		else:
			print 'Unequal amount of Parallel and Perpendicular HF parameters'

		print 'HF_perp = ' + str(HF_perp)
		print 'HF_par = ' + str(HF_par)

	else:
		print 'No HF simulation'

	
	print 'N = ' + str(N)

	N_keys = ['N'+str(pulse_no) for pulse_no in N]

	for pulses,data,datafolder in zip(N,[a[x] for x in N_keys],[folder[x] for x in N_keys]):

		##########################
		### 	 plot data ######
		#########################
		
		if xlim == None:
			fig = data.default_fig(figsize=(35,5))
			ax = data.default_ax(fig)
			ax.set_xlim(3.5,23.5)
			xlim = [3.5,23.5]
		else:
			# 5+30*(xlim[1]-xlim[0])
			# 5+5*(xlim[1]-xlim[0])
			fig = data.default_fig(figsize=(5+2*(xlim[1]-xlim[0]),5))
			ax = data.default_ax(fig)
			ax.set_xlim(xlim)

		start, end = ax.get_xlim()
		if xticks == None:
			ax.xaxis.set_ticks(np.arange(start, end, 0.5))
		else:
			ax.xaxis.set_ticks(np.arange(start, end, xticks))
		ax.set_ylim(-0.05,1.05)
		ax.plot(data.sweep_pts, data.p0, '.-k', lw=0.4)#,label = 'Data')

		#######################
		# Add simulated spins #
		#######################
		if disp_sim_spin == True:
			# print 'Starting Simulation for N = ' + str(pulses) + ' on transition ' + str(el_trans) 
			B_Field = kw.pop('B_field',414.2)
			# print B_Field
			tau_lst = np.linspace(xlim[0]*1e-6, xlim[1]*1e-6, 2000)
			Mt16 = SC.dyn_dec_signal(HFs_par = HF_par, HFs_orth = HF_perp,
				B_field = B_Field, N = pulses, tau = tau_lst)
			FP_signal16 = ((Mt16+1)/2)
			

			# plot simulated results
			# colors = ['m', 'b', 'r', 'g', 'c']
			colors = cm.rainbow(np.linspace(0, 1, len(HF_par)))

			
			if el_trans == 'min':
				# flip sign back after simulation for correct graph legend
				HF_par =  [x * (-1) for x in HF_par]
			for tt in range(len(HF_par)):
				# ax.text(tau_c,h_c,str(tt+1),color = colors[tt])# better in illustrator
				ax.plot(tau_lst*1e6, FP_signal16[tt,:] ,'-',lw=1,label = 'C' + str(tt + 1), color = colors[tt])
			plt.legend(loc=3, borderaxespad=0.,frameon = False)

		plt.title('Fingerprint for N = ' +str(pulses) + ' pulses')
		plt.ylabel(ur'$\langle X_e \rangle$',fontsize = 20)
		plt.xlabel(ur'$\tau (\mu s)$',fontsize = 20)


		print datafolder
		plt.savefig(os.path.join(datafolder, str(disp_sim_spin)+'fingerprint.pdf'),
		    format='pdf')
		plt.savefig(os.path.join(datafolder, str(disp_sim_spin)+'fingerprint.png'),
		    format='png')
def fingerprint(a = None, folder = None, disp_sim_spin = True, N = [8], 
	el_trans = 'min', HF_perp = None, HF_par = None,xlim=None,xticks=None,**kw):

	# allowed params:
	# el_trans = ['min', 'plus']
	# N = 8, 16, 32, 64
	if (a == None) | (folder == None):
		print 'Folder path or data (a) missing fool!'
		return

	### Load hyperfine params	
	if disp_sim_spin == True:	
		if (HF_perp == None) & (HF_par == None):
			HF_perp, HF_par = fp_funcs.get_hyperfine_params(ms = el_trans, NV = 'Pippin_SIL1')
		elif el_trans == 'min':
			# print 'I did a thing!@'
			# needs to be flipped for simulation
			HF_par =  [x * (-1) for x in HF_par]

		# security check could be removed
		if len(HF_perp) == len(HF_par):
			pass
		else:
			print 'Unequal amount of Parallel and Perpendicular HF parameters'

		# print 'HF_perp = ' + str(HF_perp)
		# print 'HF_par = ' + str(HF_par)

	else:
		print 'No HF simulation'

	
	# print 'N = ' + str(N)

	N_keys = ['N'+str(pulse_no) for pulse_no in N]
	# print N_keys
	for pulses,data,datafolder in zip(N,[a[x] for x in N_keys],[folder[x] for x in N_keys]):

		##########################
		### 	 plot data ######
		#########################
		
		if xlim == None:
			fig = data.default_fig(figsize=(35,5))
			ax = data.default_ax(fig)
			ax.set_xlim(3.5,23.5)
			xlim = [3.5,23.5]
		else:
			fig = data.default_fig(figsize=(5+3*(xlim[1]-xlim[0]),2))
			ax = data.default_ax(fig)
			ax.set_xlim(xlim)

		start, end = ax.get_xlim()
		if xticks == None:
			ax.xaxis.set_ticks(np.arange(start, end, 0.5))
		else:
			ax.xaxis.set_ticks(np.arange(start, end, xticks))
		ax.set_ylim(-0.05,1.05)
		ax.plot(data.sweep_pts, data.p0, '.-k', lw=0.6,label = 'data',zorder=10)
		# print 'these are the sweep_pts',data.sweep_pts
		plt.ylabel(r'F($|0 \rangle$)',fontsize = 12)
		plt.xlabel(r'$\tau$ ($\mu s$)',fontsize = 12)
		#######################
		# Add simulated spins #
		#######################
		if disp_sim_spin == True:
			# print 'Starting Simulation for N = ' + str(pulses) + ' on transition ' + str(el_trans) 
			B_Field = kw.pop('B_field',414.2) # in gauss
			# print B_Field
			tau_lst = np.linspace(xlim[0]*1e-6, xlim[1]*1e-6, 2000)
			Mt16 = SC.dyn_dec_signal(HFs_par = HF_par, HFs_orth = HF_perp,
				B_field = B_Field, N = pulses, tau = tau_lst)
			FP_signal16 = ((Mt16+1)/2)
			

			# plot simulated results
			# colors = ['m', 'b', 'r', 'g', 'c']
			colors = cm.rainbow(np.linspace(0, 1, len(HF_par)))

			
			if el_trans == 'min':
				# flip sign back after simulation for correct graph legend
				HF_par_legend =  [x * (-1) for x in HF_par]

			else:
				HF_par_legend = HF_par
			for tt in range(len(HF_par)):
			  ax.plot(tau_lst*1e6, FP_signal16[tt,:] ,'-',lw=1.5,label = str(tt + 1) + ': HF_par = ' +str(HF_par_legend[tt]) + '; HF_perp = ' +str(HF_perp[tt]), color = colors[tt])
			plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)

		print datafolder
		plt.savefig(os.path.join(datafolder, str(disp_sim_spin)+'fingerprint.pdf'),bbox_inches = 'tight',
			format='pdf')
		plt.savefig(os.path.join(datafolder, str(disp_sim_spin)+'fingerprint.png'),bbox_inches = 'tight',
			format='png')