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
9f151255
Commit
9f151255
authored
6 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
remove comoving distance from UniformComovingVolume
parent
cb59db38
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!271
Improve cosmology use
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/gw/prior.py
+32
-37
32 additions, 37 deletions
bilby/gw/prior.py
with
32 additions
and
37 deletions
bilby/gw/prior.py
+
32
−
37
View file @
9f151255
...
...
@@ -15,13 +15,13 @@ except ImportError:
"
not be able to use some of the prebuilt functions.
"
)
class
UniformComovingVolume
(
FromFile
):
class
UniformComovingVolume
(
Interped
):
def
__init__
(
self
,
minimum
=
None
,
maximum
=
None
,
cosmology
=
None
,
name
=
'
luminosity distance
'
,
unit
=
'
Mpc
'
):
"""
Prior distribution on
_
luminosity distance
_ which is uniform in comoving
volume based on the specified cosmology.
Prior distribution on
either
luminosity distance
or redshift which is
uniform in comoving
volume based on the specified cosmology.
The default cosmology is Planck15 as implemented in astropy.
...
...
@@ -37,47 +37,42 @@ class UniformComovingVolume(FromFile):
name: str, optional
Name specifying which distance parameter to use, the options are:
- luminosity_distance
- comoving_distance
- redshift
unit: (astropy.units.Mpc, str), optional
Units, if a string that string will be searched for in
astropy.units. Default=Mpc
"""
if
name
==
'
comoving_volume
'
:
PowerLaw
(
alpha
=
2
,
minimum
=
minimum
,
maximum
=
maximum
,
name
=
name
,
latex_label
=
'
$d_C$
'
,
unit
=
str
(
unit
))
if
cosmology
is
None
:
cosmology
=
COSMOLOGY
[
0
]
elif
isinstance
(
cosmology
,
str
):
cosmology
=
cosmo
.
__dict__
[
cosmology
]
if
isinstance
(
unit
,
str
):
unit
=
units
.
__dict__
[
unit
]
self
.
cosmology
=
cosmology
.
name
if
name
==
'
redshift
'
:
zs
=
np
.
linspace
(
minimum
,
maximum
,
1000
)
dvc_dz
=
cosmology
.
differential_comoving_volume
(
zs
).
value
Interped
.
__init__
(
self
,
xx
=
zs
,
yy
=
dvc_dz
,
minimum
=
minimum
,
maximum
=
maximum
,
name
=
name
,
latex_label
=
'
$z$
'
)
else
:
if
cosmology
is
None
:
cosmology
=
COSMOLOGY
[
0
]
elif
isinstance
(
cosmology
,
str
):
cosmology
=
cosmo
.
__dict__
[
cosmology
]
if
isinstance
(
unit
,
str
):
unit
=
units
.
__dict__
[
unit
]
self
.
cosmology
=
cosmology
.
name
if
name
==
'
redshift
'
:
zs
=
np
.
linspace
(
minimum
,
maximum
,
1000
)
dvc_dz
=
cosmology
.
differential_comoving_volume
(
zs
).
value
Interped
.
__init__
(
self
,
xx
=
zs
,
yy
=
dvc_dz
,
minimum
=
minimum
,
maximum
=
maximum
,
name
=
name
,
latex_label
=
'
$z$
'
)
if
minimum
==
0
:
z_min
=
0
else
:
if
minimum
==
0
:
z_min
=
0
else
:
z_min
=
cosmo
.
z_at_value
(
cosmology
.
luminosity_distance
,
minimum
*
unit
)
z_max
=
cosmo
.
z_at_value
(
cosmology
.
luminosity_distance
,
maximum
*
unit
)
zs
=
np
.
linspace
(
z_min
*
0.99
,
z_max
*
1.01
,
1000
)
dvc_dz
=
cosmology
.
differential_comoving_volume
(
zs
).
value
dl_of_z
=
np
.
array
([
cosmology
.
luminosity_distance
(
z
).
value
for
z
in
zs
])
ddl_dz
=
np
.
gradient
(
dl_of_z
,
zs
)
dvc_ddl
=
dvc_dz
/
ddl_dz
Interped
.
__init__
(
self
,
xx
=
dl_of_z
,
yy
=
dvc_ddl
,
minimum
=
minimum
,
maximum
=
maximum
,
name
=
name
,
latex_label
=
'
$d_L$
'
,
unit
=
str
(
unit
))
z_min
=
cosmo
.
z_at_value
(
cosmology
.
luminosity_distance
,
minimum
*
unit
)
z_max
=
cosmo
.
z_at_value
(
cosmology
.
luminosity_distance
,
maximum
*
unit
)
zs
=
np
.
linspace
(
z_min
*
0.99
,
z_max
*
1.01
,
1000
)
dvc_dz
=
cosmology
.
differential_comoving_volume
(
zs
).
value
dl_of_z
=
np
.
array
([
cosmology
.
luminosity_distance
(
z
).
value
for
z
in
zs
])
ddl_dz
=
np
.
gradient
(
dl_of_z
,
zs
)
dvc_ddl
=
dvc_dz
/
ddl_dz
Interped
.
__init__
(
self
,
xx
=
dl_of_z
,
yy
=
dvc_ddl
,
minimum
=
minimum
,
maximum
=
maximum
,
name
=
name
,
latex_label
=
'
$d_L$
'
,
unit
=
str
(
unit
))
class
AlignedSpin
(
Interped
):
...
...
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