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 (44)
Showing
with 193 additions and 107 deletions
[run]
omit =
test/example_test.py
test/gw_example_test.py
test/noise_realisation_test.py
test/other_test.py
test/core/example_test.py
test/gw/example_test.py
test/gw/noise_realisation_test.py
test/gw/other_test.py
......@@ -91,8 +91,8 @@ python-3.7-samplers:
script:
- python -m pip install .
- pytest test/sampler_test.py --durations 10
- pytest test/sample_from_the_prior_test.py
- pytest test/core/sampler/sampler_run_test.py --durations 10
- pytest test/gw/sample_from_the_prior_test.py
# test samplers on python 3.6
python-3.6-samplers:
......@@ -101,7 +101,7 @@ python-3.6-samplers:
script:
- python -m pip install .
- pytest test/sampler_test.py
- pytest test/core/sampler/sampler_run_test.py
# Tests run at a fixed schedule rather than on push
scheduled-python-3.7:
......@@ -113,9 +113,9 @@ scheduled-python-3.7:
- python -m pip install .
# Run tests which are only done on schedule
- pytest test/example_test.py
- pytest test/gw_example_test.py
- pytest test/sample_from_the_prior_test.py
- pytest test/core/example_test.py
- pytest test/gw/example_test.py
- pytest test/gw/sample_from_the_prior_test.py
plotting:
stage: test
......@@ -126,7 +126,7 @@ plotting:
- python -m pip install .
- python -m pip install ligo.skymap
- pytest test/gw_plot_test.py
- pytest test/gw/plot_test.py
pages:
stage: deploy
......
# All notable changes will be documented in this file
## [1.0.1] 2020-08-29
Version 1.0.1 release of bilby
### Added
- Added an rcparams configuration for plotting (!832)
- Added `chi_1` and `chi_2` parameters to default latex label dictionary (!841)
- Allow output merged result file to be gzip or saved as a HDF5 file (!802)
### Changes
- Fixed first value in EOS cumulative integral(!860)
- Fixed saving the number of likelihood evaluations (!848)
- Likelihood condition is now strictly increasing (!846)
- Fixed a minor issue with conditional priors that could cause unexpected behaviour in edge cases (!838)
- Fixed `__repr__` method in the `FromFile` prior (!836)
- Fixed an issue that caused problems for some users when plotting with a latex backend (!816)
- Fixed bug that occured when min/max of interpolated priors was changed (!815)
- Fixed time domain waveform epoch (!736)
- Fixed time keeping in multinest (!830)
- Now checks if marginalised priors were defined before marginalising (!829)
- Fixed an issue with multivariate Gaussian prior (!822)
- Various minor code improvements (!836)(!839)
- Various minor bug fixes and improvements to the documentation (!820)(!823)(!837)
- Various testing improvements (!833)(!847)(!855)(!852)
## [1.0.0] 2020-07-06
Version 1.0 release of bilby
......
......@@ -4,7 +4,7 @@ Bilby
Bilby: a user-friendly Bayesian inference library.
The aim of bilby is to provide user friendly interface to perform parameter
The aim of bilby is to provide a user-friendly interface to perform parameter
estimation. It is primarily designed and built for inference of compact
binary coalescence events in interferometric data, but it can also be used for
more general problems.
......
......@@ -129,7 +129,7 @@ def conditional_prior_factory(prior_class):
"""
if sorted(list(required_variables)) == sorted(self.required_variables):
parameters = self.condition_func(self.reference_params, **required_variables)
parameters = self.condition_func(self.reference_params.copy(), **required_variables)
for key, value in parameters.items():
setattr(self, key, value)
elif len(required_variables) == 0:
......
......@@ -16,7 +16,7 @@ from bilby.core.utils import logger, check_directory_exists_and_if_not_mkdir, Bi
class PriorDict(dict):
def __init__(self, dictionary=None, filename=None,
conversion_function=None):
""" A set of priors
""" A dictionary of priors
Parameters
----------
......
......@@ -44,6 +44,8 @@ class Interped(Prior):
"""
self.xx = xx
self.min_limit = min(xx)
self.max_limit = max(xx)
self._yy = yy
self.YY = None
self.probability_density = None
......@@ -97,6 +99,8 @@ class Interped(Prior):
Updates the prior distribution if minimum is set to a different value.
Yields an error if value is set below instantiated x-array minimum.
Returns
-------
float: Minimum of the prior distribution
......@@ -106,6 +110,8 @@ class Interped(Prior):
@minimum.setter
def minimum(self, minimum):
if minimum < self.min_limit:
raise ValueError('Minimum cannot be set below {}.'.format(round(self.min_limit, 2)))
self._minimum = minimum
if '_maximum' in self.__dict__ and self._maximum < np.inf:
self._update_instance()
......@@ -116,6 +122,8 @@ class Interped(Prior):
Updates the prior distribution if maximum is set to a different value.
Yields an error if value is set above instantiated x-array maximum.
Returns
-------
float: Maximum of the prior distribution
......@@ -125,6 +133,8 @@ class Interped(Prior):
@maximum.setter
def maximum(self, maximum):
if maximum > self.max_limit:
raise ValueError('Maximum cannot be set above {}.'.format(round(self.max_limit, 2)))
self._maximum = maximum
if '_minimum' in self.__dict__ and self._minimum < np.inf:
self._update_instance()
......@@ -190,12 +200,12 @@ class FromFile(Interped):
"""
try:
self.id = file_name
xx, yy = np.genfromtxt(self.id).T
self.file_name = file_name
xx, yy = np.genfromtxt(self.file_name).T
super(FromFile, self).__init__(xx=xx, yy=yy, minimum=minimum,
maximum=maximum, name=name, latex_label=latex_label,
unit=unit, boundary=boundary)
except IOError:
logger.warning("Can't load {}.".format(self.id))
logger.warning("Can't load {}.".format(self.file_name))
logger.warning("Format should be:")
logger.warning(r"x\tp(x)")
......@@ -570,7 +570,15 @@ class MultivariateGaussianDist(BaseJointPriorDist):
if self.nmodes == 1:
mode = 0
else:
mode = np.argwhere(self.cumweights - np.random.rand() > 0)[0][0]
if size == 1:
mode = np.argwhere(self.cumweights - np.random.rand() > 0)[0][0]
else:
# pick modes
mode = [
np.argwhere(self.cumweights - r > 0)[0][0]
for r in np.random.rand(size)
]
samps = np.zeros((size, len(self)))
for i in range(size):
inbound = False
......@@ -578,7 +586,10 @@ class MultivariateGaussianDist(BaseJointPriorDist):
# sample the multivariate Gaussian keys
vals = np.random.uniform(0, 1, len(self))
samp = np.atleast_1d(self.rescale(vals, mode=mode))
if isinstance(mode, list):
samp = np.atleast_1d(self.rescale(vals, mode=mode[i]))
else:
samp = np.atleast_1d(self.rescale(vals, mode=mode))
samps[i, :] = samp
# check sample is in bounds (otherwise perform another draw)
......
......@@ -574,9 +574,10 @@ class Result(object):
'injection_parameters', 'meta_data', 'search_parameter_keys',
'fixed_parameter_keys', 'constraint_parameter_keys',
'sampling_time', 'sampler_kwargs', 'use_ratio',
'log_likelihood_evaluations', 'log_prior_evaluations', 'samples',
'nested_samples', 'walkers', 'nburn', 'parameter_labels',
'parameter_labels_with_unit', 'version']
'log_likelihood_evaluations', 'log_prior_evaluations',
'num_likelihood_evaluations', 'samples', 'nested_samples',
'walkers', 'nburn', 'parameter_labels', 'parameter_labels_with_unit',
'version']
dictionary = OrderedDict()
for attr in save_attrs:
try:
......
......@@ -756,7 +756,7 @@ def sample_rwalk_bilby(args):
# Check proposed point.
v_prop = prior_transform(np.array(u_prop))
logl_prop = loglikelihood(np.array(v_prop))
if logl_prop >= loglstar:
if logl_prop > loglstar:
u = u_prop
v = v_prop
logl = logl_prop
......
......@@ -13,7 +13,7 @@ import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from ..utils import logger
from ..utils import logger, check_directory_exists_and_if_not_mkdir
from .base_sampler import SamplerError, MCMCSampler
......@@ -517,6 +517,7 @@ class Ptemcee(MCMCSampler):
sys.exit(self.exit_code)
def write_current_state(self, plot=True):
check_directory_exists_and_if_not_mkdir(self.outdir)
checkpoint(
self.iteration,
self.outdir,
......
......@@ -271,6 +271,7 @@ class Pymultinest(NestedSampler):
current_time = time.time()
new_sampling_time = current_time - self.start_time
self.total_sampling_time += new_sampling_time
self.start_time = current_time
with open(self.time_file_path, 'w') as time_file:
time_file.write(str(self.total_sampling_time))
......
......@@ -6,7 +6,6 @@ import os
import shutil
from math import fmod
import argparse
import traceback
import inspect
import functools
import types
......@@ -16,11 +15,11 @@ from importlib import import_module
import json
import warnings
from distutils.version import StrictVersion
import numpy as np
from scipy.interpolate import interp2d
from scipy.special import logsumexp
import pandas as pd
import matplotlib.pyplot as plt
logger = logging.getLogger('bilby')
......@@ -972,28 +971,6 @@ command_line_args, command_line_parser = set_up_command_line_arguments()
# Instantiate the default logging
setup_logger(print_version=False, log_level=command_line_args.log_level)
if 'DISPLAY' in os.environ:
logger.debug("DISPLAY={} environment found".format(os.environ['DISPLAY']))
pass
else:
logger.debug('No $DISPLAY environment variable found, so importing \
matplotlib.pyplot with non-interactive "Agg" backend.')
import matplotlib
import matplotlib.pyplot as plt
non_gui_backends = matplotlib.rcsetup.non_interactive_bk
for backend in non_gui_backends:
try:
logger.debug("Trying backend {}".format(backend))
if StrictVersion(matplotlib.__version__) >= StrictVersion("3.1"):
matplotlib.use(backend)
else:
matplotlib.use(backend, warn=False)
plt.switch_backend(backend)
break
except Exception:
print(traceback.format_exc())
class BilbyJsonEncoder(json.JSONEncoder):
......@@ -1184,27 +1161,67 @@ def safe_file_dump(data, filename, module):
def latex_plot_format(func):
"""
Wrap a plotting function to set rcParams so that text renders nicely with
latex and Computer Modern Roman font.
Wrap the plotting function to set rcParams dependent on environment variables
The rcparams can be set directly from the env. variable `BILBY_STYLE` to
point to a matplotlib style file. Or, if `BILBY_STYLE=default` (any case) a
default setup is used, this is enabled by default. To not use any rcParams,
set `BILBY_STYLE=none`. Occasionally, issues arrise with the latex
`mathdefault` command. A fix is to define this command in the rcParams. An
env. variable `BILBY_MATHDEFAULT` can be used to turn this fix on/off.
Setting `BILBY_MATHDEFAULT=1` will enable the fix, all other choices
(including undefined) will disable it. Additionally, the BILBY_STYLE and
BILBY_MATHDEFAULT arguments can be passed into any
latex_plot_format-wrapped plotting function and will be set directly.
"""
@functools.wraps(func)
def wrapper_decorator(*args, **kwargs):
from matplotlib import rcParams
_old_tex = rcParams["text.usetex"]
_old_serif = rcParams["font.serif"]
_old_family = rcParams["font.family"]
if find_executable("latex"):
rcParams["text.usetex"] = True
if "BILBY_STYLE" in kwargs:
bilby_style = kwargs.pop("BILBY_STYLE")
else:
bilby_style = os.environ.get("BILBY_STYLE", "default")
if "BILBY_MATHDEFAULT" in kwargs:
bilby_mathdefault = kwargs.pop("BILBY_MATHDEFAULT")
else:
bilby_mathdefault = int(os.environ.get("BILBY_MATHDEFAULT", "0"))
if bilby_mathdefault == 1:
logger.debug("Setting mathdefault in the rcParams")
rcParams['text.latex.preamble'] = r'\newcommand{\mathdefault}[1][]{}'
logger.debug("Using BILBY_STYLE={}".format(bilby_style))
if bilby_style.lower() == "none":
return func(*args, **kwargs)
elif os.path.isfile(bilby_style):
plt.style.use(bilby_style)
return func(*args, **kwargs)
elif bilby_style in plt.style.available:
plt.style.use(bilby_style)
return func(*args, **kwargs)
elif bilby_style.lower() == "default":
_old_tex = rcParams["text.usetex"]
_old_serif = rcParams["font.serif"]
_old_family = rcParams["font.family"]
if find_executable("latex"):
rcParams["text.usetex"] = True
else:
rcParams["text.usetex"] = False
rcParams["font.serif"] = "Computer Modern Roman"
rcParams["font.family"] = "serif"
rcParams["text.usetex"] = _old_tex
rcParams["font.serif"] = _old_serif
rcParams["font.family"] = _old_family
return func(*args, **kwargs)
else:
rcParams["text.usetex"] = False
rcParams["font.serif"] = "Computer Modern Roman"
rcParams["font.family"] = "serif"
value = func(*args, **kwargs)
rcParams["text.usetex"] = _old_tex
rcParams["font.serif"] = _old_serif
rcParams["font.family"] = _old_family
return value
logger.debug(
"Environment variable BILBY_STYLE={} not used"
.format(bilby_style)
)
return func(*args, **kwargs)
return wrapper_decorator
......
......@@ -1116,13 +1116,14 @@ def compute_snrs(sample, likelihood):
if isinstance(sample, dict):
signal_polarizations =\
likelihood.waveform_generator.frequency_domain_strain(sample)
likelihood.parameters.update(sample)
for ifo in likelihood.interferometers:
signal = ifo.get_detector_response(signal_polarizations, sample)
per_detector_snr = likelihood.calculate_snrs(
signal_polarizations, ifo)
sample['{}_matched_filter_snr'.format(ifo.name)] =\
ifo.matched_filter_snr(signal=signal)
per_detector_snr.complex_matched_filter_snr
sample['{}_optimal_snr'.format(ifo.name)] = \
ifo.optimal_snr_squared(signal=signal) ** 0.5
per_detector_snr.optimal_snr_squared.real ** 0.5
else:
logger.info(
'Computing SNRs for every sample.')
......
......@@ -408,6 +408,7 @@ class InterferometerStrainData(object):
self.time_array = array
elif domain == 'frequency':
self.frequency_array = array
self.start_time = start_time
return
elif sampling_frequency is None or duration is None:
raise ValueError(
......
......@@ -76,33 +76,18 @@ class TabularEOS(object):
self.pressure = table[:, 0]
self.energy_density = table[:, 1]
# Store minimum pressure and energy density
self.minimum_pressure = min(self.pressure)
self.minimum_energy_density = min(self.energy_density)
if (not self.check_monotonicity() and self.sampling_flag) or self.warning_flag:
# Not a monotonic or causal EOS, exiting.
self.warning_flag = True
else:
# plot analytic enthalpy
# interpolate *in log*
integrand = self.pressure / (self.energy_density + self.pressure)
self.pseudo_enthalpy = cumtrapz(integrand, np.log(self.pressure), initial=0) + integrand[0]
self.interp_energy_density_from_pressure = CubicSpline(np.log10(self.pressure),
np.log10(self.energy_density),
)
self.pseudo_enthalpy = np.zeros(self.pressure.shape[0])
# construct arrays to do cumulative integral
dhdp = 1. / (self.energy_density + self.pressure)
num_int_arg = np.exp(np.log(self.pressure) + np.log(dhdp))
pseudo_enthalpy_0 = self.pressure[0] / (self.energy_density[0] + self.pressure[0])
self.pseudo_enthalpy = cumtrapz(num_int_arg, np.log(self.pressure), initial=pseudo_enthalpy_0)
# interpolate entropy related quantities *in log*
self.interp_energy_density_from_pseudo_enthalpy = CubicSpline(np.log10(self.pseudo_enthalpy),
np.log10(self.energy_density))
......@@ -112,13 +97,10 @@ class TabularEOS(object):
self.interp_pseudo_enthalpy_from_energy_density = CubicSpline(np.log10(self.energy_density),
np.log10(self.pseudo_enthalpy))
# Create tables
self.__construct_all_tables()
# Store minimum enthalpy
self.minimum_pseudo_enthalpy = min(self.pseudo_enthalpy)
if not self.check_causality() and self.sampling_flag:
# Finally, ensure the EOS is causal if sampling
self.warning_flag = True
def __remove_leading_zero(self, table):
......
......@@ -137,7 +137,7 @@ class GravitationalWaveTransient(Likelihood):
self.reference_ifo = None
if self.time_marginalization:
self._check_prior_is_set(key='geocent_time')
self._check_marginalized_prior_is_set(key='geocent_time')
self._setup_time_marginalization()
priors['geocent_time'] = float(self.interferometers.start_time)
if self.jitter_time:
......@@ -152,7 +152,7 @@ class GravitationalWaveTransient(Likelihood):
self.jitter_time = False
if self.phase_marginalization:
self._check_prior_is_set(key='phase')
self._check_marginalized_prior_is_set(key='phase')
self._bessel_function_interped = None
self._setup_phase_marginalization()
priors['phase'] = float(0)
......@@ -160,7 +160,7 @@ class GravitationalWaveTransient(Likelihood):
if self.distance_marginalization:
self._lookup_table_filename = None
self._check_prior_is_set(key='luminosity_distance')
self._check_marginalized_prior_is_set(key='luminosity_distance')
self._distance_array = np.linspace(
self.priors['luminosity_distance'].minimum,
self.priors['luminosity_distance'].maximum, int(1e4))
......@@ -234,7 +234,11 @@ class GravitationalWaveTransient(Likelihood):
complex_matched_filter_snr=complex_matched_filter_snr,
d_inner_h_squared_tc_array=d_inner_h_squared_tc_array)
def _check_prior_is_set(self, key):
def _check_marginalized_prior_is_set(self, key):
if key in self.priors and self.priors[key].is_fixed:
raise ValueError(
"Cannot use marginalized likelihood for {}: prior is fixed"
.format(key))
if key not in self.priors or not isinstance(
self.priors[key], Prior):
logger.warning(
......@@ -784,10 +788,24 @@ class GravitationalWaveTransient(Likelihood):
@property
def lal_version(self):
try:
from lal import git_version
lal_version = str(git_version.verbose_msg).replace("\n", ";")
logger.info("Using LAL version {}".format(lal_version))
return lal_version
from lal import git_version, __version__
lal_version = str(__version__)
logger.info("Using lal version {}".format(lal_version))
lal_git_version = str(git_version.verbose_msg).replace("\n", ";")
logger.info("Using lal git version {}".format(lal_git_version))
return "lal_version={}, lal_git_version={}".format(lal_version, lal_git_version)
except (ImportError, AttributeError):
return "N/A"
@property
def lalsimulation_version(self):
try:
from lalsimulation import git_version, __version__
lalsim_version = str(__version__)
logger.info("Using lalsimulation version {}".format(lalsim_version))
lalsim_git_version = str(git_version.verbose_msg).replace("\n", ";")
logger.info("Using lalsimulation git version {}".format(lalsim_git_version))
return "lalsimulation_version={}, lalsimulation_git_version={}".format(lalsim_version, lalsim_git_version)
except (ImportError, AttributeError):
return "N/A"
......@@ -807,7 +825,8 @@ class GravitationalWaveTransient(Likelihood):
start_time=self.waveform_generator.start_time,
time_reference=self.time_reference,
reference_frame=self._reference_frame_str,
lal_version=self.lal_version)
lal_version=self.lal_version,
lalsimulation_version=self.lalsimulation_version)
class BasicGravitationalWaveTransient(Likelihood):
......
......@@ -139,7 +139,10 @@ class Cosmological(Interped):
@minimum.setter
def minimum(self, minimum):
self._set_limit(value=minimum, limit_dict=self._minimum)
if (self.name in self._minimum) and (minimum < self.minimum):
self._set_limit(value=minimum, limit_dict=self._minimum, recalculate_array=True)
else:
self._set_limit(value=minimum, limit_dict=self._minimum)
@property
def maximum(self):
......@@ -147,11 +150,14 @@ class Cosmological(Interped):
@maximum.setter
def maximum(self, maximum):
self._set_limit(value=maximum, limit_dict=self._maximum)
if (self.name in self._maximum) and (maximum > self.maximum):
self._set_limit(value=maximum, limit_dict=self._maximum, recalculate_array=True)
else:
self._set_limit(value=maximum, limit_dict=self._maximum)
def _set_limit(self, value, limit_dict):
def _set_limit(self, value, limit_dict, recalculate_array=False):
"""
Set either the limits for redshift luminosity and comoving distances
Set either of the limits for redshift, luminosity, and comoving distances
Parameters
----------
......@@ -159,6 +165,8 @@ class Cosmological(Interped):
Limit value in current class' parameter
limit_dict: dict
The limit dictionary to modify in place
recalculate_array: boolean
Determines if the distance arrays are recalculated
"""
cosmology = get_cosmology(self.cosmology)
limit_dict[self.name] = value
......@@ -185,6 +193,13 @@ class Cosmological(Interped):
limit_dict['luminosity_distance'] = (
cosmology.luminosity_distance(limit_dict['redshift']).value
)
if recalculate_array:
if self.name == 'redshift':
self.xx, self.yy = self._get_redshift_arrays()
elif self.name == 'comoving_distance':
self.xx, self.yy = self._get_comoving_distance_arrays()
elif self.name == 'luminosity_distance':
self.xx, self.yy = self._get_luminosity_distance_arrays()
try:
self._update_instance()
except (AttributeError, KeyError):
......@@ -615,7 +630,9 @@ Prior._default_latex_labels = {
'lambda_1': '$\\Lambda_1$',
'lambda_2': '$\\Lambda_2$',
'lambda_tilde': '$\\tilde{\\Lambda}$',
'delta_lambda_tilde': '$\\delta\\tilde{\\Lambda}$'}
'delta_lambda_tilde': '$\\delta\\tilde{\\Lambda}$',
'chi_1': '$\\chi_1$',
'chi_2': '$\\chi_2$'}
class CalibrationPriorDict(PriorDict):
......
......@@ -38,10 +38,10 @@ pytest-cov \
coverage-badge
# Install additional bilby requirements
RUN pip install corner lalsuite astropy gwpy theano
RUN pip install corner lalsuite astropy gwpy theano tables
# Install samplers
RUN pip install cpnest dynesty emcee nestle ptemcee pymc3 pymultinest kombine ultranest
RUN pip install cpnest dynesty emcee nestle ptemcee pymc3 pymultinest kombine ultranest dnest4
# Install pymultinest requirements
RUN apt-get install -y libblas3 libblas-dev liblapack3 liblapack-dev \
......@@ -55,7 +55,7 @@ ENV LD_LIBRARY_PATH $HOME/MultiNest/MultiNest_v3.11_CMake/multinest/lib:
# Install Polychord
RUN git clone https://github.com/PolyChord/PolyChordLite.git \
&& (cd PolyChordLite && make pypolychord MPI= && python setup.py install)
&& (cd PolyChordLite && python setup.py --no-mpi install)
# Install PTMCMCSampler
RUN git clone https://github.com/jellis18/PTMCMCSampler.git \
......
......@@ -45,10 +45,10 @@ coverage-badge
RUN pip install sphinx numpydoc nbsphinx sphinx_rtd_theme sphinx-tabs
# Install additional bilby requirements
RUN pip install corner lalsuite astropy gwpy theano healpy
RUN pip install corner lalsuite astropy gwpy theano healpy tables
# Install samplers
RUN pip install cpnest dynesty emcee nestle ptemcee pymc3 pymultinest kombine ultranest
RUN pip install cpnest dynesty emcee nestle ptemcee pymc3 pymultinest kombine ultranest dnest4
# Install pymultinest requirements
RUN apt-get install -y libblas3 libblas-dev liblapack3 liblapack-dev \
......@@ -62,7 +62,7 @@ ENV LD_LIBRARY_PATH $HOME/MultiNest/MultiNest_v3.11_CMake/multinest/lib:
# Install Polychord
RUN git clone https://github.com/PolyChord/PolyChordLite.git \
&& (cd PolyChordLite && make pypolychord MPI= && python setup.py install)
&& (cd PolyChordLite && python setup.py --no-mpi install)
# Install PTMCMCSampler
RUN git clone https://github.com/jellis18/PTMCMCSampler.git \
......