diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e477d9239529a5f67ab572c1a364db3cf98245e..2c54aa3715046ad03c2e4c0d6ac2243734e857e1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/AUTHORS.md b/AUTHORS.md index 710bcd4df4769f3516efa2bbd79a1180b661f62b..cc1546904d91bc1a6b6d3c13a72cdc0358f7e66f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -72,6 +72,7 @@ Roberto Cotesta Rory Smith S. H. Oh Sacha Husa +Samson Leong Scott Coughlin Serguei Ossokine Shanika Galaudage diff --git a/bilby/gw/utils.py b/bilby/gw/utils.py index f50b02d98a16df57a70477b1ff44940ecd865045..c581a6c71b5f992c70f811483f5df3b273b16ab9 100644 --- a/bilby/gw/utils.py +++ b/bilby/gw/utils.py @@ -423,7 +423,8 @@ def read_frame_file(file_name, start_time, end_time, resample=None, channel=None if loaded: if resample and (strain.sample_rate.value != resample): - return strain.resample(resample) + strain = strain.resample(resample) + return strain else: logger.warning('No data loaded.') return None diff --git a/containers/dockerfile-template b/containers/dockerfile-template index 4c52c15c849aa0276094b98e3841154d7b897347..b2c8ebb8ba8ac08d809a2dbed5aec16d91238cbd 100644 --- a/containers/dockerfile-template +++ b/containers/dockerfile-template @@ -1,37 +1,18 @@ 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 \ diff --git a/containers/env-template.yml b/containers/env-template.yml new file mode 100644 index 0000000000000000000000000000000000000000..a862751a5880b26d8d45e5ee1a98093efe2a4f2b --- /dev/null +++ b/containers/env-template.yml @@ -0,0 +1,61 @@ +# 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 diff --git a/containers/v3-dockerfile-test-suite-python310 b/containers/v3-dockerfile-test-suite-python310 index c6af1c7410153c9f370954b7b702ded473b13431..d9bf93c58c74ec878c4f968d2a71834b3824ff84 100644 --- a/containers/v3-dockerfile-test-suite-python310 +++ b/containers/v3-dockerfile-test-suite-python310 @@ -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 \ diff --git a/containers/v3-dockerfile-test-suite-python39 b/containers/v3-dockerfile-test-suite-python39 index 1cff66c50a1067d200efcad3c3cb433d3f173b20..1d971fea8bdf3b0fff8e5136ab56d9279e60b41e 100644 --- a/containers/v3-dockerfile-test-suite-python39 +++ b/containers/v3-dockerfile-test-suite-python39 @@ -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 \ diff --git a/containers/write_dockerfiles.py b/containers/write_dockerfiles.py index 60dbf751f080e546ddab7dd63941e4f07b199526..3c3c5487bd22301f622b8d579a17a40c277dfeb8 100644 --- a/containers/write_dockerfiles.py +++ b/containers/write_dockerfiles.py @@ -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) )) diff --git a/test/gw/conversion_test.py b/test/gw/conversion_test.py index f484019c194c6c9c9f9e1f3a1196f2f1bc2a2f2e..aef17c822e741306146004725f6f827e551c6ea6 100644 --- a/test/gw/conversion_test.py +++ b/test/gw/conversion_test.py @@ -864,8 +864,8 @@ class TestEquationOfStateConversions(unittest.TestCase): self.mass_2_source_polytrope[i], 0 ) - self.assertAlmostEqual(self.lambda_1_polytrope[i], lambda_1, places=3) - self.assertAlmostEqual(self.lambda_2_polytrope[i], lambda_2, places=3) + self.assertAlmostEqual(self.lambda_1_polytrope[i], lambda_1, places=2) + self.assertAlmostEqual(self.lambda_2_polytrope[i], lambda_2, places=1) self.assertAlmostEqual(self.eos_check_polytrope[i], eos_check)