Skip to content

Commit

Permalink
Fixing mypy issues (#352)
Browse files Browse the repository at this point in the history
* Fixed package name in setup.cfg.
Debugging mypy.

* Fixed property to getter (now numcosmo is properly encapsulated and the getter must be used).

* Refactor: NumCosmo now use getters instead of exposing properties directly.
  • Loading branch information
vitenti authored Dec 28, 2023
1 parent 3b9a4e5 commit 4f1769c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ jobs:
- name: Running mypy
shell: bash -l {0}
run: |
mypy -p firecrown
mypy -p examples
mypy -p tests
mypy -p firecrown -vv
mypy -p examples -vv
mypy -p tests -vv
- name: Running pylint
shell: bash -l {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion examples/des_y1_3x2pt/numcosmo_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def run_apes_sampler(ssize: int) -> None:
model.params_set_default_ftype()
mset.prepare_fparam_map()

nwalkers = mset.fparam_len * 100
nwalkers = mset.fparam_len() * 100
esmcmc = create_esmcmc(
fit.props.likelihood, mset, "des_y1_3x2pt_apes", nwalkers=nwalkers, nthreads=1
)
Expand Down
12 changes: 6 additions & 6 deletions firecrown/connector/numcosmo/numcosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ def calculate_ccl_args(self, mset: Ncm.MSet): # pylint: disable-msg=too-many-lo

if self._p_ml:
p_m_spline = self._p_ml.get_spline_2d(hi_cosmo)
z = np.array(p_m_spline.xv.dup_array())
k = np.array(p_m_spline.yv.dup_array())
z = np.array(p_m_spline.peek_xv().dup_array())
k = np.array(p_m_spline.peek_yv().dup_array())

scale = self.mapping.redshift_to_scale_factor(z)
p_k = np.transpose(
np.array(p_m_spline.zm.dup_array()).reshape(len(k), len(z))
np.array(p_m_spline.peek_zm().dup_array()).reshape(len(k), len(z))
)
p_k = self.mapping.redshift_to_scale_factor_p_k(p_k)

Expand All @@ -219,12 +219,12 @@ def calculate_ccl_args(self, mset: Ncm.MSet): # pylint: disable-msg=too-many-lo

if self._p_mnl:
p_mnl_spline = self._p_mnl.get_spline_2d(hi_cosmo)
z = np.array(p_mnl_spline.xv.dup_array())
k = np.array(p_mnl_spline.yv.dup_array())
z = np.array(p_mnl_spline.peek_xv().dup_array())
k = np.array(p_mnl_spline.peek_yv().dup_array())

scale_mpnl = self.mapping.redshift_to_scale_factor(z)
p_mnl = np.transpose(
np.array(p_mnl_spline.zm.dup_array()).reshape(len(k), len(z))
np.array(p_mnl_spline.peek_zm().dup_array()).reshape(len(k), len(z))
)
p_mnl = self.mapping.redshift_to_scale_factor_p_k(p_mnl)

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install_requires =
pandas
pyccl
sacc
yaml
pyyaml

[options.packages.find]
exclude =
Expand Down

0 comments on commit 4f1769c

Please sign in to comment.