Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 29, 2024
1 parent 767699e commit 3173ac0
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions devel/simple_memory_leak_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This is a script that runs a very basic mock Core/Likelihood
"""

import gc
import numpy as np
import tracemalloc
Expand Down
1 change: 1 addition & 0 deletions src/py21cmmc/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions src/py21cmmc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
TODO: Add description of the API of cores (and how to define new ones).
"""

import copy
import inspect
import logging
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/py21cmmc/cosmoHammer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A set of extensions to the basic ``CosmoHammer`` package."""

import emcee
import gc
import h5py
Expand Down
1 change: 1 addition & 0 deletions src/py21cmmc/ensemble.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 7 additions & 6 deletions src/py21cmmc/likelihood.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing 21CMMC likelihoods."""

import logging
import numpy as np
from cached_property import cached_property
Expand Down Expand Up @@ -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] = (

Check warning on line 1045 in src/py21cmmc/likelihood.py

View check run for this annotation

Codecov / codecov/patch

src/py21cmmc/likelihood.py#L1045

Added line #L1045 was not covered by tests
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] = (

Check warning on line 1049 in src/py21cmmc/likelihood.py

View check run for this annotation

Codecov / codecov/patch

src/py21cmmc/likelihood.py#L1049

Added line #L1049 was not covered by tests
0 # cl['eb'][j] class does not compute eb
)

index += my_clik.get_lmax()[i] + 1

Expand Down
1 change: 1 addition & 0 deletions src/py21cmmc/mcmc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""High-level functions for running MCMC chains."""

import logging
import numpy as np
import scipy.stats as stats
Expand Down

0 comments on commit 3173ac0

Please sign in to comment.