diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3e15bf4c..921873e7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ exclude: '(^docs/conf.py|^user_data/External_tables/)' repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: check-added-large-files @@ -17,7 +17,7 @@ repos: - id: mixed-line-ending args: ['--fix=no'] - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 # pick a git hash / tag to point to + rev: 7.3.0 # pick a git hash / tag to point to hooks: - id: flake8 additional_dependencies: @@ -28,16 +28,16 @@ repos: - flake8-rst-docstrings - flake8-copyright - flake8-docstrings - - repo: https://github.com/psf/black - rev: 23.9.1 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 25.12.0 hooks: - id: black - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 7.0.0 hooks: - id: isort - repo: https://github.com/asottile/pyupgrade - rev: v3.11.1 + rev: v3.21.2 hooks: - id: pyupgrade args: [--py38-plus] diff --git a/devel/simple_memory_leak_test.py b/devel/simple_memory_leak_test.py index 21bd50f8..4d00140e 100644 --- a/devel/simple_memory_leak_test.py +++ b/devel/simple_memory_leak_test.py @@ -1,6 +1,7 @@ """ This is a script that runs a very basic mock Core/Likelihood """ + import gc import numpy as np import tracemalloc diff --git a/src/py21cmmc/analyse.py b/src/py21cmmc/analyse.py index 2d7e28e3..4c8d100f 100644 --- a/src/py21cmmc/analyse.py +++ b/src/py21cmmc/analyse.py @@ -2,6 +2,7 @@ Also enables more transparent input/output of chains. """ + import numpy as np from matplotlib import pyplot as plt from os.path import join diff --git a/src/py21cmmc/core.py b/src/py21cmmc/core.py index 3a7c7934..e2fb15b2 100644 --- a/src/py21cmmc/core.py +++ b/src/py21cmmc/core.py @@ -4,6 +4,7 @@ TODO: Add description of the API of cores (and how to define new ones). """ + import copy import inspect import logging @@ -627,13 +628,15 @@ def run(self, astro_params, cosmo_params, ctx): for i in range(N): muv, mhalo, lf = p21.compute_luminosity_function( mturnovers=mturnovers if self.flag_options.USE_MINI_HALOS else None, - mturnovers_mini=mturnovers_mini - if self.flag_options.USE_MINI_HALOS - else None, + mturnovers_mini=( + mturnovers_mini if self.flag_options.USE_MINI_HALOS else None + ), redshifts=self.redshift, - astro_params=astro_params[i] - if not isinstance(astro_params, p21.AstroParams) - else astro_params, + astro_params=( + astro_params[i] + if not isinstance(astro_params, p21.AstroParams) + else astro_params + ), flag_options=self.flag_options, cosmo_params=cosmo_params, user_params=self.user_params, diff --git a/src/py21cmmc/cosmoHammer.py b/src/py21cmmc/cosmoHammer.py index c61b5fe9..4f24b516 100644 --- a/src/py21cmmc/cosmoHammer.py +++ b/src/py21cmmc/cosmoHammer.py @@ -1,4 +1,5 @@ """A set of extensions to the basic ``CosmoHammer`` package.""" + import emcee import gc import h5py diff --git a/src/py21cmmc/ensemble.py b/src/py21cmmc/ensemble.py index 64f2f212..5ed03b01 100644 --- a/src/py21cmmc/ensemble.py +++ b/src/py21cmmc/ensemble.py @@ -1,4 +1,5 @@ """Patch of `emcee.Ensemble` to allow for some new features required for 21CMMC.""" + import emcee import logging import numpy as np diff --git a/src/py21cmmc/likelihood.py b/src/py21cmmc/likelihood.py index fc1603d2..eb59b28a 100644 --- a/src/py21cmmc/likelihood.py +++ b/src/py21cmmc/likelihood.py @@ -1,4 +1,5 @@ """Module containing 21CMMC likelihoods.""" + import logging import numpy as np from cached_property import cached_property @@ -1041,13 +1042,13 @@ def computeLikelihood(self, model): elif i == 4: tot[index + j] = cl["te"][j] elif i == 5: - tot[ - index + j - ] = 0 # cl['tb'][j] class does not compute tb + tot[index + j] = ( + 0 # cl['tb'][j] class does not compute tb + ) elif i == 6: - tot[ - index + j - ] = 0 # cl['eb'][j] class does not compute eb + tot[index + j] = ( + 0 # cl['eb'][j] class does not compute eb + ) index += my_clik.get_lmax()[i] + 1 diff --git a/src/py21cmmc/mcmc.py b/src/py21cmmc/mcmc.py index f6c43a0f..67bb225e 100644 --- a/src/py21cmmc/mcmc.py +++ b/src/py21cmmc/mcmc.py @@ -1,4 +1,5 @@ """High-level functions for running MCMC chains.""" + import logging import numpy as np import scipy.stats as stats