Skip to content

Commit

Permalink
py311
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Nov 13, 2023
1 parent 79d4a3a commit 4eec624
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Conda w/ Python 3.12
- name: Install Conda w/ Python 3.11
uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: false
python-version: '3.12'
python-version: '3.11'
channels: conda-forge
- name: Install Dependencies
shell: bash -el {0}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.12']
toxenv: [py312-test-all-latest]
python-version: ['3.11']
toxenv: [py311-test-all-latest]
# release: [main, latest] # there are no releases yet so this would break
release: [main]
steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:

- name: latest supported versions
os: ubuntu-latest
python-version: '3.12'
toxenv: py312-test-all-latest-cov
python-version: '3.11'
toxenv: py311-test-all-latest-cov

- name: oldest supported versions
os: ubuntu-latest
Expand All @@ -23,8 +23,8 @@ jobs:

- name: macOS 11
os: macos-11
python-version: '3.12'
toxenv: py312-test-latest
python-version: '3.11'
toxenv: py311-test-latest

steps:
- name: Checkout repository
Expand Down
6 changes: 3 additions & 3 deletions soliket/clusters/clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
from importlib import resources

import pyccl as ccl

from ..poisson import PoissonLikelihood
from ..utils import package_data_file
from . import massfunc as mf
from .survey import SurveyData
from .sz_utils import szutils
Expand All @@ -43,10 +43,10 @@ class ClusterLikelihood(PoissonLikelihood):
name = "Clusters"
columns = ["tsz_signal", "z", "tsz_signal_err"]

data_path = str(resources.path('soliket.clusters.data', 'selFn_equD56'))
data_path = package_data_file('soliket.clusters.data', 'selFn_equD56')

# data_path = resource_filename("soliket", "clusters/data/selFn_SO")
data_name = str(resources.path('soliket.clusters.data', 'E-D56Clusters.fits'))
data_name = package_data_file('soliket.clusters.data', 'E-D56Clusters.fits')

# data_name = resource_filename("soliket",
# "clusters/data/MFMF_WebSkyHalos_A10tSZ_3freq_tiles_mass.fits")
Expand Down
9 changes: 4 additions & 5 deletions soliket/lensing/lensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"""

import os
from importlib import resources

import numpy as np
import sacc
from cobaya.likelihoods.base_classes import InstallableLikelihood
Expand All @@ -22,6 +20,7 @@
# from cobaya.install import NotInstalledError

from ..ps import BinnedPSLikelihood
from ..utils import package_data_file


class LensingLikelihood(BinnedPSLikelihood, InstallableLikelihood):
Expand Down Expand Up @@ -237,6 +236,6 @@ class LensingLiteLikelihood(BinnedPSLikelihood):
"""
kind: str = "pp"
lmax: int = 3000
datapath: str = str(resources.path('soliket.lensing.data', 'binnedauto.txt'))
covpath: str = str(resources.path('soliket.lensing.data', 'binnedcov.txt'))
binning_matrix_path: str = str(resources.path('soliket.lensing.data', 'binningmatrix.txt'))
datapath: str = package_data_file('soliket.lensing.data', 'binnedauto.txt')
covpath: str = package_data_file('soliket.lensing.data', 'binnedcov.txt')
binning_matrix_path: str = package_data_file('soliket.lensing.data', 'binningmatrix.txt')
19 changes: 12 additions & 7 deletions soliket/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from importlib import import_module
from importlib import import_module, resources

from scipy.stats import binned_statistic as binnedstat
import numpy as np
Expand All @@ -20,15 +20,15 @@ def binner(ls, cls, bin_edges):
band powers with a top hat window function.
Note that the centers are computed as :math:`0.5({\rm LHE}+{\rm RHE})`,
where :math:`{\rm LHE}` and :math:`{\rm RHE}` are the bin edges.
While this is ok for plotting purposes, the user may need
to recompute the bin center in case of integer ``ls``
where :math:`{\rm LHE}` and :math:`{\rm RHE}` are the bin edges.
While this is ok for plotting purposes, the user may need
to recompute the bin center in case of integer ``ls``
if the correct baricenter is needed.
:param ls: Axis along which to bin
:param cls: Values to be binned
:param bin_edges: The edges of the bins. Note that all but the last bin
are open to the right. The last bin is closed.
are open to the right. The last bin is closed.
:return: The centers of the bins and the average of ``cls`` within the bins.
"""
Expand All @@ -54,13 +54,18 @@ def get_likelihood(name, options=None):
return t(options)


def package_data_file(package, fname):
with resources.path(package, fname) as path:
return str(path)


class OneWithCls(one):
r"""
Extension of
`cobaya.likelihoods.one
`cobaya.likelihoods.one
<https://cobaya.readthedocs.io/en/latest/likelihood_one.html>`_
which creates a dummy :math:`C_\ell` requirements dictionary with an
:math:`\ell_{\rm max}` of 1000 to force computation of ``pp``, ``tt``, ``te``, ``ee``
:math:`\ell_{\rm max}` of 1000 to force computation of ``pp``, ``tt``, ``te``, ``ee``
and ``bb`` :math:`C_\ell` s.
"""
lmax = 10000
Expand Down

0 comments on commit 4eec624

Please sign in to comment.