Skip to content
Snippets Groups Projects
Commit d2ff297c authored by Deep Chatterjee's avatar Deep Chatterjee
Browse files

port over to ligo.em-bright instead of p-astro

- bump p-astro to a pre-release v1.0.0dev1, stripping all em-bright components
- add ligo.em-bright dependency
parent 3af54584
No related branches found
No related tags found
1 merge request!830port over to ligo.em-bright instead of p-astro
......@@ -4,7 +4,11 @@ Changelog
1.0.1 (unreleased)
------------------
- No changes yet.
- Bump ``p-astro`` to pre-release ``v1.0.0dev1``. This version is a stop gap to
bring back the reference O3 hard-cut implementation of p-astro, and
resolve the dependency issues. Will need a full release later.
- Add ``ligo.em_bright>=0.1.5`` dependency.
1.0.0 (2022-01-21)
------------------
......
......@@ -3,7 +3,7 @@ import io
import json
from matplotlib import pyplot as plt
from ligo import computeDiskMass, em_bright
from ligo.em_bright import computeDiskMass, em_bright, PACKAGE_FILENAMES
from celery.utils.log import get_task_logger
......@@ -14,9 +14,13 @@ from ..util import (closing_figures, NamedTemporaryFile, PromiseProxy,
read_pickle)
NS_CLASSIFIER = PromiseProxy(
read_pickle, ('ligo.data', 'knn_ns_classifier.pkl'))
read_pickle, (PACKAGE_FILENAMES['knn_ns_classifier.pkl'],),
dict(encoding='binary')
)
EM_CLASSIFIER = PromiseProxy(
read_pickle, ('ligo.data', 'knn_em_classifier.pkl'))
read_pickle, (PACKAGE_FILENAMES['knn_em_classifier.pkl'],),
dict(encoding='binary')
)
log = get_task_logger(__name__)
......
......@@ -39,12 +39,12 @@ def test_classify_gstlal():
@pytest.mark.parametrize(
'posterior_samples,embright',
[[[(1.2, 1.0, 0.0, 0.0, 100.0),
(2.0, 0.5, 0.99, 0.99, 150.0)],
[[[(1.2, 1.0, 0.0, 0.0, 100.0, 0.0, 0.0),
(2.0, 0.5, 0.99, 0.99, 150.0, 0.0, 0.0)],
{'HasNS': 1.0, 'HasRemnant': 1.0}],
[[(20., 12.0, 0.0, 0.0, 200.0),
(22.0, 11.5, 0.80, 0.00, 250.0),
(21.0, 10.0, 0.0, 0.0, 250)],
[[(20., 12.0, 0.0, 0.0, 200.0, 0.0, 0.0),
(22.0, 11.5, 0.80, 0.00, 250.0, 0.0, 0.0),
(21.0, 10.0, 0.0, 0.0, 250, 0.0, 0.0)],
{'HasNS': 0.0, 'HasRemnant': 0.0}]])
def test_posterior_samples(posterior_samples, embright):
with NamedTemporaryFile() as f:
......@@ -53,7 +53,9 @@ def test_posterior_samples(posterior_samples, embright):
data = np.array(
posterior_samples,
dtype=[('mc', '<f8'), ('q', '<f8'),
('a1', '<f8'), ('a2', '<f8'), ('dist', '<f8')])
('a1', '<f8'), ('a2', '<f8'),
('dist', '<f8'), ('tilt1', '<f8'),
('tilt2', '<f8')])
tmp_h5.create_dataset(
'lalinference/lalinference_mcmc/posterior_samples',
data=data)
......
......@@ -3,6 +3,9 @@ from importlib import resources
import json
import pickle
from astropy.utils.data import get_readable_fileobj
__all__ = ('read_json', 'read_pickle')
......@@ -13,6 +16,6 @@ def read_json(*args, **kwargs):
def read_pickle(*args, **kwargs):
"""Load a JSON file from package data."""
with resources.open_binary(*args, **kwargs) as f:
"""Load a pickle file using astropy.utils.data."""
with get_readable_fileobj(*args, **kwargs) as f:
return pickle.load(f)
This diff is collapsed.
......@@ -67,11 +67,12 @@ ligo-followup-advocate = ">=1.1.6"
ligo-gracedb = ">=2.7.5" # https://git.ligo.org/lscsoft/gracedb-client/-/issues/28
ligo-raven = ">=2.0"
ligo-segments = "*"
"ligo.em-bright" = ">=0.1.5"
"ligo.skymap" = ">=0.4.0"
lscsoft-glue = "*"
lxml = "*"
numpy = "*"
p_astro = ">=0.8.1"
p-astro = { version = "1.0.0dev1", allow-prereleases = true }
pesummary = "<0.13" # https://git.ligo.org/lscsoft/pesummary/-/issues/269. FIXME: remove this requirement entirely once resolved.
pygcn = ">=1.0.1"
python-ligo-lw = "~1.7.0" # https://git.ligo.org/lscsoft/ligo.skymap/-/merge_requests/255
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment