Skip to content

Commit

Permalink
finalized paper revision
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoestl committed Sep 2, 2020
1 parent 3197416 commit 40210d7
Show file tree
Hide file tree
Showing 4 changed files with 1,540 additions and 450 deletions.
15 changes: 8 additions & 7 deletions Moestl2020_PSP_rate/icme_rate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
"source": [
"# ICME rate for solar cycle 25 and PSP flux rope double crossings\n",
"\n",
"### jupyter notebook 1 of 2 \n",
"### jupyter notebook 1 of 2 for the paper Möstl et al. (2020, ApJ)\n",
"\n",
"\n",
"cme_rate.ipynb, cme_rate.py\n",
"https://github.com/helioforecast/Papers/tree/master/Moestl2020_PSP_rate\n",
"analyses ICMECAT data for CME rate paper Möstl et al. 2020, ApJ\n",
"\n",
"Author: C. Moestl, IWF Graz, Austria; twitter @chrisoutofspace; https://github.com/cmoestl\n",
"makes a prediction of the ICME rate in solar cycle 25\n",
"\n",
"For installation of a conda environment to run this code and how to download the data into a directory specified in config.py, see instructions in README.md of the heliocats github repo. Conda dependencies are listed under environment.yml, and pip in requirements.txt. Plots are saved in results/plots_rate/ as png and pdf.\n",
"Main author: C. Moestl, IWF Graz, Austria; twitter @chrisoutofspace; https://github.com/cmoestl\n",
"\n",
"For installation of a conda environment to run this code and how to download the data into a directory specified in config.py, see instructions in README.md of the github repo. Conda dependencies are listed under environment.yml, and pip in requirements.txt. Plots are saved in results/plots_rate/ as png and pdf.\n",
"\n",
"---\n",
"**Data sources**\n",
"\n",
"McIntosh et al. 2020\n",
Expand Down Expand Up @@ -62,7 +63,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -106,7 +107,7 @@
"\n",
"\n",
"#Convert this notebook to a script with jupyter nbconvert --to script cme_rate.ipynb\n",
"os.system('jupyter nbconvert --to script cme_rate.ipynb') \n",
"os.system('jupyter nbconvert --to script icme_rate.ipynb') \n",
"\n",
"#%matplotlib inline\n",
"#matplotlib.use('Qt5Agg')\n",
Expand Down
41 changes: 21 additions & 20 deletions Moestl2020_PSP_rate/icme_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@

# # ICME rate for solar cycle 25 and PSP flux rope double crossings
#
# ### jupyter notebook 1 of 2
# ### jupyter notebook 1 of 2 for the paper Möstl et al. (2020, ApJ)
#
#
# cme_rate.ipynb, cme_rate.py
# https://github.com/helioforecast/Papers/tree/master/Moestl2020_PSP_rate
# analyses ICMECAT data for CME rate paper Möstl et al. 2020, ApJ
#
# Author: C. Moestl, IWF Graz, Austria; twitter @chrisoutofspace; https://github.com/cmoestl
# makes a prediction of the ICME rate in solar cycle 25
#
# For installation of a conda environment to run this code and how to download the data into a directory specified in config.py, see instructions in README.md of the heliocats github repo. Conda dependencies are listed under environment.yml, and pip in requirements.txt. Plots are saved in results/plots_rate/ as png and pdf.
# Main author: C. Moestl, IWF Graz, Austria; twitter @chrisoutofspace; https://github.com/cmoestl
#
# For installation of a conda environment to run this code and how to download the data into a directory specified in config.py, see instructions in README.md of the github repo. Conda dependencies are listed under environment.yml, and pip in requirements.txt. Plots are saved in results/plots_rate/ as png and pdf.
#
# ---
# **Data sources**
#
# McIntosh et al. 2020
Expand Down Expand Up @@ -972,7 +973,7 @@
# ## **Figure 2** correlation SSN with ICME rate and fit
# plot SSN vs ICME rate, linear fit with confidence interval

# In[19]:
# In[27]:


#add spots23/24 and rc_rate23/24 into 1 array for correlation
Expand Down Expand Up @@ -1069,8 +1070,8 @@ def ssn_to_rate(ssn,fitresult):
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
ylinfit_2=(linfit.slope)*xlinfit+linfit.intercept-mean_stddev
ylinfit_1=(linfit.slope+linfit.stderr)*xlinfit+linfit.intercept+mean_stddev
ylinfit_2=(linfit.slope-linfit.stderr)*xlinfit+linfit.intercept-mean_stddev


plt.fill_between(xlinfit,ylinfit_1,ylinfit_2,alpha=0.2,color='coral',label='fit confidence 1$\mathrm{\sigma}$')
Expand All @@ -1093,7 +1094,7 @@ def ssn_to_rate(ssn,fitresult):
# ## predictions for solar cycle 25: SSN and ICME rate
# ### 1. Mean cycle model

# In[20]:
# In[12]:


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


# In[21]:
# In[13]:


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


# In[22]:
# In[14]:


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

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

# In[23]:
# In[15]:


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


# In[24]:
# In[16]:


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

# ### make PSP and Solar Orbiter position

# In[25]:
# In[17]:


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


# In[26]:
# In[18]:


#get the speed in hourly resolution
Expand Down Expand Up @@ -1714,7 +1715,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[27]:
# In[19]:


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


# In[28]:
# In[20]:


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

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

# In[29]:
# In[21]:


#fit yearly ICME rates again with hathaway function to get to daily resolution including errors
Expand Down Expand Up @@ -1947,7 +1948,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[30]:
# In[22]:


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

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

# In[32]:
# In[23]:


sns.set_context("talk")
Expand Down
1,712 changes: 1,308 additions & 404 deletions Moestl2020_PSP_rate/psp_3dcore.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 40210d7

Please sign in to comment.