Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container Registry
Model registry
Operate
Environments
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
lscsoft
bilby
Commits
87dcdede
Commit
87dcdede
authored
6 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
make BBHPriorSet update test_redundancy
parent
9db4c495
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!59
Updating priors
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tupak/gw/prior.py
+40
-44
40 additions, 44 deletions
tupak/gw/prior.py
with
40 additions
and
44 deletions
tupak/gw/prior.py
+
40
−
44
View file @
87dcdede
...
...
@@ -17,54 +17,50 @@ class BBHPriorSet(PriorSet):
if
dictionary
is
None
and
filename
is
None
:
filename
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
prior_files
'
,
'
binary_black_holes.prior
'
)
logging
.
info
(
'
No prior given, using default BBH priors in {}.
'
.
format
(
filename
))
PriorSet
.
__init__
(
dictionary
=
dictionary
,
filename
=
filename
)
self
.
test_redundancy
=
test_cbc_redundancy
PriorSet
.
__init__
(
self
,
dictionary
=
dictionary
,
filename
=
filename
)
def
test_redundancy
(
self
,
key
):
"""
Test whether adding the key would add be redundant.
def
test_cbc_redundancy
(
key
,
prior
):
"""
Test whether adding the key would add be redundant.
Parameters
----------
key: str
The string to test.
Parameters
----------
key: str
The string to test.
prior: dict
Current prior dictionary.
Return
------
redundant: bool
Whether the key is redundant
"""
redundant
=
False
mass_parameters
=
{
'
mass_1
'
,
'
mass_2
'
,
'
chirp_mass
'
,
'
total_mass
'
,
'
mass_ratio
'
,
'
symmetric_mass_ratio
'
}
spin_magnitude_parameters
=
{
'
a_1
'
,
'
a_2
'
}
spin_tilt_1_parameters
=
{
'
tilt_1
'
,
'
cos_tilt_1
'
}
spin_tilt_2_parameters
=
{
'
tilt_2
'
,
'
cos_tilt_2
'
}
spin_azimuth_parameters
=
{
'
phi_1
'
,
'
phi_2
'
,
'
phi_12
'
,
'
phi_jl
'
}
inclination_parameters
=
{
'
iota
'
,
'
cos_iota
'
}
distance_parameters
=
{
'
luminosity_distance
'
,
'
comoving_distance
'
,
'
redshift
'
}
Return
------
redundant: bool
Whether the key is redundant
"""
redundant
=
False
mass_parameters
=
{
'
mass_1
'
,
'
mass_2
'
,
'
chirp_mass
'
,
'
total_mass
'
,
'
mass_ratio
'
,
'
symmetric_mass_ratio
'
}
spin_magnitude_parameters
=
{
'
a_1
'
,
'
a_2
'
}
spin_tilt_1_parameters
=
{
'
tilt_1
'
,
'
cos_tilt_1
'
}
spin_tilt_2_parameters
=
{
'
tilt_2
'
,
'
cos_tilt_2
'
}
spin_azimuth_parameters
=
{
'
phi_1
'
,
'
phi_2
'
,
'
phi_12
'
,
'
phi_jl
'
}
inclination_parameters
=
{
'
iota
'
,
'
cos_iota
'
}
distance_parameters
=
{
'
luminosity_distance
'
,
'
comoving_distance
'
,
'
redshift
'
}
for
parameter_set
in
[
mass_parameters
,
spin_magnitude_parameters
,
spin_azimuth_parameters
]:
if
key
in
parameter_set
:
if
len
(
parameter_set
.
intersection
(
prior
.
keys
()))
>
2
:
redundant
=
True
logging
.
warning
(
'
{} in prior. This may lead to unexpected behaviour.
'
.
format
(
parameter_set
.
intersection
(
prior
.
keys
())))
break
elif
len
(
parameter_set
.
intersection
(
prior
.
keys
()))
==
2
:
redundant
=
True
break
for
parameter_set
in
[
inclination_parameters
,
distance_parameters
,
spin_tilt_1_parameters
,
spin_tilt_2_parameters
]:
if
key
in
parameter_set
:
if
len
(
parameter_set
.
intersection
(
prior
.
keys
()))
>
1
:
redundant
=
True
logging
.
warning
(
'
{} in prior. This may lead to unexpected behaviour.
'
.
format
(
parameter_set
.
intersection
(
prior
.
keys
())))
break
elif
len
(
parameter_set
.
intersection
(
prior
.
keys
()))
==
1
:
for
parameter_set
in
[
mass_parameters
,
spin_magnitude_parameters
,
spin_azimuth_parameters
]:
if
key
in
parameter_set
:
if
len
(
parameter_set
.
intersection
(
self
.
__dict__
))
>
2
:
redundant
=
True
logging
.
warning
(
'
{} in prior. This may lead to unexpected behaviour.
'
.
format
(
parameter_set
.
intersection
(
self
.
__dict__
)))
break
elif
len
(
parameter_set
.
intersection
(
self
.
__dict__
))
==
2
:
redundant
=
True
break
for
parameter_set
in
[
inclination_parameters
,
distance_parameters
,
spin_tilt_1_parameters
,
spin_tilt_2_parameters
]:
if
key
in
parameter_set
:
if
len
(
parameter_set
.
intersection
(
self
.
__dict__
))
>
1
:
redundant
=
True
logging
.
warning
(
'
{} in prior. This may lead to unexpected behaviour.
'
.
format
(
parameter_set
.
intersection
(
self
.
__dict__
)))
break
elif
len
(
parameter_set
.
intersection
(
self
.
__dict__
))
==
1
:
redundant
=
True
break
return
redundant
return
redundant
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