Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Read-Rapidpe
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
Yu-Kuang Chu
Read-Rapidpe
Commits
c5161fd1
Commit
c5161fd1
authored
1 year ago
by
Yu-Kuang Chu
Browse files
Options
Downloads
Patches
Plain Diff
remove get_redshifts
parent
5460fbe5
Branches
master
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
read_rapidpe/plugins/em_bright.py
+1
-38
1 addition, 38 deletions
read_rapidpe/plugins/em_bright.py
with
1 addition
and
38 deletions
read_rapidpe/plugins/em_bright.py
+
1
−
38
View file @
c5161fd1
...
...
@@ -9,49 +9,12 @@ Several functions are copied/modified from ligo.em_bright:
import
h5py
import
numpy
as
np
from
scipy.interpolate
import
interp1d
from
astropy
import
cosmology
,
units
as
u
from
ligo.em_bright
import
computeDiskMass
,
utils
from
ligo.em_bright.em_bright
import
get_redshifts
ALL_EOS_DRAWS
=
utils
.
load_eos_posterior
()
def
get_redshifts
(
distances
,
N
=
10000
):
"""
Compute redshift using the Planck15 cosmology.
Parameters
----------
distances: float or numpy.ndarray
distance(s) in Mpc
N : int, optional
Number of steps for the computation of the interpolation function
Example
-------
>>>
distances
=
np
.
linspace
(
10
,
100
,
10
)
>>>
em_bright
.
get_redshifts
(
distances
)
array
([
0.00225566
,
0.00450357
,
0.00674384
,
0.00897655
,
0.01120181
,
0.0134197
,
0.01563032
,
0.01783375
0.02003009
,
0.02221941
])
Notes
-----
This function accepts HDF5 posterior samples file and computes
redshift by interpolating the distance-redshift relation.
"""
function
=
cosmology
.
Planck15
.
luminosity_distance
min_dist
=
np
.
min
(
distances
)
max_dist
=
np
.
max
(
distances
)
z_min
=
cosmology
.
z_at_value
(
func
=
function
,
fval
=
min_dist
*
u
.
Mpc
)
z_max
=
cosmology
.
z_at_value
(
func
=
function
,
fval
=
max_dist
*
u
.
Mpc
)
z_steps
=
np
.
linspace
(
z_min
-
(
0.1
*
z_min
),
z_max
+
(
0.1
*
z_max
),
N
)
lum_dists
=
cosmology
.
Planck15
.
luminosity_distance
(
z_steps
)
s
=
interp1d
(
lum_dists
,
z_steps
)
redshifts
=
s
(
distances
)
return
redshifts
def
em_bright
(
result
,
threshold
=
3.0
,
num_eos_draws
=
2000
,
eos_seed
=
None
,
eosname
=
None
):
"""
...
...
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