Пример #1
0
def hicat_pa(df_a,df_b):
	binwidth = 5
	plt.figure(num=None,figsize=(8,10),dpi=80,facecolor='w',edgecolor='k')
	plt.subplot(211)
	pa_a = (df_a["PA-N [deg]"].values+df_a["PA-S [deg]"].values)/2
	pa_b = (df_b["PA-N [deg]"].values+df_b["PA-S [deg]"].values)/2
	pa_all = np.append(pa_a,pa_b)
	plt.hist(pa_all,bins=np.arange(0,max(pa_all)+binwidth,binwidth),normed=False)
	plt.xlim([0,360])
	plt.xlabel("Position Angle ($deg.$)")
	plt.ylabel("Count")
	plt.title("HICAT CMEs Central Position Angle")
	plt.text(30,90,r'$\mu=%d$' % np.mean(pa_a))
        plt.text(210,90,r'$\mu=%d$' % np.mean(pa_b))
	plt.subplot(212)
	pa_a = df_a["PA-fit"].values
	pa_b = df_b["PA-fit"].values
	pa_all = np.append(pa_a,pa_b)
	plt.hist(pa_all,bins=np.arange(0,max(pa_all)+binwidth,binwidth),normed=False)
        plt.xlim([0,360])
        plt.xlabel("Position Angle ($deg.$)")
        plt.ylabel("Count")
	plt.title("HICAT CMEs Fitted Position Angle")
	plt.text(30,65,r'$\mu=%d$' % np.mean(pa_a))
	plt.text(210,65,r'$\mu=%d$' % np.mean(pa_b))
	plt.tight_layout()
	save(path=os.path.join(config.hicat_path,"hicat_pa"),verbose=True)
def display(oneSimulation,pathString, separate=False ,saveOnly=True):
    '''
    show/save figures
    '''
    self = oneSimulation

    pylab.rc('axes', linewidth=2) # make the axes boundary lines bold 
    #fig, ax = plt.subplots()
    fig = plt.figure()
    ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1)
    if separate:
        rr.plot( self.df_Region, 'red', lw=6, axes=ax, label='DF')
        rr.plot( self.cf_Region, 'blue', lw=4, axes=ax, label='CF')  
        rr.plot( self.fco_Region, 'red', lw=6, axes=ax, label='DF')
        rr.plot( self.icf_Region_bigR1, 'blue', lw=4, axes=ax, label='ICF')  
        rr.plot( self.icf_Region_bigR2, 'blue', lw=4, axes=ax)
    
    rr.plot(self.df_fco_region, 'red', lw=6, label='DF+FCo')
    rr.plot(self.cf_icf_region, 'blue', lw=4, label='CF+ICF')
    fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold')
    ax.set_title(r'$P_s=P_1=P_2={}, \, P_3={}, \, P_4={}, \, N=1$'.format(self.Ps,
                 self.P3, self.P4),fontdict=self.font)
    
    ax.set_xlabel('$R_1$', fontdict=self.font)
    ax.set_ylabel('$R_2$', fontdict=self.font)
    #ax.set_xlim(xmin=0, xmax=3.5) 
    #ax.set_ylim(ymin=0, ymax=3.5) 
    ax.legend(loc=0)
    
    nameStr = 'PsP3P4_{}_{}_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.P3, self.P4, 
                                                                self.g13, self.g14, self.g23, self.g24)
    savefig.save(path='{}/plots_CF_ICF__DF_FCo/{}'.format(pathString, nameStr), ext='pdf', close=saveOnly, verbose=True)        
        
Пример #3
0
def speeds_datetime():
    import datetime
    import matplotlib.ticker as ticker
    time_format_cdaw = "%Y/%m/%dT%H:%M:%S"
    time_format_hicat = "%Y-%m-%dT%H:%MZ"
    datetimes_cdaw = np.array([datetime.datetime.strptime(x,time_format_cdaw) \
                   for x in df_cdaw.date.values+'T'+df_cdaw.time.values])
    datetimes_hicat = np.array([datetime.datetime.strptime(x[0],time_format_hicat) \
for x in df_hicat[['Date [UTC]']].values])

    fig = plt.figure(num=None,
                     figsize=(10, 7),
                     dpi=80,
                     facecolor='w',
                     edgecolor='k')
    ax = fig.add_subplot(111)
    ssz = 10
    #lin = plt.scatter(datetimes,df_cdaw.lin_speed,s=ssz,facecolor='red',\
    #       edgecolor='none',alpha=0.3)
    q_f = plt.scatter(datetimes_cdaw,df_cdaw.quad_speed_final,s=ssz,facecolor='blue',\
            edgecolor='none',alpha=0.3)
    hi = plt.scatter(datetimes_hicat,df_hicat[['FP speed [kms-1]']],s=ssz,\
     facecolor='red',edgecolor='none',alpha=0.3)
    plt.ylim([0, 3500])
    plt.title("Comparing HICAT with the CDAW LASCO CME Catalog")
    plt.ylabel(speeds_label)
    plt.xlabel("Time")
    #ax = plt.axes()
    #ax.xaxis.set_major_locator(ticker.MultipleLocator(365))
    #labels=ax.get_xticklabels()
    #plt.setp(labels,rotation=40)
    #plt.legend([q_f,hi],['CDAW','HICAT'],prop={'size':ledge_sz})
    #plt.legend([lin,q_f],['Linear','Quad. (final)'],prop={'size':ledge_sz})
    save(path=os.path.join(config.hicat_path, "compare_speeds_datetimes"),
         verbose=True)
Пример #4
0
def speeds_datetime():
        import datetime
        import matplotlib.ticker as ticker
        time_format_cdaw = "%Y/%m/%dT%H:%M:%S"
        time_format_hicat = "%Y-%m-%dT%H:%MZ"
	datetimes_cdaw = np.array([datetime.datetime.strptime(x,time_format_cdaw) \
                for x in df_cdaw.date.values+'T'+df_cdaw.time.values])
        datetimes_hicat = np.array([datetime.datetime.strptime(x[0],time_format_hicat) \
		for x in df_hicat[['Date [UTC]']].values])
	
	fig = plt.figure(num=None,figsize=(10,7),dpi=80,facecolor='w',edgecolor='k')
        ax = fig.add_subplot(111)
	ssz=10
        #lin = plt.scatter(datetimes,df_cdaw.lin_speed,s=ssz,facecolor='red',\
        #       edgecolor='none',alpha=0.3)
        q_f = plt.scatter(datetimes_cdaw,df_cdaw.quad_speed_final,s=ssz,facecolor='blue',\
                edgecolor='none',alpha=0.3)
	hi = plt.scatter(datetimes_hicat,df_hicat[['FP speed [kms-1]']],s=ssz,\
		facecolor='red',edgecolor='none',alpha=0.3)
        plt.ylim([0,3500])
        plt.title("Comparing HICAT with the CDAW LASCO CME Catalog")
        plt.ylabel(speeds_label)
        plt.xlabel("Time")
        #ax = plt.axes()
        #ax.xaxis.set_major_locator(ticker.MultipleLocator(365))
        #labels=ax.get_xticklabels()
        #plt.setp(labels,rotation=40)
        #plt.legend([q_f,hi],['CDAW','HICAT'],prop={'size':ledge_sz})
        #plt.legend([lin,q_f],['Linear','Quad. (final)'],prop={'size':ledge_sz})
        save(path=os.path.join(config.hicat_path,"compare_speeds_datetimes"),verbose=True)
Пример #5
0
def hicat_all_speeds(*args,**kwargs):
	# input the speeds from Ahead & Behind of each of the FP, SSE, HM geometrical fittings.
	fp_a = args[0]
	fp_b = args[1]
	sse_a = args[2]
	sse_b = args[3]
	hm_a = args[4]
	hm_b = args[5]
	if 'tit' in kwargs:
		tit = kwargs['tit']
	else:
		tit = ""
	plt.figure(num=None,figsize=(10,12),dpi=80,facecolor='w',edgecolor='k')
	plt.subplot(311)
	plt.hist([fp_a,fp_b],bins=np.arange(0,max(fp_a)+binwidth,binwidth),\
		stacked=True,normed=False,color=colors[0:2],label=labels[0:2])
	plt.title("HICAT CME Speeds\n %s" %tit[0])
	plt.xlim(speeds_lim)
	plt.ylabel("Count")
	plt.legend(prop={'size':ledge_sz})
	plt.subplot(312)
	plt.hist([sse_a,sse_b],bins=np.arange(0,max(sse_a)+binwidth,binwidth),\
                stacked=True,normed=False,color=colors[0:2],label=labels[0:2])
	plt.title("%s" %tit[1])
        plt.xlim(speeds_lim)
        plt.ylabel("Count")
	plt.subplot(313)
        plt.hist([hm_a,hm_b],bins=np.arange(0,max(hm_a)+binwidth,binwidth),\
                stacked=True,normed=False,color=colors[0:2],label=labels[0:2])
	plt.title("%s" %tit[2])
        plt.xlim(speeds_lim)
        plt.xlabel(speeds_label)
        plt.ylabel("Count")
	plt.tight_layout()
        save(path=os.path.join(config.hicat_path,"hicat_speeds_hist"),verbose=True)
Пример #6
0
def hicact_speeds_datetime(df_hicact_a, df_hicact_b):
    import datetime
    time_format = "%Y/%m/%d %H:%M"
    datetimes_a = np.array([
        datetime.datetime.strptime(x, time_format)
        for x in df_hicact_a.starttime
    ])
    datetimes_b = np.array([
        datetime.datetime.strptime(x, time_format)
        for x in df_hicact_b.starttime
    ])
    plt.figure(num=None, figsize=(7, 8), dpi=80, facecolor='w', edgecolor='k')
    a = plt.scatter(datetimes_a,
                    df_hicact_a.v,
                    s=20,
                    facecolor='red',
                    edgecolor='none',
                    alpha=alph)
    b = plt.scatter(datetimes_b,
                    df_hicact_b.v,
                    s=20,
                    facecolor='blue',
                    edgecolor='none',
                    alpha=alph)
    plt.ylim([0, 2300])
    plt.title("HICACTus CMEs")
    plt.ylabel(speeds_label)
    plt.xlabel("Time")
    plt.legend([a, b], ['Ahead', 'Behind'], prop={'size': ledge_sz}, loc=2)
    save(path=os.path.join(config.hicact_path, "hicact_speeds_datetimes"),
         verbose=True)
def display_TwoHopSchemes(two_hop_schemes, pathString):
    '''
    Produce a graph that compare ... 
    '''
    self = two_hop_schemes

    pylab.rc('axes', linewidth=2) # make the axes boundary lines bold 
    #fig, ax = plt.subplots()
    fig = plt.figure()
    ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1)
    rr.plot( self.region_CF_ICFsch3, 'red', lw=8, axes=ax, label='CF + ICF')
    rr.plot( self.region_DFIntegerCoeff_FCo, 'c', lw=4, axes=ax, label='DF + FCo')
    rr.plot( self.region_noInterference, 'blue', lw=2, axes=ax, label='Free Interf.')  
    
    
    fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold')
    ax.set_title(r'$P_s=P_1=P_2={}, \, P_3={}, \, P_4={}, \, N=1$'.format(self.Ps, self.P3, self.P4),fontdict=self.font)
    
    ax.set_xlabel('$R_1$', fontdict=self.font)
    ax.set_ylabel('$R_2$', fontdict=self.font)
    #ax.set_xlim(xmin=0, xmax=3.5) 
    #ax.set_ylim(ymin=0, ymax=3.5) 
    ax.legend(loc=0)
    
    # savefig.save(path='{}compare_TwoHop_Schemes/PsP3P4_{}_{}_{}_g_{}_{}_{}_{}'.format(pathString, self.Ps, self.P3, self.P4, self.g13, self.g14, self.g23, self.g24), ext='pdf', close=False, verbose=True)    
    
    nameStr = 'PsP3P4_{}_{}_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.P3, self.P4, self.g13, self.g14, self.g23, self.g24)
    savefig.save(path='{}compare_TwoHop_Schemes/{}'.format(pathString, nameStr), ext='pdf', close=False, verbose=True)
    
        
        
def display70(oneSimulation,pathString, separate=False ,saveOnly=True):
    '''
    show/save figures
    '''
    self = oneSimulation
    
    tmp = np.asarray(oneSimulation.cf_icf01_region._geometry.boundary)
    tmp01= tmp[(0,1,3), :]
    
    tmp = np.asarray(oneSimulation.cf_icf_region._geometry.boundary)
    tmp03= tmp[(1,2,3,4), :]
    
    tmp = np.asarray(oneSimulation.df_fco_region._geometry.boundary)
    tmpDF = tmp[(0,1,2,3), :]


    

    pylab.rc('axes', linewidth=2) # make the axes boundary lines bold 
#     fig, ax = plt.subplots()
    fig = plt.figure()
    fig.set( size_inches=(8.8, 6) )
    
    ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1)
#     if separate:
#         rr.plot( self.df_region, 'red', lw=6, axes=ax, label='DF')
#         rr.plot( self.cf_region, 'blue', lw=4, axes=ax, label='CF')  
#         rr.plot( self.fco_region, 'red', lw=6, axes=ax, label='DF')
#         rr.plot( self.icf_region_bigR1, 'blue', lw=4, axes=ax, label='ICF')  
#         rr.plot( self.icf_region_bigR2, 'blue', lw=4, axes=ax)
    
    
    
#     rr.plot(self.df_fco_region, 'blue', lw=6, label='DF+FCo')
#     rr.plot(self.cf_icf_region, 'red', lw=4, label='CF+ICF Scheme 3')
#     rr.plot(self.cf_icf01_region, 'green', lw=2, label='CF+ICF Scheme 1' )
    
    
    ax.plot(tmpDF[:,0], tmpDF[:,1], 'blue', lw=6, label='DF+FCo')
    ax.plot(tmp03[:,0], tmp03[:,1], 'red', lw=4, label='CF+ICF Scheme 3')
    ax.plot(tmp01[:,0], tmp01[:,1], 'green', lw=2, label='CF+ICF Scheme 1' )
    
    
    
    
#     fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold')
    ax.set_title(r'$P_s=P_1=P_2={}, \, P_3={}, \, P_4={}, \, N=1$'.format(self.Ps,
                 self.P3, self.P4),fontdict=self.font)
    
    ax.set_xlabel('$R_1$', fontdict=self.font)
    ax.set_ylabel('$R_2$', fontdict=self.font)
    #ax.set_xlim(xmin=0, xmax=3.5) 
    #ax.set_ylim(ymin=0, ymax=3.5) 
    ax.legend(loc=0)
    
    nameStr = 'PsP3P4_{}_{}_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.P3, self.P4, 
                                                                self.g13, self.g14, self.g23, self.g24)
    savefig.save(path='{}/plots_CF_ICF03__CF_ICF01__DF_FCo/{}'.format(pathString, nameStr), ext='pdf', close=saveOnly, verbose=True)        
Пример #9
0
def hicact_spc_speeds_pa(df_hicact, spc):
    plt.scatter(df_hicact.v, df_hicact.pa, s=80, facecolor=colors[spc], edgecolor="none", alpha=alph)
    # plt.axhline(y=df_hicact_b.pa.min())
    # plt.axhline(y=df_hicact_b.pa.max())
    plt.xlim(speeds_lim)
    plt.title("HICACTus STEREO-%s" % labels[spc])
    plt.xlabel(speeds_label)
    plt.ylabel("Position Angle ($deg$)")
    save(path=os.path.join(config.hicact_path, "hicact_speeds_pa_%s" % labels[spc]), verbose=True)
Пример #10
0
def hicact_speeds_pa():
    plt.figure(num=None, figsize=(6, 8), dpi=80, facecolor="w", edgecolor="k")
    a = plt.scatter(df_hicact_a.v, df_hicact_a.pa, s=20, facecolor="red", edgecolor="none", alpha=alph)
    b = plt.scatter(df_hicact_b.v, df_hicact_b.pa, s=20, facecolor="blue", edgecolor="none", alpha=alph)
    plt.xlim(speeds_lim)
    plt.ylim([0, 360])
    plt.title("HICACTus STEREO CMEs")
    plt.xlabel(speeds_label)
    plt.ylabel("Position Angle ($deg$)")
    plt.legend([a, b], ["Ahead", "Behind"], prop={"size": 8})
    save(path=os.path.join(config.hicact_path, "hicact_speeds_pa"), verbose=True)
Пример #11
0
def hicact_speeds(v_a, v_b):
    plt.hist(v_a,bins=np.arange(0,max(v_a)+binwidth,binwidth),histtype='stepfilled',\
     normed=False,color='r',label='Ahead')
    plt.hist(v_b,bins=np.arange(0,max(v_b)+binwidth,binwidth),histtype='stepfilled',\
     normed=False,color='b',alpha=alph,label='Behind')
    plt.title("HICACTus CME Speeds")
    plt.xlim(speeds_lim)
    plt.xlabel(speeds_label)
    plt.ylabel("Count")
    plt.legend(prop={'size': 8})
    save(path=os.path.join(config.hicact_path, "hicact_speeds_hist"),
         verbose=True)
Пример #12
0
def cdaw_hists():
	fig = plt.figure(1,figsize=(20,20))
	df_cdaw.hist(column=cols_hist,bins=50,grid=False)
	save(path=os.path.join(config.cdaw_path,"cdaw_hist"),verbose=True)
	#boxplot
	fig = plt.figure(2,figsize=(9,6))
	ax = fig.add_subplot(111)
	df_cdaw.boxplot(column=cols_boxplot,grid=False)
	ax.set_xticklabels(labels_boxplot)
	plt.ylabel(speeds_label)
	plt.title("CDAW LASCO CME Catalog")
	plt.tight_layout()
	save(path=os.path.join(config.cdaw_path,"cdaw_speeds_boxplot"),verbose=True)
Пример #13
0
def cdaw_hists():
    fig = plt.figure(1, figsize=(20, 20))
    df_cdaw.hist(column=cols_hist, bins=50, grid=False)
    save(path=os.path.join(config.cdaw_path, "cdaw_hist"), verbose=True)
    #boxplot
    fig = plt.figure(2, figsize=(9, 6))
    ax = fig.add_subplot(111)
    df_cdaw.boxplot(column=cols_boxplot, grid=False)
    ax.set_xticklabels(labels_boxplot)
    plt.ylabel(speeds_label)
    plt.title("CDAW LASCO CME Catalog")
    plt.tight_layout()
    save(path=os.path.join(config.cdaw_path, "cdaw_speeds_boxplot"),
         verbose=True)
Пример #14
0
def hicact_speeds_datetime(df_hicact_a, df_hicact_b):
    import datetime

    time_format = "%Y/%m/%d %H:%M"
    datetimes_a = np.array([datetime.datetime.strptime(x, time_format) for x in df_hicact_a.starttime])
    datetimes_b = np.array([datetime.datetime.strptime(x, time_format) for x in df_hicact_b.starttime])
    plt.figure(num=None, figsize=(7, 8), dpi=80, facecolor="w", edgecolor="k")
    a = plt.scatter(datetimes_a, df_hicact_a.v, s=20, facecolor="red", edgecolor="none", alpha=alph)
    b = plt.scatter(datetimes_b, df_hicact_b.v, s=20, facecolor="blue", edgecolor="none", alpha=alph)
    plt.ylim([0, 2300])
    plt.title("HICACTus CMEs")
    plt.ylabel(speeds_label)
    plt.xlabel("Time")
    plt.legend([a, b], ["Ahead", "Behind"], prop={"size": ledge_sz}, loc=2)
    save(path=os.path.join(config.hicact_path, "hicact_speeds_datetimes"), verbose=True)
Пример #15
0
def hicat_speeds_pa(df_hicat):
	plt.figure(num=None,figsize=(8,10),dpi=80,facecolor='w',edgecolor='k')
        hm = plt.scatter(df_hicat[['HM speed [kms-1]']],df_hicat[['PA-fit']],s=50,facecolor='green',\
                edgecolor='none',alpha=0.35)
        sse = plt.scatter(df_hicat[['SSE speed [kms-1]']],df_hicat[['PA-fit']],s=50,facecolor='blue',\
                edgecolor='none',alpha=0.35)
	fp = plt.scatter(df_hicat[['FP speed [kms-1]']],df_hicat[['PA-fit']],s=50,facecolor='red',\
                edgecolor='none',alpha=0.35)
	plt.xlim(speeds_lim)
	plt.ylim([0,360])
	plt.title("HICAT CMEs")
	plt.xlabel(speeds_label)
	plt.ylabel("Position Angle ($deg$)")
	plt.legend([fp,sse,hm],['Fixed-Phi','Self-Similar Exp.','Harmonic Mean'],prop={'size':ledge_sz})
	save(path=os.path.join(config.hicat_path,"hicat_speeds_pa"),verbose=True)
Пример #16
0
def hicat_spc_speeds_pa(df_hicat,spc):
	hm = plt.scatter(df_hicat[['HM speed [kms-1]']],df_hicat[['PA-fit']],s=50,facecolor='green',\
		edgecolor='none',alpha=0.5)
	sse = plt.scatter(df_hicat[['SSE speed [kms-1]']],df_hicat[['PA-fit']],s=50,facecolor='blue',\
		edgecolor='none',alpha=0.5)
	fp = plt.scatter(df_hicat[['FP speed [kms-1]']],df_hicat[['PA-fit']],s=50,facecolor='red',\
		edgecolor='none',alpha=0.5)
	#plt.axhline(y=df_hicat_b.pa.min())
	#plt.axhline(y=df_hicat_b.pa.max())
	plt.xlim(speeds_lim)
	plt.title("HICAT STEREO-%s" %labels[spc])
	plt.xlabel(speeds_label)
	plt.ylabel("Position Angle ($deg$)")
	plt.legend([fp,sse,hm],['Fixed-Phi','Self-Similar Exp.','Harmonic Mean'],prop={'size':ledge_sz})
	save(path=os.path.join(config.hicat_path,"hicat_speeds_pa_%s" %labels[spc]),verbose=True)
Пример #17
0
def hicact_spc_speeds_pa(df_hicact, spc):
    plt.scatter(df_hicact.v,
                df_hicact.pa,
                s=80,
                facecolor=colors[spc],
                edgecolor='none',
                alpha=alph)
    #plt.axhline(y=df_hicact_b.pa.min())
    #plt.axhline(y=df_hicact_b.pa.max())
    plt.xlim(speeds_lim)
    plt.title("HICACTus STEREO-%s" % labels[spc])
    plt.xlabel(speeds_label)
    plt.ylabel("Position Angle ($deg$)")
    save(path=os.path.join(config.hicact_path,
                           "hicact_speeds_pa_%s" % labels[spc]),
         verbose=True)
Пример #18
0
def hi_spc_speeds(v, **kwargs):
    if kwargs:
        print kwargs
    if "spc" in kwargs:
        spc = kwargs["spc"]
    else:
        spc = -1
    if "tit" in kwargs:
        tit = kwargs["tit"]
    else:
        tit = ""
    v = np.array(v.astype("float"))
    plt.hist(v, bins=np.arange(0, max(v) + binwidth, binwidth), color=colors[spc])
    plt.title("%s STEREO %s" % (tit.upper(), labels[spc]))
    plt.xlim(speeds_lim)
    plt.xlabel(speeds_label)
    save(path=os.path.join(config.hicact_path, "%s_speeds_hist_%s" % (tit, labels[spc])), verbose=True)
Пример #19
0
def cdaw_pa():
	binwidth=5
	plt.figure(num=None,figsize=(8,10),dpi=80,facecolor='w',edgecolor='k')
	plt.subplot(211)
	plt.hist(df_cdaw.cpa.values,bins=np.arange(0,max(df_cdaw.cpa)+binwidth,binwidth),normed=False)
	plt.xlim([0,360])
	plt.xlabel("Position Angle ($deg.$)")
	plt.ylabel("Count")
	plt.title("CDAW CMEs Central Position Angle")
	plt.subplot(212)
	plt.hist(df_cdaw.mpa.values,bins=np.arange(0,max(df_cdaw.mpa)+binwidth,binwidth),normed=False)
	plt.xlim([0,360])
	plt.xlabel("Position Angle ($deg.$)")
	plt.ylabel("Count")
	plt.title("CDAW CMEs Measured Position Angle")
	plt.tight_layout()
	save(path=os.path.join(config.cdaw_path,"cdaw_pa"),verbose=True)
Пример #20
0
def hi_geom_speeds(v,**kwargs):
	if kwargs:
		print kwargs
	if 'spc' in kwargs:
		spc = kwargs['spc']
	else:
		spc = -1
	if 'tit' in kwargs:
		tit = kwargs['tit']
	else:
		tit = ""
	v = np.array(v.astype('float'))
	plt.hist(v,bins=np.arange(0, max(v) + binwidth, binwidth),color=colors[spc])
	plt.title("%s STEREO %s" %(tit,labels[spc]))
	#plt.xlim(speeds_lim)
	plt.xlabel(speeds_label)
	save(path=os.path.join(config.hicat_path,"%s_speeds_hist_%s" %(tit,labels[spc])),verbose=True)
