diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f1927381..94af22b1 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -40,12 +40,9 @@ jobs: conda-channels: anaconda, conda-forge - name: Install dependencies run: | - conda install flake8 pytest-cov - conda install --file requirements.txt - conda install pre-commit codespell - conda install jupyter conda install pip setuptools - conda update nbconvert + conda install --file requirements.txt + conda install --file test_requirements.txt pre-commit install - name: Install gwpopulation run: | @@ -57,7 +54,6 @@ jobs: run: | pre-commit run --all-files --verbose --show-diff-on-failure jupyter nbconvert --clear-output --inplace examples/*.ipynb - codespell examples/*.ipynb -L "hist" git reset --hard - name: Test with pytest run: | diff --git a/.gitignore b/.gitignore index f244ddcd..ba1c9a24 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ venv/ .idea/ **/.version **/_version.py +.vscode \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index eb9e0c41..39ba99fe 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,5 @@ include README.md include LICENSE.md include requirements.txt +include pages_requirements.txt +include test_requirements.txt diff --git a/docs/conf.py b/docs/conf.py index fdb25059..37253c42 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -74,7 +74,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/docs/index.rst b/docs/index.rst index c605daef..6d987ef9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -16,8 +16,8 @@ API: :recursive: models + backend conversions - cupy_utils hyperpe utils vt diff --git a/gwpopulation/__init__.py b/gwpopulation/__init__.py index 0e01b205..258ef3cb 100644 --- a/gwpopulation/__init__.py +++ b/gwpopulation/__init__.py @@ -19,11 +19,11 @@ from .hyperpe import RateLikelihood try: - from ._version import version as __version__ + from ._version import __version__ except ModuleNotFoundError: # development mode __version__ = "unknown" try: set_backend("cupy") -except ModuleNotFoundError: +except ImportError: set_backend("numpy") diff --git a/priors/bbh_population.prior b/priors/bbh_population.prior index ba57b5b5..f6e1c3cb 100644 --- a/priors/bbh_population.prior +++ b/priors/bbh_population.prior @@ -8,12 +8,12 @@ alpha_chi_2 = Uniform(minimum=1, maximum=5, name='alpha_2', latex_label='$\\alph beta_chi_1 = Uniform(minimum=1, maximum=5, name='beta_1', latex_label='$\\beta_1$') beta_chi_2 = Uniform(minimum=1, maximum=5, name='beta_2', latex_label='$\\beta_2$') alpha = Uniform(minimum=-4, maximum=12, name='alpha', latex_label='$\\alpha$') -mmin = Uniform(minimum=3, maximum=10, name='mmin', latex_label='$m_{\min}$') -mmax = Uniform(minimum=30, maximum=65, name='mmax', latex_label='$m_{\max}$') -lam = Uniform(minimum=0, maximum=1, name='lam', latex_label='$\lambda$') -mpp = Uniform(minimum=20, maximum=60, name='mpp', latex_label='$\mu_{pp}$') +mmin = Uniform(minimum=3, maximum=10, name='mmin', latex_label='$m_{\\min}$') +mmax = Uniform(minimum=30, maximum=65, name='mmax', latex_label='$m_{\\max}$') +lam = Uniform(minimum=0, maximum=1, name='lam', latex_label='$\\lambda$') +mpp = Uniform(minimum=20, maximum=60, name='mpp', latex_label='$\\mu_{pp}$') sigpp = Uniform(minimum=5e-1, maximum=1e1, name='sigpp', latex_label='$\\sigma_{pp}$') beta = Uniform(minimum=-4, maximum=12, name='beta', latex_label='$\\beta$') -delta_m = Uniform(minimum=0, maximum=10, name='delta_m', latex_label='$\delta m$') +delta_m = Uniform(minimum=0, maximum=10, name='delta_m', latex_label='$\\delta m$') lamb = Uniform(minimum=-5, maximum=10, name="lamb", latex_label="$\\lambda_{z}$") rate = LogUniform(minimum=1e-1, maximum=1e3, name='rate', latex_label='$R$') diff --git a/priors/mass_rates.prior b/priors/mass_rates.prior index 9da331e4..d859aa9d 100644 --- a/priors/mass_rates.prior +++ b/priors/mass_rates.prior @@ -10,8 +10,8 @@ beta_2 = 1 alpha = Uniform(minimum=-4, maximum=6, name='alpha', latex_label='$\\alpha$') mmin = Uniform(minimum=2, maximum=10, name='mmin', latex_label='$m_{\\min}$') mmax = Uniform(minimum=20, maximum=65, name='mmax', latex_label='$m_{\\max}$') -lam = Uniform(minimum=0, maximum=1, name='lam', latex_label='$\lambda$') -mpp = Uniform(minimum=20, maximum=60, name='mpp', latex_label='$\mu_{pp}$') +lam = Uniform(minimum=0, maximum=1, name='lam', latex_label='$\\lambda$') +mpp = Uniform(minimum=20, maximum=60, name='mpp', latex_label='$\\mu_{pp}$') sigpp = Uniform(minimum=5e-1, maximum=1e1, name='sigpp', latex_label='$\\sigma_{pp}$') beta = Uniform(minimum=-4, maximum=6, name='beta', latex_label='$\\beta$') delta_m = Uniform(minimum=0, maximum=10, name='delta_m', latex_label='$\\delta m$') diff --git a/setup.cfg b/setup.cfg index 6194b460..ae309df9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,35 @@ +[metadata] +name = gwpopulation +description = Unified population inference +url = https://github.com/ColmTalbot/gwpopulation +author = Colm Talbot +author_email = talbotcolm@gmail.com +license_file = LICENSE.md +long_description = file: README.md +long_description_content_type = text/markdown +classifiers = + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + License :: OSI Approved :: MIT License + Operating System :: OS Independent +python_requires = ">=3.8" + +[options] +packages = find: +install_requires = file: requirements.txt + +[options.extras_require] +cupy = cupy +pages = file: pages_requirements.txt +test = file: test_requirements.txt + +[options.packages.find] +exclude = + test + venv + priors + [flake8] exclude = .git,build,dist,docs,test,*__init__.py max-line-length = 120 diff --git a/setup.py b/setup.py index 58e339b6..beda28e8 100644 --- a/setup.py +++ b/setup.py @@ -1,47 +1,5 @@ #!/usr/bin/env python -import os +from setuptools import setup -from setuptools import find_packages, setup - - -def get_long_description(): - """Finds the README and reads in the description""" - here = os.path.abspath(os.path.dirname(__file__)) - with open(os.path.join(here, "README.md")) as f: - long_description = f.read() - return long_description - - -# get version info from __init__.py -def readfile(filename): - with open(filename) as fp: - filecontents = fp.read() - return filecontents - - -long_description = get_long_description() - -with open("requirements.txt", "r") as ff: - requirements = ff.readlines() -setup( - name="gwpopulation", - description="Unified population inference", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/ColmTalbot/gwpopulation", - author="Colm Talbot", - author_email="talbotcolm@gmail.com", - license="MIT", - packages=find_packages(exclude=["test", "venv", "priors"]), - package_dir={"gwpopulation": "gwpopulation"}, - install_requires=requirements, - classifiers=[ - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - python_requires=">=3.8", -) +setup() diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 00000000..9c6b3285 --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,4 @@ +pytest-cov +pre-commit +jupyter +nbconvert \ No newline at end of file