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
4ea6263f
Commit
4ea6263f
authored
Feb 08, 2021
by
teresa.bister
Browse files
[simulations] fix bug with rmax (wrong rmax to distance bin conversion)
parent
6e11ee2e
Pipeline
#406475
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
astrotools/simulations.py
View file @
4ea6263f
...
...
@@ -732,7 +732,7 @@ class SourceBound(BaseSimulation):
dis_idx
=
np
.
argmin
(
np
.
abs
(
np
.
atleast_1d
(
self
.
universe
.
rmax
)[
None
]
-
self
.
dis_bins
[:,
None
]),
axis
=
0
)
# loop over all occuring distance bins and fill events of the respective sets
for
_dis
in
np
.
sort
(
np
.
unique
(
dis_idx
)):
arrival_mat_far
[
self
.
dis_bins
<
_dis
]
=
0
# set probabilities inside rmax to zero
arrival_mat_far
[
0
:
_dis
]
=
0
# set probabilities inside rmax to zero
mask_pick
=
~
mask_close
&
(
dis_idx
==
_dis
)[:,
np
.
newaxis
]
# select background events of respective set
n_pick
=
np
.
sum
(
mask_pick
)
arrival_mat_far
/=
arrival_mat_far
.
sum
()
# normalize arrival matrix to then draw random samples
...
...
@@ -1225,7 +1225,8 @@ class SourceScenario:
vecs
=
coord
.
eq2gal
(
coord
.
ang2vec
(
np
.
deg2rad
(
data
[
'ra'
]),
np
.
deg2rad
(
data
[
'dec'
])))
flux
=
data
[
'flux'
]
*
100
/
np
.
sum
(
data
[
'flux'
])
return
vecs
,
flux
,
data
[
'distance'
],
data
[
'names'
]
names
=
np
.
array
([
data
[
'names'
][
i
].
decode
(
'UTF-8'
)
for
i
in
range
(
len
(
data
[
'names'
]))]).
flatten
()
return
vecs
,
flux
,
data
[
'distance'
],
names
@
staticmethod
def
agn_3fhl
():
...
...
@@ -1238,7 +1239,8 @@ class SourceScenario:
vecs
=
coord
.
eq2gal
(
coord
.
ang2vec
(
np
.
deg2rad
(
data
[
'ra'
]),
np
.
deg2rad
(
data
[
'dec'
])))
flux
=
data
[
'flux'
]
*
100
/
np
.
sum
(
data
[
'flux'
])
return
vecs
,
flux
,
data
[
'distance'
],
data
[
'names'
]
names
=
np
.
array
([
data
[
'names'
][
i
].
decode
(
'UTF-8'
)
for
i
in
range
(
len
(
data
[
'names'
]))]).
flatten
()
return
vecs
,
flux
,
data
[
'distance'
],
names
@
staticmethod
def
gamma_agn
():
...
...
Teresa Karolin Bister
🤛🏻
@teresa.bister
mentioned in commit
2ee4c9cb
·
Nov 17, 2021
mentioned in commit
2ee4c9cb
mentioned in commit 2ee4c9cb11b437f96d21748be0b9fbc1bae98407
Toggle commit list
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