Read Rapid-PE
This is a package to read Rapid-PE outputs.
Install
Install from PyPI
This read-rapidpe package is available on PyPI: https://pypi.org/project/read-rapidpe/
pip install read-rapidpe
Install in dev mode
git clone git@git.ligo.org:yu-kuang.chu/read-rapidpe.git
cd read-rapidpe
pip install -e .
Example Usage
Reading files
from read_rapidpe import RapidPE_result
run_dir = "path/to/run_dir"
result = RapidPE_result.from_run_dir(run_dir)
There are three optional arguments:
use_ligolw( default =True) : whether to useligo.lwto read XML files.extrinsic_table( default =True) : whether to load extrinsic parameter as well.parallel_n( default =1) : number of parallel jobs when reading XML files.
For example, one can do the following to speed up the reading process:
result = RapidPE_result.from_run_dir(run_dir, use_ligolw=False, extrinsic_table=False, parallel_n=4)
Plot marginalized log-likelihood on m1-m2 grid points
import matplotlib.pyplot as plt
# Plot marginalized-log-likelihood over intrinsic parameter (mass_1/mass_2) grid points
plt.scatter(result.mass_1, result.mass_2, c=result.marg_log_likelihood )
plt.xlabel("$m_1$")
plt.ylabel("$m_2$")
plt.colorbar(label="$\ln(L_{marg})$")
Plot interpolated likelihood
import matplotlib.pyplot as plt
import numpy as np
# Create Random m1, m2 samples
m1 = np.random.random(10000)*5
m2 = np.random.random(10000)*5
# After calling result.do_interpolate_marg_log_likelihood_m1m2(),
# the method result.log_likelihood(m1, m2) will be avalible.
result.do_interpolate_marg_log_likelihood_m1m2()
# Calculate interpolated log_likelihood
log_likelihood = result.log_likelihood(m1, m2)
# =============== Plotting ===============
# Plot interpolated likelihood
plt.scatter(m1, m2, c=np.exp(log_likelihood), marker=".", s=3, alpha=0.1)
# Plot marginalized likelihood on grid points
plt.scatter(result.mass_1, result.mass_2, c=np.exp(result.marg_log_likelihood), marker="+", vmin=0)
plt.xlabel("$m_1$")
plt.ylabel("$m_2$")
plt.colorbar(label=r"$\mathcal{L}$")
Convert to Pandas DataFrame
import pandas as pd
from read_rapidpe import RapidPE_grid_point
grid_point = RapidPE_grid_point.from_xml("ILE_iteration_xxxxxxxxxx.samples.xml.gz")
pd.DataFrame(grid_point.extrinsic_table)
Metadata
Release files for read-rapidpe 0.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| read_rapidpe-0.6.3.tar.gz | 21.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| read_rapidpe-0.6.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.3 kB
Release files / read_rapidpe-0.6.3.tar.gz
| Download URL | read_rapidpe-0.6.3.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b0cb416861f95434d10c43b3d4c0a5daed42a1d84fae96c2552a5a717130394
|
|
BLAKE2b-256 checksum How to use checksums |
6f9b09a40faebab2019172a0e3b028d2c517ff59fbfc90808ff5c62aa7ec7d10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.6 Darwin/21.6.0
|
Release files / read_rapidpe-0.6.3-py3-none-any.whl
| Download URL | read_rapidpe-0.6.3-py3-none-any.whl |
|---|---|
| Size | 24.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d9aa2081f3fb5ce284925ec02739055b30e718a297ba5e4fbe117beac63ddbf
|
|
BLAKE2b-256 checksum How to use checksums |
44e964dea6a7c73485990ae536f35feb65c40073c52e7d208b21dce7df821678
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.6 Darwin/21.6.0
|