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
ae4fc1d8
Commit
ae4fc1d8
authored
3 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
Wrap astropy z_at_value for v5.
parent
b8b4a781
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1054
Wrap astropy z_at_value for v5.
Pipeline
#341909
passed
3 years ago
Stage: initial
Stage: test
Stage: docs
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bilby/gw/conversion.py
+1
-3
1 addition, 3 deletions
bilby/gw/conversion.py
bilby/gw/cosmology.py
+12
-0
12 additions, 0 deletions
bilby/gw/cosmology.py
bilby/gw/prior.py
+1
-2
1 addition, 2 deletions
bilby/gw/prior.py
with
14 additions
and
5 deletions
bilby/gw/conversion.py
+
1
−
3
View file @
ae4fc1d8
...
...
@@ -11,7 +11,7 @@ from ..core.utils import logger, solar_mass, command_line_args
from
..core.prior
import
DeltaFunction
from
.utils
import
lalsim_SimInspiralTransformPrecessingNewInitialConditions
from
.eos.eos
import
SpectralDecompositionEOS
,
EOSFamily
,
IntegrateTOV
from
.cosmology
import
get_cosmology
from
.cosmology
import
get_cosmology
,
z_at_value
def
redshift_to_luminosity_distance
(
redshift
,
cosmology
=
None
):
...
...
@@ -27,7 +27,6 @@ def redshift_to_comoving_distance(redshift, cosmology=None):
@np.vectorize
def
luminosity_distance_to_redshift
(
distance
,
cosmology
=
None
):
from
astropy
import
units
from
astropy.cosmology
import
z_at_value
cosmology
=
get_cosmology
(
cosmology
)
return
z_at_value
(
cosmology
.
luminosity_distance
,
distance
*
units
.
Mpc
)
...
...
@@ -35,7 +34,6 @@ def luminosity_distance_to_redshift(distance, cosmology=None):
@np.vectorize
def
comoving_distance_to_redshift
(
distance
,
cosmology
=
None
):
from
astropy
import
units
from
astropy.cosmology
import
z_at_value
cosmology
=
get_cosmology
(
cosmology
)
return
z_at_value
(
cosmology
.
comoving_distance
,
distance
*
units
.
Mpc
)
...
...
This diff is collapsed.
Click to expand it.
bilby/gw/cosmology.py
+
12
−
0
View file @
ae4fc1d8
...
...
@@ -63,3 +63,15 @@ def set_cosmology(cosmology=None):
COSMOLOGY
[
1
]
=
cosmology
.
name
else
:
COSMOLOGY
[
1
]
=
repr
(
cosmology
)
def
z_at_value
(
func
,
fval
,
**
kwargs
):
"""
Wrapped version of :code:`astropy.cosmology.z_at_value` to return float
rather than an :code:`astropy Quantity` as returned for :code:`astropy>=5`.
See https://docs.astropy.org/en/stable/api/astropy.cosmology.z_at_value.html#astropy.cosmology.z_at_value
for detailed documentation.
"""
from
astropy.cosmology
import
z_at_value
return
float
(
z_at_value
(
func
=
func
,
fval
=
fval
,
**
kwargs
))
This diff is collapsed.
Click to expand it.
bilby/gw/prior.py
+
1
−
2
View file @
ae4fc1d8
...
...
@@ -20,7 +20,7 @@ from .conversion import (
generate_all_bbh_parameters
,
chirp_mass_and_mass_ratio_to_total_mass
,
total_mass_and_mass_ratio_to_component_masses
)
from
.cosmology
import
get_cosmology
from
.cosmology
import
get_cosmology
,
z_at_value
from
.source
import
PARAMETER_SETS
from
.utils
import
calculate_time_to_merger
...
...
@@ -170,7 +170,6 @@ class Cosmological(Interped):
recalculate_array: boolean
Determines if the distance arrays are recalculated
"""
from
astropy.cosmology
import
z_at_value
cosmology
=
get_cosmology
(
self
.
cosmology
)
limit_dict
[
self
.
name
]
=
value
if
self
.
name
==
'
redshift
'
:
...
...
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