Skip to content

Commit

Permalink
first revision draft
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoestl committed Aug 28, 2020
1 parent c1af887 commit 3197416
Show file tree
Hide file tree
Showing 5 changed files with 646 additions and 834 deletions.
4 changes: 2 additions & 2 deletions Moestl2020_PSP_rate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ This code creates results, figures, and animations for the paper Möstl et al. (

There are 2 jupyter notebooks,

(1) cme_rate.ipynb calculates the ICME rate for solar cycle 25
(1) icme_rate.ipynb calculates the ICME rate for solar cycle 25 and Parker Solar Probe and Solar Orbit trajectory plots.


(2) psp_3dcore.pynb simulates PSP double crossings with 3DCORE
(2) psp_3dcore.pynb simulates PSP double crossings with 3DCORE.



Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@

# ### get yearly ICME rates at each spacecraft

# In[7]:
# In[6]:


#define dates of January 1 from 2007 to 2020
Expand Down Expand Up @@ -654,7 +654,7 @@

# ### get Richardson and Cane ICME rate for comparison

# In[8]:
# In[7]:


#convert times in dataframe from richardson and cane list to numpy array
Expand Down Expand Up @@ -698,7 +698,7 @@

# ### **Figure 1** plot ICME frequency cycle 24

# In[9]:
# In[8]:


sns.set_context("talk")
Expand Down Expand Up @@ -829,7 +829,7 @@

# ## solar cycle 23

# In[10]:
# In[9]:


print('cycle 23\n')
Expand Down Expand Up @@ -913,7 +913,7 @@

# ## solar cycle 24

# In[11]:
# In[10]:


print('cycle 24\n')
Expand Down Expand Up @@ -972,7 +972,7 @@
# ## **Figure 2** correlation SSN with ICME rate and fit
# plot SSN vs ICME rate, linear fit with confidence interval

# In[70]:
# In[19]:


#add spots23/24 and rc_rate23/24 into 1 array for correlation
Expand Down Expand Up @@ -1033,8 +1033,8 @@ def ssn_to_rate(ssn,fitresult):
#with these results from the linear fit, make a conversion function from ssn to icme_rate
def ssn_to_rate(ssn,fitresult):
rate=linfit.slope*ssn+linfit.intercept
rate_low=(linfit.slope-1*linfit.stderr)*ssn+linfit.intercept
rate_up=(linfit.slope+1*linfit.stderr)*ssn+linfit.intercept
rate_low=(linfit.slope-1*linfit.stderr)*ssn+linfit.intercept - mean_stddev
rate_up=(linfit.slope+1*linfit.stderr)*ssn+linfit.intercept + mean_stddev
return rate, rate_low, rate_up


Expand Down Expand Up @@ -1063,6 +1063,10 @@ def ssn_to_rate(ssn,fitresult):
#sns.regplot(spots_corr,rc_rate_corr, x_ci='ci',ci=95,label=r'fit confidence 2$\mathrm{\sigma}$',truncate=False)
#sns.regplot(spots_corr,rc_rate_corr, x_ci='ci',ci=68,label=r'fit confidence 1$\mathrm{\sigma}$',truncate=False)




xlinfit=np.arange(0,350)
#1 sigma interval by using mean difference as +/- to linear fit

ylinfit_1=(linfit.slope)*xlinfit+linfit.intercept+mean_stddev
Expand All @@ -1075,8 +1079,6 @@ def ssn_to_rate(ssn,fitresult):




xlinfit=np.arange(0,350)
ylinfit=linfit.slope*xlinfit+linfit.intercept
plt.plot(xlinfit,ylinfit,'-k',label='linear fit')
plt.plot(xlinfit,np.zeros(len(xlinfit))+52,'--k',alpha=0.5)
Expand All @@ -1091,7 +1093,7 @@ def ssn_to_rate(ssn,fitresult):
# ## predictions for solar cycle 25: SSN and ICME rate
# ### 1. Mean cycle model

# In[13]:
# In[20]:


# from heliocats import stats as hs
Expand Down Expand Up @@ -1210,7 +1212,7 @@ def ssn_to_rate(ssn,fitresult):
print(ic_rate_25_m_std)


# In[14]:
# In[21]:


########################################################### 2. SC25 panel prediction (SC25PP)
Expand Down Expand Up @@ -1329,7 +1331,7 @@ def ssn_to_rate(ssn,fitresult):
print(ic_rate_25_pp_std)


# In[15]:
# In[22]:


################################### SC25MC
Expand Down Expand Up @@ -1427,7 +1429,7 @@ def ssn_to_rate(ssn,fitresult):

# ## **Figure 3** ICME rate predictions

# In[45]:
# In[23]:


sns.set_context("talk")
Expand Down Expand Up @@ -1523,7 +1525,7 @@ def ssn_to_rate(ssn,fitresult):
plt.savefig('results/plots_rate/fig3_sc25_predictions.png', dpi=300)


# In[17]:
# In[24]:


#Extra plot for solar cycle comparison
Expand Down Expand Up @@ -1592,7 +1594,7 @@ def ssn_to_rate(ssn,fitresult):

# ### make PSP and Solar Orbiter position

# In[18]:
# In[25]:


frame='HEEQ'
Expand Down Expand Up @@ -1682,7 +1684,7 @@ def ssn_to_rate(ssn,fitresult):
plt.xlabel('AU')


# In[19]:
# In[26]:


#get the speed in hourly resolution
Expand Down Expand Up @@ -1712,7 +1714,7 @@ def ssn_to_rate(ssn,fitresult):
print('psp maximum speed ',np.max(psp_highres_speed),' km/s at ',psp_highres_r[np.argmax(psp_highres_speed)], ' AU')


# In[20]:
# In[27]:


#%matplotlib inline
Expand Down Expand Up @@ -1781,7 +1783,7 @@ def ssn_to_rate(ssn,fitresult):
plt.savefig('results/psp_orbits.png', dpi=100)


# In[21]:
# In[28]:


#same thing for Solar Orbiter
Expand Down Expand Up @@ -1885,7 +1887,7 @@ def ssn_to_rate(ssn,fitresult):

# first calculate smooth functions for the icme rate including the derived error bars in Figure 3

# In[22]:
# In[29]:


#fit yearly ICME rates again with hathaway function to get to daily resolution including errors
Expand Down Expand Up @@ -1945,7 +1947,7 @@ def ssn_to_rate(ssn,fitresult):

# Figure out how many ICMEs PSP sees < 0.1 AU, < 0.2 AU, < 0.3 AU for the predicted ICME rates

# In[23]:
# In[30]:


#make position new in order to be of similar range with ICME rate spline fits
Expand Down Expand Up @@ -2076,7 +2078,7 @@ def ssn_to_rate(ssn,fitresult):

# ## **Figure 4** PSP Solar Orbiter distance and ICME rate

# In[24]:
# In[32]:


sns.set_context("talk")
Expand Down Expand Up @@ -2181,3 +2183,15 @@ def ssn_to_rate(ssn,fitresult):




# In[ ]:





# In[ ]:




1,198 changes: 542 additions & 656 deletions Moestl2020_PSP_rate/psp_3dcore.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 3197416

Please sign in to comment.