-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotSolarModel.py
80 lines (62 loc) · 1.84 KB
/
plotSolarModel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#Tom O'Shea 2024
# plot solar model
import numpy as np
from numpy import loadtxt
from matplotlib import pyplot as plt
plt.style.use("style.txt") # import plot style
# setup plot
fig2 = plt.figure(1) # display is 1920 x 1080 (16:9)
ax2 = fig2.subplots()
ax2.set(xlim=(1e-2,1.01), ylim=(1e-3,1.01))
#ax2.set(xlim=(0,1), ylim=(0,3.05e3))
# radius (fraction)
r = loadtxt("data/rFrac.dat")
# plasma freq
dat = loadtxt("data/wp.dat")
dat = dat / np.nanmax(dat)
ax2.plot(r,dat, label='Plasma frequency', ls='--')
# density
dat = loadtxt("data/rho.dat")
dat = dat / np.nanmax(dat)
ax2.plot(r,dat, label='Density', ls='--')
# temperature
dat = loadtxt("data/T.dat")
dat = dat / np.nanmax(dat)
ax2.plot(r,dat,label="Temperature",ls=':')
# B-field
dat = loadtxt("data/Bfields-R.dat")
dat[:,1] = dat[:,1] / np.nanmax(dat[:,1])
ax2.plot(dat[:,0],dat[:,1],label="Magnetic field strength",ls='-')
# electron number density
#dat = loadtxt("data/ne.dat")
#dat = dat / np.nanmax(dat)
#ax2.plot(r,dat,label="Electron number density")
# H number density
#dat = loadtxt("data/nH.dat")
#dat = dat / np.nanmax(dat)
#ax2.plot(r,dat,label="H number density")
# 3He number density
#dat = loadtxt("data/nHe3.dat")
#dat = dat / np.nanmax(dat)
#ax2.plot(r,dat,label="3He number density")
# 4He number density
#dat = loadtxt("data/nHe4.dat")
#dat = dat / np.nanmax(dat)
#ax2.plot(r,dat,label="4He number density")
# 57Fe number density
#dat = loadtxt("data/n57Fe.dat")
#dat = dat / np.nanmax(dat)
#ax2.plot(r,dat,label="57Fe number density",ls='-.')
# axes
ax2.set_xlabel("Solar radius fraction")
#ax2.set_ylabel("Solar parameters (normalised)")
ax2.set_ylabel("B-field strength [T]")
#ax2.set_xscale('log')
#ax2.set_yscale('log')
#ax2.legend()
plt.tight_layout()
name = "solarmodel-lin"
plt.savefig('plots/{}.jpg'.format(name))
plt.savefig('plots/pdfs/{}.pdf'.format(name))
plt.show()
plt.show()