def add_to_measurement(d):
	'''d is dict returned from "get_measurement()"'''
	new={}
	for key in ['name','rms_beta','yax_val','med','med_low','med_hi']:
		new[key]= np.zeros(len(d['beta']))	
		# Set non float types
		if key == 'name': new[key]= new[key].astype(str)
		elif key == 'yax_val': new[key]= new[key].astype(int)
	if d.has_key('smean'):
		for key in ['mean','mean_low','mean_hi']:
			new[key]= np.zeros(len(d['beta']))
	if d.has_key('pdf_low'):
		for key in ['pdf_low','pdf_hi']:
			new[key]= np.zeros(len(d['beta']))
	mods= ['bInf', 'bInfsd3', 'b100','b10','b1','b1e-1', 'b1e-2']
	assert(len(mods) == len(d['beta']))
	for i,key in enumerate(mods[::-1]):
		new['name'][i]= key
		rms_va,rms_b= ic_rms_vals(key)
		new['rms_beta'][i]= rms_b 
		new['yax_val'][i]= i+1
		#median and +/- sigma using quartiles
		idx= list(d['beta']).index(key)
		new['med'][i]= d['smed'][idx] 
		new['med_low'][i]= d['med_low'][idx]
		new['med_hi'][i]= d['med_hi'][idx]
		if d.has_key('smean'):
			#mean and +/- sigma using quartiles
			new['mean'][i]= d['smean'][idx] 
			new['mean_low'][i]= d['mean_low'][idx] 
			new['mean_hi'][i]= d['mean_hi'][idx] 
		if d.has_key('pdf_low'):
			new['pdf_low'][i]= d['pdf_low'][idx] 
			new['pdf_hi'][i]= d['pdf_hi'][idx] 
	return new
Пример #2
0
def put_errbars_in_arrays_linear(final):
    """DON'T TAKE LOG10 of mdot IN THIS VERSION
	final is dict returned by final_measurement()
	vals are stored in dicts, want order them into arrays"""
    name, rms_beta, med_beta, yax_val, med, med_low, med_hi, std_low, std_hi = [], [], [], [], [], [], [], [], []
    mods = ["bInf", "bInfsd3", "b100", "b10", "b1", "b1e-1", "b1e-2"]
    print "put_errbars_in_arrays_linear: mods= ", mods
    print "put_errbars_in_arrays_linear: final.keys()= ", final.keys()
    for cnt, key in enumerate(mods[::-1]):
        name.append(key)
        rms_va, rms_b = ic_rms_vals(key)
        rms_beta.append(rms_b)
        med_beta.append(ic_median_beta(key))
        yax_val.append(cnt + 1)
        # median and +/- sigma using quartiles
        med.append(final[key]["final"]["med"])
        med_low.append(final[key]["final"]["med_low"])
        med_hi.append(final[key]["final"]["med_hi"])
        # width mdot distributing from +/- quartiles
        std_low.append(final[key]["std_pdf"]["low"])
        std_hi.append(final[key]["std_pdf"]["hi"])
    return (
        np.array(med),
        np.array(med_low),
        np.array(med_hi),
        np.array(std_low),
        np.array(std_hi),
        np.array(yax_val),
        np.array(rms_beta),
        np.array(med_beta),
        name,
    )
def put_errbars_in_arrays_linear(final):
	'''DON'T TAKE LOG10 of mdot IN THIS VERSION
	final is dict returned by final_measurement()
	vals are stored in dicts, want order them into arrays'''
	name,rms_beta,med_beta,yax_val,med,med_low,med_hi,std_low,std_hi= [],[],[],[],[],[],[],[],[]
	mods= ['bInf', 'bInfsd3', 'b100','b10','b1','b1e-1', 'b1e-2']
	print 'put_errbars_in_arrays_linear: mods= ',mods
	print 'put_errbars_in_arrays_linear: final.keys()= ',final.keys()
	for cnt,key in enumerate(mods[::-1]):
		name.append( key)
		rms_va,rms_b= ic_rms_vals(key)
		rms_beta.append( rms_b )
		med_beta.append( ic_median_beta(key)  )
		yax_val.append( cnt+1)
		#median and +/- sigma using quartiles
		med.append( final[key]['med'] )
		med_low.append( final[key]['med_low'] )
		med_hi.append( final[key]['med_hi'] )
		#width mdot distributing from +/- quartiles
		std_low.append( final[key]['std_low'] )
		std_hi.append( final[key]['std_hi'] ) 
	return np.array(med),np.array(med_low),np.array(med_hi),np.array(std_low),np.array(std_hi), np.array(yax_val),np.array(rms_beta),np.array(med_beta),name