Пример #21
0
def cdaw_speeds_pa():
	plt.figure(figsize=(10,8),dpi=80,facecolor='w')
	ssz = 10
	#lin = plt.scatter(df_cdaw.lin_speed,df_cdaw.mpa,s=ssz,facecolor='red',\
	#	edgecolor='none',alpha=0.3)
	#q_i = plt.scatter(df_cdaw.quad_speed_init,df_cdaw.mpa,s=ssz,facecolor='red',\
	#	edgecolor='none',alpha=0.3)
	q_f = plt.scatter(df_cdaw.quad_speed_final,df_cdaw.mpa,s=ssz,facecolor='blue',\
		edgecolor='none',alpha=0.3)
	plt.xlim([0,3500])
	plt.ylim([0,360])
	plt.title("CDAW LASCO CME Catalog")
	plt.xlabel(speeds_label)
	plt.ylabel("Measured Position Angle ($deg.$)")
	#plt.legend([lin,q_i,q_f],['Linear','Quad. (init.)','Quad. (final)'],prop={'size':ledge_sz})
	#plt.legend([lin,q_f],['Linear','Quad. (final)'],prop={'size':ledge_sz})
	plt.legend([q_f],['Quad. (final)'],prop={'size':ledge_sz})
	save(path=os.path.join(config.cdaw_path,"cdaw_speeds_pa"),verbose=True)
Пример #22
0
def cdaw_speeds_pa():
    plt.figure(figsize=(10, 8), dpi=80, facecolor='w')
    ssz = 10
    #lin = plt.scatter(df_cdaw.lin_speed,df_cdaw.mpa,s=ssz,facecolor='red',\
    #	edgecolor='none',alpha=0.3)
    #q_i = plt.scatter(df_cdaw.quad_speed_init,df_cdaw.mpa,s=ssz,facecolor='red',\
    #	edgecolor='none',alpha=0.3)
    q_f = plt.scatter(df_cdaw.quad_speed_final,df_cdaw.mpa,s=ssz,facecolor='blue',\
     edgecolor='none',alpha=0.3)
    plt.xlim([0, 3500])
    plt.ylim([0, 360])
    plt.title("CDAW LASCO CME Catalog")
    plt.xlabel(speeds_label)
    plt.ylabel("Measured Position Angle ($deg.$)")
    #plt.legend([lin,q_i,q_f],['Linear','Quad. (init.)','Quad. (final)'],prop={'size':ledge_sz})
    #plt.legend([lin,q_f],['Linear','Quad. (final)'],prop={'size':ledge_sz})
    plt.legend([q_f], ['Quad. (final)'], prop={'size': ledge_sz})
    save(path=os.path.join(config.cdaw_path, "cdaw_speeds_pa"), verbose=True)
Пример #23
0
def hicat_speeds_datetime(df_hicat):
	import datetime
	time_format = "%Y-%m-%dT%H:%MZ"
	datetimes = np.array([datetime.datetime.strptime(x[0],time_format) \
		for x in df_hicat[['Date [UTC]']].values])
	plt.figure(num=None,figsize=(8,6),dpi=80,facecolor='w',edgecolor='k')
	ssz=30
	hm = plt.scatter(datetimes,df_hicat[['HM speed [kms-1]']],s=ssz,facecolor='green',\
		edgecolor='none',alpha=0.35)
	sse = plt.scatter(datetimes,df_hicat[['SSE speed [kms-1]']],s=ssz,facecolor='blue',\
		edgecolor='none',alpha=0.35)
	fp = plt.scatter(datetimes,df_hicat[['FP speed [kms-1]']],s=ssz,facecolor='red',\
		edgecolor='none',alpha=0.35)
	plt.ylim(speeds_lim)
	plt.title("HICAT CMEs")
	plt.ylabel(speeds_label)
	plt.xlabel("Time")
	plt.legend([fp,sse,hm],['Fixed-Phi','Self-Similar Exp.','Harmonic Mean'],prop={'size':ledge_sz},loc=2)
	save(path=os.path.join(config.hicat_path,"hicat_speeds_datetimes"),verbose=True)
def display(oneSimulation,pathString ,saveOnly=True):
    '''
    Produce a graph that compare three ICF schemes
    '''
    self = oneSimulation
    
    # get the union rate region for plotting 
    icf_sch1 = rr.union( [self.icf_sch1_bigR1, self.icf_sch1_bigR2] )
    icf_sch2 = rr.union( [self.icf_sch2_bigR1, self.icf_sch2_bigR2] )
    icf_sch3 = rr.union( [self.icf_sch3_bigR1, self.icf_sch3_bigR2] )

    pylab.rc('axes', linewidth=2) # make the axes boundary lines bold 
    fig, ax = plt.subplots()
    rr.plot( icf_sch1, 'g', axes=ax, label='Scheme 1')
    rr.plot( icf_sch2, 'b', axes=ax, label='Scheme 2')
    rr.plot( icf_sch3, 'r', axes=ax, label='Scheme 3')  
    
    # plot the line: R2 = R1
    tmp = np.asarray(self.icf_sch1_bigR1._geometry.boundary)
    tmp2 = [[0, tmp[1, 0]], [0, tmp[1, 1] ] ]
    ax.plot( [0, tmp[1, 0]], [0, tmp[1, 1] ] , 'k--', lw=2)

    ax.set_title(r'$ P_3={}, \, P_4={}, \, N=1$'.format(self.P3, self.P4) , fontdict=self.font)
    ax.set_xlabel('$R_1$', fontdict=self.font)
    ax.set_ylabel('$R_2$', fontdict=self.font)
    ax.set_xlim(xmin=0, xmax=3.5) 
    ax.set_ylim(ymin=0, ymax=3.5) 
    ax.legend(loc='upper right')
    
    savefig.save(path='{}/compare_three_ICF_Schemes/P3P4_{}_{}'.format(pathString, self.P3, self.P4 ), ext='pdf', close=saveOnly, verbose=True)
    if (0):
        # add annotations for 3 regions
        plt.text(0.7, 2.3, 'capacity region by coherent coding with cardinality-bounding', color='red')
        plt.text(1, 1.8, 'non-coherent coding with cardinality-bounding', color='blue')
        plt.text(1.3, 1.4, 'capacity region by coherent coding with cardinality-bounding', color='green')
        
        bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="g", lw=1)
        plt.text(1, 0.5, r'$1$', color='black', bbox=bbox_props)
        bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="b", lw=1)
        plt.text(1.7, 0.4, r'$2$', color='black', bbox=bbox_props)
        bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="r", lw=1)
        plt.text(2.2, 0.3, r'$3$', color='black', bbox=bbox_props)
