Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
astro
astrotools
Commits
ee4c6f54
Commit
ee4c6f54
authored
Dec 13, 2019
by
Marcus Wirtz
Browse files
[simulations] Adapt plot to new chosen charge colors
parent
6dc14fd8
Pipeline
#218725
passed with stages
in 5 minutes and 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
astrotools/simulations.py
View file @
ee4c6f54
...
...
@@ -749,18 +749,22 @@ class SourceBound(BaseSimulation):
norm
=
np
.
sum
(
np
.
array
(
10
**
log10e_center
*
dspectrum
[
'mean'
])[
dspectrum
[
'logE'
]
>
np
.
min
(
bins
)])
plt
.
errorbar
(
st
.
mid
(
bins
),
flux_sim
/
np
.
sum
(
n
)
*
norm
,
xerr
=
0.05
,
marker
=
'.'
,
ls
=
'none'
,
color
=
'k'
)
# plot arriving composition (spline approximation)
e
,
c
=
[
'h'
,
'he'
,
'n'
,
'si-fe'
],
[
1
,
2
,
7
,
26
]
colors
=
[
'firebrick'
,
'darkorange'
,
'forestgreen'
,
'deepskyblue'
,
'darkblue'
]
e
,
c
=
[
'h'
,
'he'
,
'n'
,
'si'
,
'fe'
],
[
1
,
2
,
7
,
14
,
26
]
for
i
,
ei
in
enumerate
(
e
):
_log10e
=
log10e
[
self
.
crs
[
'charge'
]
==
c
[
i
]]
mask
=
self
.
crs
[
'charge'
]
==
c
[
i
]
if
np
.
sum
(
mask
)
==
0
:
continue
_log10e
=
log10e
[
mask
]
_n
,
_bins
=
np
.
histogram
(
_log10e
.
flatten
(),
bins
=
log10e_bins
)
flux_sim
=
(
10
**
st
.
mid
(
bins
))
**
2
*
_n
_bins
=
np
.
linspace
(
np
.
min
(
log10e
),
np
.
max
(
log10e
),
300
)
smooth_spline
=
interp1d
(
st
.
mid
(
bins
),
flux_sim
/
np
.
sum
(
n
)
*
norm
,
kind
=
'cubic'
,
bounds_error
=
False
)
plt
.
plot
(
_bins
,
smooth_spline
(
_bins
),
color
=
'C%i'
%
i
,
label
=
ei
)
plt
.
plot
(
_bins
,
smooth_spline
(
_bins
),
color
=
colors
[
i
]
,
label
=
ei
)
plt
.
yscale
(
'log'
)
plt
.
xlim
([
self
.
energy_setting
[
'log10e_min'
]
-
0.01
,
np
.
max
(
log10e
)
+
0.07
])
plt
.
ylim
([
5
e3
5
,
1e38
])
plt
.
legend
(
loc
=
'lower left'
,
fontsize
=
1
4
)
plt
.
ylim
([
1
e3
6
,
1e38
])
plt
.
legend
(
loc
=
'lower left'
,
fontsize
=
1
2
)
yl
=
r
'$E^{3} \, J(E)$ [km$^{-2}$ yr$^{-1}$ sr$^{-1}$ eV$^{2}$]'
plt
.
ylabel
(
yl
,
fontsize
=
16
)
plt
.
xlabel
(
r
'$\log_{10}$($E$/eV)'
,
fontsize
=
16
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment