Skip to content

Commit

Permalink
updated the test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
anand-avinash committed Mar 13, 2024
1 parent 7a5d510 commit d19bf05
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 31 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Taken from <https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions>

name: documentation
name: Documentation
on:
push:
branches:
Expand All @@ -26,5 +26,7 @@ jobs:
path: .cache
restore-keys: |
mkdocs-material-
# The line below is to enable the docstring for the lbsim_interface.py
- run: pip install --no-deps litebird_sim
- run: pip install mkdocs-material mkdocstrings[python]
- run: mkdocs gh-deploy --force
18 changes: 9 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# setting up testing: <https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#testing-your-code>
# setting up compiler: <https://github.com/marketplace/actions/setup-c-c-compiler>

name: BrahMap testing
name: Tests
on:
push:
branches:
Expand All @@ -21,19 +21,19 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install compiler
id: install_cc
uses: rlalik/setup-cpp-compiler@master
with:
compiler: gcc-10
# - name: Install compiler
# id: install_cc
# uses: rlalik/setup-cpp-compiler@master
# with:
# compiler: gcc-10 # This compiler has been failing with (macos-latest, 3.11/3.12)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install BrahMap
env:
CC: ${{ steps.install_cc.outputs.cc }}
CXX: ${{ steps.install_cc.outputs.cxx }}
# env:
# CC: ${{ steps.install_cc.outputs.cc }}
# CXX: ${{ steps.install_cc.outputs.cxx }}
run: |
python -m pip install --upgrade pip
python -m pip install .
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# BrahMap

<!-- markdownlint-disable MD013 -->
![BrahMap testsuite](https://github.com/anand-avinash/BrahMap/actions/workflows/tests.yaml/badge.svg)
![BrahMap documentation build status](https://github.com/anand-avinash/BrahMap/actions/workflows/documentation.yaml/badge.svg)
<!-- markdownlint-enable MD013 -->

<!-- markdownlint-disable MD033 -->
<font color="red"> **This project is currently under active development!!!** </font>
<!-- markdownlint-disable MD033 -->
<!-- markdownlint-enable MD033 -->

`BrahMap` is an optimal map-making framework for the future CMB experiments,
based on [COSMOMAP2](https://github.com/giuspugl/COSMOMAP2), as described in
Expand Down
10 changes: 6 additions & 4 deletions brahmap/utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@

# suggestion taken from: <https://docs.astral.sh/ruff/rules/unused-import/>
if find_spec("litebird_sim") is not None:
import_str = "lbs_process_timesamples"
from .lbsim_interface import lbs_process_timesamples

__all__ = ["lbs_process_timesamples"]

else:
import_str = None
__all__ = []

__all__ = [
__all__ = __all__ + [
"is_sorted",
"bash_colors",
"filter_warnings",
Expand All @@ -42,5 +45,4 @@
"subscan_resize",
"system_setup",
"ProcessTimeSamples",
import_str,
]
24 changes: 13 additions & 11 deletions brahmap/utilities/lbsim_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ def lbs_process_timesamples(
obspix: np.ndarray = None,
galactic_coords: bool = True,
):
"""--^._.^-- cheese --^._.^--
"""This function accepts the pointing and polarization angle arrays from `litebird_sim`, rotates them from elliptic to galactic coordinate system, generates the pixel indices of the pointings and then passes them to :func:`ProcessTimeSamples`.
Args:
- ``nside`` (int): nside for the output map
- ``pointings`` (np.ndarray): An array of detector pointings of shape (nsamp, 2)
- ``pol_angles`` (np.ndarray): A 1-d array of polarization angle
- ``pol_idx`` (int): Type of map-making to use. Defaults to 3.
- ``w`` (np.ndarray): array with noise weights , :math:`w_t= N^{-1} _{tt}`, computed by :func:`BlockLO.build_blocks`. If it is not set :func:`ProcessTimeSamples.initializeweights` assumes it to be a :func:`numpy.ones` array. Defaults to None.
- ``threshold_cond`` (float): Sets the condition number threshold to mask bad conditioned pixels (it's used in polarization cases). Defaults to 1.e3.
- ``obspix`` (np.ndarray): Map from the internal pixelization to an external one, i.e. HEALPIX, it has to be modified when pathological pixels are not taken into account. It not set, it is assumed to be `numpy.arange(npix). Defaults to None.
- ``galactic_coords`` (bool, optional): Say yes if you want your result in galactic coordinates. Defaults to True.
- ``nside`` (int): nside for the output map
- ``pointings`` (np.ndarray): An array of detector pointings of shape (nsamp, 2)
- ``pol_angles`` (np.ndarray): A 1-d array of polarization angle
- ``pol_idx`` (int): Type of map-making to use. Defaults to 3.
- ``w`` (np.ndarray): array with noise weights , :math:`w_t= N^{-1} _{tt}`, computed by :func:`BlockLO.build_blocks`. If it is not set :func:`ProcessTimeSamples.initializeweights` assumes it to be a :func:`numpy.ones` array. Defaults to None.
- ``threshold_cond`` (float): Sets the condition number threshold to mask bad conditioned pixels (it's used in polarization cases). Defaults to 1.e3.
- ``obspix`` (np.ndarray): Map from the internal pixelization to an external one, i.e. HEALPIX, it has to be modified when pathological pixels are not taken into account. It not set, it is assumed to be `numpy.arange(npix). Defaults to None.
- ``galactic_coords`` (bool, optional): Say yes if you want your result in galactic coordinates. Defaults to True.
Returns:
- ``pointings`` (np.ndarray): Pointings as pixel index
- ``ProcessTimeSamples``: ProcessTimeSamples class
- ``pointings`` (np.ndarray): Pointings as pixel index
- ``ProcessTimeSamples``: ProcessTimeSamples class
"""
if galactic_coords:
pointings, pol_angles = lbs.coordinates.rotate_coordinates_e2g(
Expand Down
2 changes: 2 additions & 0 deletions docs/api_ref/utilities.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Utilities functions

::: brahmap.utilities

::: brahmap.utilities.lbsim_interface
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
define_macros=None,
extra_compile_args=[
"-O3",
"-march=native",
# "-march=native",
"-Wall",
"-shared",
"-std=c++14",
Expand All @@ -33,7 +33,7 @@
define_macros=None,
extra_compile_args=[
"-O3",
"-march=native",
# "-march=native",
"-Wall",
"-shared",
"-std=c++14",
Expand All @@ -51,7 +51,7 @@
define_macros=None,
extra_compile_args=[
"-O3",
"-march=native",
# "-march=native",
"-Wall",
"-shared",
"-std=c++14",
Expand All @@ -69,7 +69,7 @@
define_macros=None,
extra_compile_args=[
"-O3",
"-march=native",
# "-march=native",
"-Wall",
"-shared",
"-std=c++14",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_BlkDiagPrecondLO_tools_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __init__(self):


@pytest.mark.parametrize(
"initfloat, rtol", [(InitFloat32Params(), 5.0e-6), (InitFloat64Params(), 5.0e-6)]
"initfloat, rtol", [(InitFloat32Params(), 5.0e-5), (InitFloat64Params(), 5.0e-5)]
)
class TestBlkDiagPrecondLO:
def test_BlkDiagPrecondLO_mult_qu(self, initfloat, rtol):
Expand Down

0 comments on commit d19bf05

Please sign in to comment.