Пример #25
0
def hicact_speeds_pa():
    plt.figure(num=None, figsize=(6, 8), dpi=80, facecolor='w', edgecolor='k')
    a = plt.scatter(df_hicact_a.v,
                    df_hicact_a.pa,
                    s=20,
                    facecolor='red',
                    edgecolor='none',
                    alpha=alph)
    b = plt.scatter(df_hicact_b.v,
                    df_hicact_b.pa,
                    s=20,
                    facecolor='blue',
                    edgecolor='none',
                    alpha=alph)
    plt.xlim(speeds_lim)
    plt.ylim([0, 360])
    plt.title("HICACTus STEREO CMEs")
    plt.xlabel(speeds_label)
    plt.ylabel("Position Angle ($deg$)")
    plt.legend([a, b], ['Ahead', 'Behind'], prop={'size': 8})
    save(path=os.path.join(config.hicact_path, "hicact_speeds_pa"),
         verbose=True)
Пример #26
0
def hi_spc_speeds(v, **kwargs):
    if kwargs:
        print kwargs
    if 'spc' in kwargs:
        spc = kwargs['spc']
    else:
        spc = -1
    if 'tit' in kwargs:
        tit = kwargs['tit']
    else:
        tit = ""
    v = np.array(v.astype('float'))
    plt.hist(v,
             bins=np.arange(0,
                            max(v) + binwidth, binwidth),
             color=colors[spc])
    plt.title("%s STEREO %s" % (tit.upper(), labels[spc]))
    plt.xlim(speeds_lim)
    plt.xlabel(speeds_label)
    save(path=os.path.join(config.hicact_path,
                           "%s_speeds_hist_%s" % (tit, labels[spc])),
         verbose=True)
Пример #27
0
def cdaw_pa():
    binwidth = 5
    plt.figure(num=None, figsize=(8, 10), dpi=80, facecolor='w', edgecolor='k')
    plt.subplot(211)
    plt.hist(df_cdaw.cpa.values,
             bins=np.arange(0,
                            max(df_cdaw.cpa) + binwidth, binwidth),
             normed=False)
    plt.xlim([0, 360])
    plt.xlabel("Position Angle ($deg.$)")
    plt.ylabel("Count")
    plt.title("CDAW CMEs Central Position Angle")
    plt.subplot(212)
    plt.hist(df_cdaw.mpa.values,
             bins=np.arange(0,
                            max(df_cdaw.mpa) + binwidth, binwidth),
             normed=False)
    plt.xlim([0, 360])
    plt.xlabel("Position Angle ($deg.$)")
    plt.ylabel("Count")
    plt.title("CDAW CMEs Measured Position Angle")
    plt.tight_layout()
    save(path=os.path.join(config.cdaw_path, "cdaw_pa"), verbose=True)
Пример #28
0
def cdaw_speeds_datetime():
	import datetime
	import matplotlib.ticker as ticker
	time_format = "%Y/%m/%dT%H:%M:%S"
	datetimes = np.array([datetime.datetime.strptime(x,time_format) \
		for x in df_cdaw.date.values+'T'+df_cdaw.time.values])
	plt.figure(num=None,figsize=(10,7),dpi=80,facecolor='w',edgecolor='k')
	ssz=10
	#lin = plt.scatter(datetimes,df_cdaw.lin_speed,s=ssz,facecolor='red',\
	#	edgecolor='none',alpha=0.3)
	q_f = plt.scatter(datetimes,df_cdaw.quad_speed_final,s=ssz,facecolor='blue',\
		edgecolor='none',alpha=0.3)
	plt.ylim([0,3500])
	plt.title("CDAW LASCO CME Catalog")
	plt.ylabel(speeds_label)
	plt.xlabel("Time")
	ax = plt.axes()
	ax.xaxis.set_major_locator(ticker.MultipleLocator(365))
	labels=ax.get_xticklabels()
	plt.setp(labels,rotation=40)
	plt.legend([q_f],['Quad. (final)'],prop={'size':ledge_sz})
	#plt.legend([lin,q_f],['Linear','Quad. (final)'],prop={'size':ledge_sz})
	save(path=os.path.join(config.cdaw_path,"cdaw_speeds_datetimes"),verbose=True)
Пример #29
0
def cdaw_speeds_datetime():
    import datetime
    import matplotlib.ticker as ticker
    time_format = "%Y/%m/%dT%H:%M:%S"
    datetimes = np.array([datetime.datetime.strptime(x,time_format) \
     for x in df_cdaw.date.values+'T'+df_cdaw.time.values])
    plt.figure(num=None, figsize=(10, 7), dpi=80, facecolor='w', edgecolor='k')
    ssz = 10
    #lin = plt.scatter(datetimes,df_cdaw.lin_speed,s=ssz,facecolor='red',\
    #	edgecolor='none',alpha=0.3)
    q_f = plt.scatter(datetimes,df_cdaw.quad_speed_final,s=ssz,facecolor='blue',\
     edgecolor='none',alpha=0.3)
    plt.ylim([0, 3500])
    plt.title("CDAW LASCO CME Catalog")
    plt.ylabel(speeds_label)
    plt.xlabel("Time")
    ax = plt.axes()
    ax.xaxis.set_major_locator(ticker.MultipleLocator(365))
    labels = ax.get_xticklabels()
    plt.setp(labels, rotation=40)
    plt.legend([q_f], ['Quad. (final)'], prop={'size': ledge_sz})
    #plt.legend([lin,q_f],['Linear','Quad. (final)'],prop={'size':ledge_sz})
    save(path=os.path.join(config.cdaw_path, "cdaw_speeds_datetimes"),
         verbose=True)
Пример #30
0
def hicact_speeds(v_a, v_b):
    plt.hist(
        v_a,
        bins=np.arange(0, max(v_a) + binwidth, binwidth),
        histtype="stepfilled",
        normed=False,
        color="r",
        label="Ahead",
    )
    plt.hist(
        v_b,
        bins=np.arange(0, max(v_b) + binwidth, binwidth),
        histtype="stepfilled",
        normed=False,
        color="b",
        alpha=alph,
        label="Behind",
    )
    plt.title("HICACTus CME Speeds")
    plt.xlim(speeds_lim)
    plt.xlabel(speeds_label)
    plt.ylabel("Count")
    plt.legend(prop={"size": 8})
    save(path=os.path.join(config.hicact_path, "hicact_speeds_hist"), verbose=True)
Пример #31
0
def hicat_stacked_speeds():
	wp3_speeds=df_hicat[['FP speed [kms-1]','SSE speed [kms-1]','HM speed [kms-1]']]
	wp3_speeds.plot(kind='hist',stacked=True,bins=100)
	save(path=os.path.join(config.hicat_path,"hicat_speeds_stacked"),verbose=True)
Пример #32
0
df_cdaw.describe()
# Generate some initial plots for CDAW
#df_cdaw.hist()
#save(path=os.path.join(config.wp3_path,"cdaw_cme_catalog/cdaw_hist"),verbose=True)
#plt.show()


hicact_a_speeds = df_hicact_a[['v']]
hicact_b_speeds = df_hicact_b[['v']]

binwidth = 50

v_a = np.array(df_hicact_a[['v']].astype('float'))
plt.hist(v_a,bins=np.arange(0, max(v_a) + binwidth, binwidth))
plt.title("HICACTus STEREO-Ahead")
save(path=os.path.join(config.hicact_path,"hicact_a_speeds_hist"),verbose=True)

v_b = np.array(df_hicact_b[['v']].astype('float'))
plt.hist(v_b,bins=np.arange(0,max(v_b)+binwidth,binwidth))
plt.title("HICACTus STEREO-Behind")
save(path=os.path.join(config.hicact_path,"hicact_b_speeds_hist"),verbose=True)

plt.hist(v_a,bins=np.arange(0,max(v_a)+binwidth,binwidth),histtype='stepfilled',\
	normed=False,color='b',label='Ahead')
plt.hist(v_b,bins=np.arange(0,max(v_b)+binwidth,binwidth),histtype='stepfilled',\
	normed=False,color='r',alpha=0.5,label='Behind')
plt.title("HICACTus CME Speeds")
plt.xlabel("Speed [kms-1]")
plt.ylabel("Count")
plt.legend(prop={'size':8})
save(path=os.path.join(config.hicact_path,"hicact_speeds_hist"),verbose=True)
Пример #33
0
data1 = pd.read_csv('Images/means_err_dataJan27.csv', header=False, delim_whitespace=True)

CnM_test_list = data1['CnM']
CM_test_list = data1['CM']
CR_test_list = data1['CR']
C_test_list = data1['C']

num_runs = 15

means_list = [sum(C_test_list)/float(num_runs), sum(CnM_test_list)/float(num_runs), sum(CM_test_list)/float(num_runs),sum(CR_test_list)/float(num_runs)]
objects = ('C', 'CnM', 'CM', 'CR')
y_pos = np.arange(len(objects))

std_err_C = np.std(C_test_list)
std_err_CnM = np.std(CnM_test_list)
std_err_CM = np.std(CM_test_list)
std_err_CR = np.std(CR_test_list)

errors = [std_err_C, std_err_CnM, std_err_CM, std_err_CR]

plt.bar(y_pos, means_list, align='center', width=0.7, yerr=errors, alpha=0.6 )
plt.xlabel('Condition for Evolution')
plt.xticks(y_pos, objects)
plt.ylabel('Average Error for Categorization')
plt.ylim([0, max(means_list)+0.1])
plt.title('Average Error')

save('/Users/np/Desktop/Bullet/bullet_make/Demos/RagdollDemo/Debug/Images/Means_werr'+datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S')+'Jan27')