Commit a45d9adf authored by Leonie Pick's avatar Leonie Pick

Adjust pl.Musical and pl.MusicalClassified for defense talk

parent be6d8f0d
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -793,8 +793,8 @@ def Musical(Time,HTime,Storms,Kp_all,KpHours_all,SN,SNYears,HMC,HMC_filt,Referen
## Dummy for legend
#axs1.scatter(0,-50,s=20,marker='s',color='black',alpha=0.7,label=r'3 $\leq$ Kp $\leq$ 4+$^+$')
axs1.plot([0,1],[-50,-25],color='dimgray',linewidth=1.5,label=r'SN')
axs1.plot([0,1],[-50,-25],color='dimgray',linewidth=1.5,linestyle='--',label=r'HMC$_{11y}$')
axs1.scatter(0,-50,s=20,marker='s',color='dimgray',label=r'Event')
#axs1.plot([0,1],[-50,-25],color='dimgray',linewidth=1.5,linestyle='--',label=r'HMC$_{11y}$')
axs1.scatter(0,-50,s=20,marker='o',color='dimgray',label=r'Storm peak')
# Plot storm events from catalogs (papers)
cm = plt.cm.get_cmap('seismic')
......@@ -807,7 +807,11 @@ def Musical(Time,HTime,Storms,Kp_all,KpHours_all,SN,SNYears,HMC,HMC_filt,Referen
x_t[i] = np.mod(diff_t[i].total_seconds()/(60*60*24),SolarRot)
z = Reference[KnownE,0]
sc = axs1.scatter(x_t, y_t, c=z, vmin=0.0, vmax=1.0, s=5, cmap=cm, zorder = 3)
znew = np.zeros(len(z),dtype=float)+0.25
z1 = np.where(z==1)[0]
znew[z1] = 0.75
sc = axs1.scatter(x_t, y_t, c=znew, vmin=0.0, vmax=1.0, s=10, cmap=cm, zorder = 3)
cbar_axis = fig.add_axes([0.45, 0.032, 0.3, 0.01])
cbar = plt.colorbar(sc,cax=cbar_axis,use_gridspec=False, orientation ='horizontal',ticks=[0,0.5,1])
#cbar.set_label('CME probability',fontsize=8)
......@@ -820,10 +824,12 @@ def Musical(Time,HTime,Storms,Kp_all,KpHours_all,SN,SNYears,HMC,HMC_filt,Referen
# Plots class occurrences
nip = 0
c = [0.75,0.25]
for i in [1,0]:
zi = np.where(z==i)[0]
ni, bins = np.histogram(HTime[Reference[KnownE[zi],1],4],np.arange(1900,2017,1))
axs2.barh(np.arange(1900.5,2016.5,1), ni, left = nip, height=0.9, color=cm(float(i)),zorder=5)
#axs2.barh(np.arange(1900.5,2016.5,1), ni, left = nip, height=0.9, color=cm(float(i)),zorder=5)
axs2.barh(np.arange(1900.5,2016.5,1), ni, left = nip, height=0.9, color=cm(c[i]),zorder=5)
nip += ni
#Turner_CIR = np.where(np.logical_and(Reference[:,2] == b'Turner',Target['type'] ==0))[0]
......@@ -864,7 +870,7 @@ def Musical(Time,HTime,Storms,Kp_all,KpHours_all,SN,SNYears,HMC,HMC_filt,Referen
handles, labels = axs1.get_legend_handles_labels()
order = [0,1]
axs1.legend([handles[idx] for idx in order],[labels[idx] for idx in order], ncol=5,frameon=True,fontsize=11,loc='center left',bbox_to_anchor=[-0.1,-0.037])
axs1.legend([handles[idx] for idx in order],[labels[idx] for idx in order], ncol=5,frameon=True,fontsize=11,loc='center left',bbox_to_anchor=[-0.15,-0.037])
axs1.set_ylim([np.nanmin(y),np.nanmax(y)])
#handles, labels = axs1.get_legend_handles_labels()
......@@ -886,7 +892,7 @@ def Musical(Time,HTime,Storms,Kp_all,KpHours_all,SN,SNYears,HMC,HMC_filt,Referen
axs3.plot((SN[SN_start:SN_end]/max(SN[SN_start:SN_end]))**1,SNYears[SN_start:SN_end],color='dimgray',linewidth=1.5, label='SN')
# Plot HMC threshold scaling
axs3.plot((HMC_filt/min(HMC_filt))**1,HTime[:,4],color='dimgray',linestyle='--',linewidth=1.5, label='HMC')
# axs3.plot((HMC_filt/min(HMC_filt))**1,HTime[:,4],color='dimgray',linestyle='--',linewidth=1.5, label='HMC')
# Plot histogram
n, bins, patches = axs2.hist(x=HTime[Storms,4],bins=np.arange(1900,2017,1),orientation='horizontal',histtype='stepfilled',color='silver',alpha=1)
......@@ -981,8 +987,8 @@ def MusicalClassified(Time,HTime,Reference,Source,Storms,Class_Proba,Class,Kp_al
## Dummy for legend
#axs1.scatter(0,-50,s=20,marker='s',color='black',alpha=0.7,label=r'Kp $\geq$ 4$^+$')
axs1.plot([0,1],[-50,-25],color='dimgray',linewidth=1.5,label=r'SN', zorder=5)
axs1.plot([0,1],[-50,-25],color='dimgray',linewidth=1.5,linestyle='--',label=r'HMC$_{11y}$', zorder=5)
axs1.scatter(0,-50,s=20,marker='s',color='black',label=r'Event')
#axs1.plot([0,1],[-50,-25],color='dimgray',linewidth=1.5,linestyle='--',label=r'HMC$_{11y}$', zorder=5)
axs1.scatter(0,-50,s=20,marker='o',color='black',label=r'Storm peak')
# Plot storm events (my picks)
CIRs_pred = np.where(Class_Proba[:,0] > 0.5)[0]
......@@ -1011,7 +1017,7 @@ def MusicalClassified(Time,HTime,Reference,Source,Storms,Class_Proba,Class,Kp_al
handles, labels = axs1.get_legend_handles_labels()
order = [0,1]
axs1.legend([handles[idx] for idx in order],[labels[idx] for idx in order], ncol=5,frameon=True,fontsize=11,loc='center left',bbox_to_anchor=[-0.1,-0.037])
axs1.legend([handles[idx] for idx in order],[labels[idx] for idx in order], ncol=5,frameon=True,fontsize=11,loc='center left',bbox_to_anchor=[-0.15,-0.037])
axs1.set_ylim([np.nanmin(y),np.nanmax(y)])
################################################
......@@ -1048,7 +1054,7 @@ def MusicalClassified(Time,HTime,Reference,Source,Storms,Class_Proba,Class,Kp_al
SN_end = np.where(SNYears == 2016.5)[0][0]
#axs3.plot((SN[SN_start:SN_end,1]-np.min(SN[SN_start:SN_end,1]))/np.ptp(SN[SN_start:SN_end,1]),SN[SN_start:SN_end,0],color='black',linewidth=1.5, label='SN')
axs3.plot((SN[SN_start:SN_end]/max(SN[SN_start:SN_end]))**1,SNYears[SN_start:SN_end],color='white',linewidth=1.5, label='SN')
axs3.plot((HMC_filt/min(HMC_filt))**1,HTime[:,4],color='white',linestyle='--',linewidth=1.5, label='HMC')
#axs3.plot((HMC_filt/min(HMC_filt))**1,HTime[:,4],color='white',linestyle='--',linewidth=1.5, label='HMC')
####################################################################
#Class occurrence in separate plot
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment