Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marc Arene
bilby
Commits
71be186d
Commit
71be186d
authored
4 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
Rename new parameters
parent
9c9701d0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bilby/gw/likelihood.py
+5
-5
5 additions, 5 deletions
bilby/gw/likelihood.py
bilby/gw/utils.py
+6
-5
6 additions, 5 deletions
bilby/gw/utils.py
test/gw_likelihood_test.py
+5
-5
5 additions, 5 deletions
test/gw_likelihood_test.py
test/gw_utils_test.py
+7
-7
7 additions, 7 deletions
test/gw_utils_test.py
with
23 additions
and
22 deletions
bilby/gw/likelihood.py
+
5
−
5
View file @
71be186d
...
...
@@ -26,7 +26,7 @@ from .prior import BBHPriorDict, CBCPriorDict, Cosmological
from
.source
import
lal_binary_black_hole
from
.utils
import
(
noise_weighted_inner_product
,
build_roq_weights
,
blockwise_dot_product
,
kappa_eta
_to_ra_dec
)
zenith_azimuth
_to_ra_dec
)
from
.waveform_generator
import
WaveformGenerator
from
collections
import
namedtuple
...
...
@@ -85,7 +85,7 @@ class GravitationalWaveTransient(Likelihood):
Definition of the reference frame for the sky location.
-
"
sky
"
: sample in RA/dec, this is the default
- e.g.,
"
H1L1
"
, [
"
H1
"
,
"
L1
"
], InterferometerList([
"
H1
"
,
"
L1
"
]):
sample in azimuth and zenith, `
eta
` and `
kappa
` defined in the
sample in azimuth and zenith, `
azimuth
` and `
zenith
` defined in the
frame where the z-axis is aligned the the vector connecting H1
and L1.
time_reference: str, optional
...
...
@@ -760,8 +760,8 @@ class GravitationalWaveTransient(Likelihood):
def
get_sky_frame_parameters
(
self
):
time
=
self
.
parameters
[
'
{}_time
'
.
format
(
self
.
time_reference
)]
if
not
self
.
reference_frame
==
"
sky
"
:
ra
,
dec
=
kappa_eta
_to_ra_dec
(
self
.
parameters
[
'
kappa
'
],
self
.
parameters
[
'
eta
'
],
ra
,
dec
=
zenith_azimuth
_to_ra_dec
(
self
.
parameters
[
'
zenith
'
],
self
.
parameters
[
'
azimuth
'
],
time
,
self
.
reference_frame
)
else
:
ra
=
self
.
parameters
[
"
ra
"
]
...
...
@@ -937,7 +937,7 @@ class ROQGravitationalWaveTransient(GravitationalWaveTransient):
Definition of the reference frame for the sky location.
-
"
sky
"
: sample in RA/dec, this is the default
- e.g.,
"
H1L1
"
, [
"
H1
"
,
"
L1
"
], InterferometerList([
"
H1
"
,
"
L1
"
]):
sample in azimuth and zenith, `
eta
` and `
kappa
` defined in the
sample in azimuth and zenith, `
azimuth
` and `
zenith
` defined in the
frame where the z-axis is aligned the the vector connecting H1
and L1.
time_reference: str, optional
...
...
This diff is collapsed.
Click to expand it.
bilby/gw/utils.py
+
6
−
5
View file @
71be186d
...
...
@@ -329,7 +329,7 @@ def euler_rotation(delta_x):
return
total_rotation
def
kappa_eta_to_theta_phi
(
kappa
,
eta
,
ifos
):
def
zenith_azimuth_to_theta_phi
(
zenith
,
azimuth
,
ifos
):
"""
Convert from the
'
detector frame
'
to the Earth frame.
...
...
@@ -348,8 +348,9 @@ def kappa_eta_to_theta_phi(kappa, eta, ifos):
"""
delta_x
=
ifos
[
0
].
geometry
.
vertex
-
ifos
[
1
].
geometry
.
vertex
omega_prime
=
np
.
array
([
np
.
sin
(
kappa
)
*
np
.
cos
(
eta
),
np
.
sin
(
kappa
)
*
np
.
sin
(
eta
),
np
.
cos
(
kappa
)])
np
.
sin
(
zenith
)
*
np
.
cos
(
azimuth
),
np
.
sin
(
zenith
)
*
np
.
sin
(
azimuth
),
np
.
cos
(
zenith
)])
rotation_matrix
=
euler_rotation
(
delta_x
)
omega
=
np
.
dot
(
rotation_matrix
,
omega_prime
)
theta
=
np
.
arccos
(
omega
[
2
])
...
...
@@ -357,7 +358,7 @@ def kappa_eta_to_theta_phi(kappa, eta, ifos):
return
theta
,
phi
def
kappa_eta_to_ra_dec
(
kappa
,
eta
,
geocent_time
,
ifos
):
def
zenith_azimuth_to_ra_dec
(
zenith
,
azimuth
,
geocent_time
,
ifos
):
"""
Convert from the
'
detector frame
'
to the Earth frame.
...
...
@@ -376,7 +377,7 @@ def kappa_eta_to_ra_dec(kappa, eta, geocent_time, ifos):
ra, dec: float
The zenith and azimuthal angles in the sky frame.
"""
theta
,
phi
=
kappa_eta_to_theta_phi
(
kappa
,
eta
,
ifos
)
theta
,
phi
=
zenith_azimuth_to_theta_phi
(
zenith
,
azimuth
,
ifos
)
gmst
=
lal
.
GreenwichMeanSiderealTime
(
geocent_time
)
ra
,
dec
=
theta_phi_to_ra_dec
(
theta
,
phi
,
gmst
)
ra
=
ra
%
(
2
*
np
.
pi
)
...
...
This diff is collapsed.
Click to expand it.
test/gw_likelihood_test.py
+
5
−
5
View file @
71be186d
...
...
@@ -234,11 +234,11 @@ class TestGWTransient(unittest.TestCase):
)
parameters
=
self
.
parameters
.
copy
()
del
parameters
[
"
ra
"
],
parameters
[
"
dec
"
]
parameters
[
"
kappa
"
]
=
1.0
parameters
[
"
eta
"
]
=
1.0
parameters
[
"
ra
"
],
parameters
[
"
dec
"
]
=
bilby
.
gw
.
utils
.
kappa_eta
_to_ra_dec
(
kappa
=
parameters
[
"
kappa
"
],
eta
=
parameters
[
"
eta
"
],
parameters
[
"
zenith
"
]
=
1.0
parameters
[
"
azimuth
"
]
=
1.0
parameters
[
"
ra
"
],
parameters
[
"
dec
"
]
=
bilby
.
gw
.
utils
.
zenith_azimuth
_to_ra_dec
(
zenith
=
parameters
[
"
zenith
"
],
azimuth
=
parameters
[
"
azimuth
"
],
geocent_time
=
parameters
[
"
geocent_time
"
],
ifos
=
bilby
.
gw
.
detector
.
InterferometerList
([
"
H1
"
,
"
L1
"
])
)
...
...
This diff is collapsed.
Click to expand it.
test/gw_utils_test.py
+
7
−
7
View file @
71be186d
...
...
@@ -265,8 +265,8 @@ class TestSkyFrameConversion(unittest.TestCase):
self
.
priors
=
bilby
.
core
.
prior
.
PriorDict
()
self
.
priors
[
"
ra
"
]
=
bilby
.
core
.
prior
.
Uniform
(
0
,
2
*
np
.
pi
)
self
.
priors
[
"
dec
"
]
=
bilby
.
core
.
prior
.
Cosine
()
self
.
priors
[
"
eta
"
]
=
bilby
.
core
.
prior
.
Uniform
(
0
,
2
*
np
.
pi
)
self
.
priors
[
"
kappa
"
]
=
bilby
.
core
.
prior
.
Sine
()
self
.
priors
[
"
azimuth
"
]
=
bilby
.
core
.
prior
.
Uniform
(
0
,
2
*
np
.
pi
)
self
.
priors
[
"
zenith
"
]
=
bilby
.
core
.
prior
.
Sine
()
self
.
priors
[
"
time
"
]
=
bilby
.
core
.
prior
.
Uniform
(
-
0.1
,
0.1
)
self
.
ifos
=
bilby
.
gw
.
detector
.
InterferometerList
([
"
H1
"
,
"
L1
"
])
self
.
samples
=
self
.
priors
.
sample
(
10000
)
...
...
@@ -277,14 +277,14 @@ class TestSkyFrameConversion(unittest.TestCase):
del
self
.
samples
def
test_conversion_gives_correct_prior
(
self
)
->
None
:
kappa
s
=
self
.
samples
[
"
kappa
"
]
eta
s
=
self
.
samples
[
"
eta
"
]
zenith
s
=
self
.
samples
[
"
zenith
"
]
azimuth
s
=
self
.
samples
[
"
azimuth
"
]
times
=
self
.
samples
[
"
time
"
]
args
=
zip
(
*
[
(
kappa
,
eta
,
time
,
self
.
ifos
)
for
kappa
,
eta
,
time
in
zip
(
kappas
,
eta
s
,
times
)
(
zenith
,
azimuth
,
time
,
self
.
ifos
)
for
zenith
,
azimuth
,
time
in
zip
(
zeniths
,
azimuth
s
,
times
)
])
ras
,
decs
=
zip
(
*
map
(
bilby
.
gw
.
utils
.
kappa_eta
_to_ra_dec
,
*
args
))
ras
,
decs
=
zip
(
*
map
(
bilby
.
gw
.
utils
.
zenith_azimuth
_to_ra_dec
,
*
args
))
self
.
assertGreaterEqual
(
ks_2samp
(
self
.
samples
[
"
ra
"
],
ras
).
pvalue
,
0.01
)
self
.
assertGreaterEqual
(
ks_2samp
(
self
.
samples
[
"
dec
"
],
decs
).
pvalue
,
0.01
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment