Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • john-veitch/bilby
  • duncanmmacleod/bilby
  • colm.talbot/bilby
  • lscsoft/bilby
  • matthew-pitkin/bilby
  • salvatore-vitale/tupak
  • charlie.hoy/bilby
  • bfarr/bilby
  • virginia.demilio/bilby
  • vivien/bilby
  • eric-howell/bilby
  • sebastian-khan/bilby
  • rhys.green/bilby
  • moritz.huebner/bilby
  • joseph.mills/bilby
  • scott.coughlin/bilby
  • matthew.carney/bilby
  • hyungwon.lee/bilby
  • monica.rizzo/bilby
  • christopher-berry/bilby
  • lindsay.demarchi/bilby
  • kaushik.rao/bilby
  • charles.kimball/bilby
  • andrew.matas/bilby
  • juan.calderonbustillo/bilby
  • patrick-meyers/bilby
  • hannah.middleton/bilby
  • eve.chase/bilby
  • grant.meadors/bilby
  • khun.phukon/bilby
  • sumeet.kulkarni/bilby
  • daniel.reardon/bilby
  • cjhaster/bilby
  • sylvia.biscoveanu/bilby
  • james-clark/bilby
  • meg.millhouse/bilby
  • joshua.willis/bilby
  • nikhil.sarin/bilby
  • paul.easter/bilby
  • youngmin/bilby
  • daniel-williams/bilby
  • shanika.galaudage/bilby
  • bruce.edelman/bilby
  • avi.vajpeyi/bilby
  • isobel.romero-shaw/bilby
  • andrew.kim/bilby
  • dominika.zieba/bilby
  • jonathan.davies/bilby
  • marc.arene/bilby
  • srishti.tiwari/bilby-tidal-heating-eccentric
  • aditya.vijaykumar/bilby
  • michael.williams/bilby
  • cecilio.garcia-quiros/bilby
  • rory-smith/bilby
  • maite.mateu-lucena/bilby
  • wushichao/bilby
  • kaylee.desoto/bilby
  • brandon.piotrzkowski/bilby
  • rossella.gamba/bilby
  • hunter.gabbard/bilby
  • deep.chatterjee/bilby
  • tathagata.ghosh/bilby
  • arunava.mukherjee/bilby
  • philip.relton/bilby
  • reed.essick/bilby
  • pawan.gupta/bilby
  • francisco.hernandez/bilby
  • rhiannon.udall/bilby
  • leo.tsukada/bilby
  • will-farr/bilby
  • vijay.varma/bilby
  • jeremy.baier/bilby
  • joshua.brandt/bilby
  • ethan.payne/bilby
  • ka-lok.lo/bilby
  • antoni.ramos-buades/bilby
  • oliviastephany.wilk/bilby
  • jack.heinzel/bilby
  • samson.leong/bilby-psi4
  • viviana.caceres/bilby
  • nadia.qutob/bilby
  • michael-coughlin/bilby
  • hemantakumar.phurailatpam/bilby
  • boris.goncharov/bilby
  • sama.al-shammari/bilby
  • siqi.zhong/bilby
  • jocelyn-read/bilby
  • marc.penuliar/bilby
  • stephanie.letourneau/bilby
  • alexandresebastien.goettel/bilby
  • alec.gunny/bilby
  • serguei.ossokine/bilby
  • pratyusava.baral/bilby
  • sophie.hourihane/bilby
  • eunsub/bilby
  • james.hart/bilby
  • pratyusava.baral/bilby-tg
  • zhaozc/bilby
  • pratyusava.baral/bilby_SoG
  • tomasz.baka/bilby
  • nicogerardo.bers/bilby
  • soumen.roy/bilby
  • isaac.mcmahon/healpix-redundancy
  • asamakai.baker/bilby-frequency-dependent-antenna-pattern-functions
  • anna.puecher/bilby
  • pratyusava.baral/bilby-x-g
  • thibeau.wouters/bilby
  • christian.adamcewicz/bilby
  • raffi.enficiaud/bilby
109 results
Show changes
Commits on Source (13)
Showing
with 184 additions and 109 deletions
......@@ -258,7 +258,8 @@ pages:
script:
- cd containers
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --tag v3-bilby-$PYVERSION - < v3-dockerfile-test-suite-$PYVERSION
- cp v3-dockerfile-test-suite-$PYVERSION Dockerfile
- docker build --tag v3-bilby-$PYVERSION .
- docker image tag v3-bilby-$PYVERSION containers.ligo.org/lscsoft/bilby/v2-bilby-$PYVERSION:latest
- docker image push containers.ligo.org/lscsoft/bilby/v2-bilby-$PYVERSION:latest
......
......@@ -43,6 +43,7 @@ Kaylee de Soto
Khun Sang Phukon
Kruthi Krishna
Kshipraa Athar
Kyle Wong
Leslie Wade
Liting Xiao
Maite Mateu-Lucena
......@@ -71,6 +72,7 @@ Roberto Cotesta
Rory Smith
S. H. Oh
Sacha Husa
Samson Leong
Scott Coughlin
Serguei Ossokine
Shanika Galaudage
......@@ -82,6 +84,7 @@ Stephen R Green
Sumeet Kulkarni
Sylvia Biscoveanu
Tathagata Ghosh
Teagan Clarke
Tomasz Baka
Will M. Farr
Virginia d'Emilio
......
# All notable changes will be documented in this file
## [2.2.1] 2023-1111
Version 2.2.1 release of Bilby
This release is a bugfix release.
### Changes
- Ensure inteferometer metadata is not empty (!1281)
- Make interrupted pools exit more quickly (!1284)
- Fix conditional sampling with DeltaFunction conditions (!1289)
- The triangular prior raised an error with numpy (!1294)
- Make sure strain data resampling works (!1295)
- Dynesty logging (!1296)
- A bug with saving lists that contain None (!1301)
- Preparatory fix an upcoming change in dynesty (!1302)
## [2.2.0] 2023-07-24
Version 2.2.0 release of Bilby
......
......@@ -28,6 +28,7 @@ class DeltaFunction(Prior):
minimum=peak, maximum=peak, check_range_nonzero=False)
self.peak = peak
self._is_fixed = True
self.least_recently_sampled = peak
def rescale(self, val):
"""Rescale everything to the peak with the correct shape.
......@@ -1608,7 +1609,7 @@ class Triangular(Prior):
"""
return (
+ (val > self.mode)
(val > self.mode)
+ (val > self.minimum)
* (val <= self.maximum)
/ (self.scale)
......
......@@ -711,16 +711,22 @@ class ConditionalPriorDict(PriorDict):
def sample_subset(self, keys=iter([]), size=None):
self.convert_floats_to_delta_functions()
subset_dict = ConditionalPriorDict({key: self[key] for key in keys})
add_delta_keys = [
key
for key in self.keys()
if key not in keys and isinstance(self[key], DeltaFunction)
]
use_keys = add_delta_keys + list(keys)
subset_dict = ConditionalPriorDict({key: self[key] for key in use_keys})
if not subset_dict._resolved:
raise IllegalConditionsException(
"The current set of priors contains unresolvable conditions."
)
samples = dict()
for key in subset_dict.sorted_keys:
if isinstance(self[key], Constraint):
if key not in keys or isinstance(self[key], Constraint):
continue
elif isinstance(self[key], Prior):
if isinstance(self[key], Prior):
try:
samples[key] = subset_dict[key].sample(
size=size, **subset_dict.get_required_variables(key)
......
......@@ -727,16 +727,29 @@ class Sampler(object):
if self.npool in (1, None) or getattr(self, "pool", None) is not None:
self._log_interruption(signum=signum)
self.write_current_state()
self._close_pool()
self._close_pool(hard=True)
if self.hard_exit:
os._exit(self.exit_code)
else:
sys.exit(self.exit_code)
def _close_pool(self):
def _close_pool(self, hard=False):
"""
Close the worker pool.
Parameters
==========
hard: bool
Whether to terminate the pool or just close it. Terminating the
pool will kill all running jobs, closing it will wait for them to
finish.
"""
if getattr(self, "pool", None) is not None:
logger.info("Starting to close worker pool.")
self.pool.close()
if hard:
self.pool.terminate()
else:
self.pool.close()
self.pool.join()
self.pool = None
self.kwargs["pool"] = self.pool
......
......@@ -446,7 +446,7 @@ class Dynesty(NestedSampler):
if sample == "rwalk":
logger.info(
"Using the bilby-implemented rwalk sample method with ACT estimated walks. "
f"Using the bilby-implemented {sample} sample method with ACT estimated walks. "
f"An average of {2 * self.nact} steps will be accepted up to chain length "
f"{self.maxmcmc}."
)
......@@ -460,7 +460,7 @@ class Dynesty(NestedSampler):
dynesty.nestedsamplers._SAMPLING["rwalk"] = AcceptanceTrackingRWalk()
elif sample == "acceptance-walk":
logger.info(
"Using the bilby-implemented rwalk sampling with an average of "
f"Using the bilby-implemented {sample} sampling with an average of "
f"{self.naccept} accepted steps per MCMC and maximum length {self.maxmcmc}"
)
from .dynesty_utils import FixedRWalk
......@@ -468,7 +468,7 @@ class Dynesty(NestedSampler):
dynesty.nestedsamplers._SAMPLING["acceptance-walk"] = FixedRWalk()
elif sample == "act-walk":
logger.info(
"Using the bilby-implemented rwalk sampling tracking the "
f"Using the bilby-implemented {sample} sampling tracking the "
f"autocorrelation function and thinning by "
f"{self.nact} with maximum length {self.nact * self.maxmcmc}"
)
......
......@@ -68,7 +68,7 @@ class LivePointSampler(UnitCubeSampler):
self.kwargs["live"] = self.live_u
i = self.rstate.integers(self.nlive)
u = self.live_u[i, :]
return u, np.identity(self.npdim)
return u, np.identity(self.ncdim)
class MultiEllipsoidLivePointSampler(MultiEllipsoidSampler):
......
......@@ -283,7 +283,7 @@ def encode_for_hdf5(key, item):
output = item
elif np.issubdtype(item_array.dtype, np.number):
output = np.array(item)
elif issubclass(item_array.dtype.type, str) or item[0] is None:
elif issubclass(item_array.dtype.type, str) or None in item:
output = list()
for value in item:
if isinstance(value, str):
......
# The proposed NEMO high frequency detector
# location here set to Gingin Western Australia
# https://arxiv.org/abs/2007.03128 Figure 1
name = 'NEMO'
power_spectral_density = PowerSpectralDensity(psd_file='NEMO_psd.txt')
minimum_frequency = 10
maximum_frequency = 2048
length = 4
latitude = -31.34
longitude = 115.91
elevation = 0.0
xarm_azimuth = 2.0
yarm_azimuth = 125.0
......@@ -90,7 +90,7 @@ class Interferometer(object):
self.strain_data = InterferometerStrainData(
minimum_frequency=minimum_frequency,
maximum_frequency=maximum_frequency)
self.meta_data = dict()
self.meta_data = dict(name=name)
def __eq__(self, other):
if self.name == other.name and \
......
......@@ -423,7 +423,7 @@ def read_frame_file(file_name, start_time, end_time, resample=None, channel=None
if loaded:
if resample and (strain.sample_rate.value != resample):
strain.resample(resample)
strain = strain.resample(resample)
return strain
else:
logger.warning('No data loaded.')
......
FROM containers.ligo.org/docker/base:conda
LABEL name="bilby CI testing" \
maintainer="Gregory Ashton <gregory.ashton@ligo.org>"
RUN conda update -n base -c defaults conda
maintainer="Gregory Ashton <gregory.ashton@ligo.org>, Colm Talbot <colm.talbot@ligo.org>"
COPY env-template.yml env.yml
RUN echo " - python=={python_major_version}.{python_minor_version}" >> env.yml
ENV conda_env python{python_major_version}{python_minor_version}
RUN conda create -n ${{conda_env}} python={python_major_version}.{python_minor_version}
RUN mamba env create -f env.yml -n ${{conda_env}}
RUN echo "source activate ${{conda_env}}" > ~/.bashrc
ENV PATH /opt/conda/envs/${{conda_env}}/bin:$PATH
RUN /bin/bash -c "source activate ${{conda_env}}"
RUN conda info
RUN mamba info
RUN python --version
# Install conda-installable programs
RUN conda install -n ${{conda_env}} -y matplotlib numpy scipy pandas astropy flake8
RUN conda install -n ${{conda_env}} -c anaconda coverage configargparse future dill
RUN conda install -n ${{conda_env}} -c conda-forge black pytest-cov deepdish arviz
# Install pip-requirements
RUN pip install --upgrade pip
RUN pip install --upgrade setuptools coverage-badge parameterized
# Install documentation requirements
RUN pip install sphinx numpydoc nbsphinx sphinx_rtd_theme sphinx-tabs autodoc
# Install testing requirements
RUN conda install -n ${{conda_env}} -c conda-forge scikit-image celerite george
# Install dependencies and samplers
RUN pip install corner healpy cython tables
RUN conda install -n ${{conda_env}} {conda_samplers} -c conda-forge -c pytorch
# Install Polychord
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install -y build-essential
......@@ -43,10 +24,6 @@ RUN apt-get install -y gfortran
RUN git clone https://github.com/PolyChord/PolyChordLite.git \
&& (cd PolyChordLite && python setup.py --no-mpi install)
# Install GW packages
RUN conda install -n ${{conda_env}} -c conda-forge python-lalsimulation bilby.cython pyseobnr
RUN pip install ligo-gracedb gwpy ligo.skymap
# Add the ROQ data to the image
RUN mkdir roq_basis \
&& cd roq_basis \
......
# This is a template yaml file for the test image
# The python version should be added before creating the env
channels:
- conda-forge
- defaults
dependencies:
- pip
- setuptools
- matplotlib
- numpy
- scipy
- pandas
- astropy
- flake8
- anaconda
- coverage
- configargparse
- future
- dill
- black
- pytest-cov
- arviz
- parameterized
- scikit-image
- celerite
- george
- corner
- healpy
- cython
- pytables
- pytorch
- python-lalsimulation
- bilby.cython
- pyseobnr
- ligo-gracedb
- gwpy
- ligo.skymap
- sphinx
- numpydoc
- nbsphinx
- sphinx_rtd_theme
- sphinx-tabs
- dynesty
- emcee
- nestle
- ptemcee
- pymultinest
- ultranest
- cpnest
- kombine
- dnest4
- zeus-mcmc
- pytorch
- pymc>=5.9
- nessai
- ptmcmcsampler
- jaxlib>=0.4
- jax>=0.4
- numba>0.53.1
- pip:
- autodoc
......@@ -2,38 +2,19 @@
FROM containers.ligo.org/docker/base:conda
LABEL name="bilby CI testing" \
maintainer="Gregory Ashton <gregory.ashton@ligo.org>"
RUN conda update -n base -c defaults conda
maintainer="Gregory Ashton <gregory.ashton@ligo.org>, Colm Talbot <colm.talbot@ligo.org>"
COPY env-template.yml env.yml
RUN echo " - python==3.10" >> env.yml
ENV conda_env python310
RUN conda create -n ${conda_env} python=3.10
RUN mamba env create -f env.yml -n ${conda_env}
RUN echo "source activate ${conda_env}" > ~/.bashrc
ENV PATH /opt/conda/envs/${conda_env}/bin:$PATH
RUN /bin/bash -c "source activate ${conda_env}"
RUN conda info
RUN mamba info
RUN python --version
# Install conda-installable programs
RUN conda install -n ${conda_env} -y matplotlib numpy scipy pandas astropy flake8
RUN conda install -n ${conda_env} -c anaconda coverage configargparse future dill
RUN conda install -n ${conda_env} -c conda-forge black pytest-cov deepdish arviz
# Install pip-requirements
RUN pip install --upgrade pip
RUN pip install --upgrade setuptools coverage-badge parameterized
# Install documentation requirements
RUN pip install sphinx numpydoc nbsphinx sphinx_rtd_theme sphinx-tabs autodoc
# Install testing requirements
RUN conda install -n ${conda_env} -c conda-forge scikit-image celerite george
# Install dependencies and samplers
RUN pip install corner healpy cython tables
RUN conda install -n ${conda_env} dynesty emcee nestle ptemcee pymultinest ultranest cpnest kombine dnest4 zeus-mcmc pytorch 'pymc>=4' nessai ptmcmcsampler -c conda-forge -c pytorch
# Install Polychord
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install -y build-essential
......@@ -45,10 +26,6 @@ RUN apt-get install -y gfortran
RUN git clone https://github.com/PolyChord/PolyChordLite.git \
&& (cd PolyChordLite && python setup.py --no-mpi install)
# Install GW packages
RUN conda install -n ${conda_env} -c conda-forge python-lalsimulation bilby.cython pyseobnr
RUN pip install ligo-gracedb gwpy ligo.skymap
# Add the ROQ data to the image
RUN mkdir roq_basis \
&& cd roq_basis \
......
......@@ -2,38 +2,19 @@
FROM containers.ligo.org/docker/base:conda
LABEL name="bilby CI testing" \
maintainer="Gregory Ashton <gregory.ashton@ligo.org>"
RUN conda update -n base -c defaults conda
maintainer="Gregory Ashton <gregory.ashton@ligo.org>, Colm Talbot <colm.talbot@ligo.org>"
COPY env-template.yml env.yml
RUN echo " - python==3.9" >> env.yml
ENV conda_env python39
RUN conda create -n ${conda_env} python=3.9
RUN mamba env create -f env.yml -n ${conda_env}
RUN echo "source activate ${conda_env}" > ~/.bashrc
ENV PATH /opt/conda/envs/${conda_env}/bin:$PATH
RUN /bin/bash -c "source activate ${conda_env}"
RUN conda info
RUN mamba info
RUN python --version
# Install conda-installable programs
RUN conda install -n ${conda_env} -y matplotlib numpy scipy pandas astropy flake8
RUN conda install -n ${conda_env} -c anaconda coverage configargparse future dill
RUN conda install -n ${conda_env} -c conda-forge black pytest-cov deepdish arviz
# Install pip-requirements
RUN pip install --upgrade pip
RUN pip install --upgrade setuptools coverage-badge parameterized
# Install documentation requirements
RUN pip install sphinx numpydoc nbsphinx sphinx_rtd_theme sphinx-tabs autodoc
# Install testing requirements
RUN conda install -n ${conda_env} -c conda-forge scikit-image celerite george
# Install dependencies and samplers
RUN pip install corner healpy cython tables
RUN conda install -n ${conda_env} dynesty emcee nestle ptemcee pymultinest ultranest cpnest kombine dnest4 zeus-mcmc pytorch 'pymc>=4' nessai ptmcmcsampler -c conda-forge -c pytorch
# Install Polychord
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install -y build-essential
......@@ -45,10 +26,6 @@ RUN apt-get install -y gfortran
RUN git clone https://github.com/PolyChord/PolyChordLite.git \
&& (cd PolyChordLite && python setup.py --no-mpi install)
# Install GW packages
RUN conda install -n ${conda_env} -c conda-forge python-lalsimulation bilby.cython pyseobnr
RUN pip install ligo-gracedb gwpy ligo.skymap
# Add the ROQ data to the image
RUN mkdir roq_basis \
&& cd roq_basis \
......
......@@ -6,12 +6,6 @@ with open("dockerfile-template", "r") as ff:
python_versions = [(3, 9), (3, 10)]
today = date.today().strftime("%Y%m%d")
samplers = [
"dynesty", "emcee", "nestle", "ptemcee", "pymultinest", "ultranest",
"cpnest", "kombine", "dnest4", "zeus-mcmc",
"pytorch", "'pymc>=4'", "nessai", "ptmcmcsampler",
]
for python_major_version, python_minor_version in python_versions:
key = f"python{python_major_version}{python_minor_version}"
with open(
......@@ -26,5 +20,4 @@ for python_major_version, python_minor_version in python_versions:
date=today,
python_major_version=python_major_version,
python_minor_version=python_minor_version,
conda_samplers=" ".join(samplers)
))
......@@ -78,7 +78,7 @@ interferometers.inject_signal(
# Load the default prior for binary neutron stars.
# We're going to sample in chirp_mass, symmetric_mass_ratio, lambda_tilde, and
# delta_lambda rather than mass_1, mass_2, lambda_1, and lambda_2.
# delta_lambda_tilde rather than mass_1, mass_2, lambda_1, and lambda_2.
# BNS have aligned spins by default, if you want to allow precessing spins
# pass aligned_spin=False to the BNSPriorDict
priors = bilby.gw.prior.BNSPriorDict()
......@@ -102,8 +102,9 @@ priors["symmetric_mass_ratio"] = bilby.core.prior.Uniform(
0.1, 0.25, name="symmetric_mass_ratio"
)
priors["lambda_tilde"] = bilby.core.prior.Uniform(0, 5000, name="lambda_tilde")
priors["delta_lambda"] = bilby.core.prior.Uniform(-500, 1000, name="delta_lambda")
priors["delta_lambda_tilde"] = bilby.core.prior.Uniform(
-500, 1000, name="delta_lambda_tilde"
)
priors["lambda_1"] = bilby.core.prior.Constraint(
name="lambda_1", minimum=0, maximum=10000
)
......
......@@ -412,6 +412,38 @@ class TestConditionalPriorDict(unittest.TestCase):
res = priors.rescale(["a", "b", "d", "c"], [0.5, 0.5, 0.5, 0.5])
print(res)
def test_subset_sampling(self):
def _tp_conditional_uniform(ref_params, period):
min_ref, max_ref = ref_params["minimum"], ref_params["maximum"]
max_ref = np.minimum(max_ref, min_ref + period)
return {"minimum": min_ref, "maximum": max_ref}
p0 = 68400.0
prior = bilby.core.prior.ConditionalPriorDict(
{
"tp": bilby.core.prior.ConditionalUniform(
condition_func=_tp_conditional_uniform, minimum=0, maximum=2 * p0
)
}
)
# ---------- 0. Sanity check: sample full prior
prior["period"] = p0
samples2d = prior.sample(1000)
assert samples2d["tp"].max() < p0
# ---------- 1. Subset sampling with external delta-prior
print("Test 1: Subset-sampling conditionals for fixed 'externals':")
prior["period"] = p0
samples1d = prior.sample_subset(["tp"], 1000)
self.assertLess(samples1d["tp"].max(), p0)
# ---------- 2. Subset sampling with external uniform prior
prior["period"] = bilby.core.prior.Uniform(minimum=p0, maximum=2 * p0)
print("Test 2: Subset-sampling conditionals for 'external' uncertainties:")
with self.assertRaises(bilby.core.prior.IllegalConditionsException):
prior.sample_subset(["tp"], 1000)
class TestDirichletPrior(unittest.TestCase):
......