Skip to content

Commit

Permalink
add codecov reports (#73)
Browse files Browse the repository at this point in the history
* add codecov reports

* add codecov reports changelog

* add codecov fix token

* readme and new tests

* Updated coverage.svg

* add cov test

* fish test

* Updated coverage.svg

* Merge branch 'main' into codecov
  • Loading branch information
santiagocasas authored Sep 24, 2024
1 parent 0f252dd commit c6be5bc
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
- name: Run tests
run: |
pytest
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: coverage.py badge
uses: tj-actions/coverage-badge-py@v2.0.3
- name: Verify Changed files
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1.1.0 : Implemented symbolic as a new boltzmann solver class. Fixes of feedback prints. More docstrings.
1.1.1 : Resolved gcsp bias bug, new test suite.
1.1.2 : Coverage badge

1.1.3 : New split up demonstration notebooks
1.1.3 : New split up demonstration notebooks
1.1.4 : Coverage reports with Codecov
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# cosmicfishpie

[![Documentation Status](https://readthedocs.org/projects/cosmicfishpie/badge/?version=latest)](https://cosmicfishpie.readthedocs.io/en/latest/?badge=latest)
![Coverage](./coverage.svg)
![Coverage](./coverage.svg) [![codecov](https://codecov.io/github/santiagocasas/cosmicfishpie/graph/badge.svg?token=BXTVDPXPUO)](https://codecov.io/github/santiagocasas/cosmicfishpie)

<div align="center">
<img src="https://github.com/santiagocasas/cosmicfishpie/assets/6987716/1816b3b7-0920-4a2c-aafd-9c4ba1dc3e2b" width="280">
Expand Down
4 changes: 2 additions & 2 deletions coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions tests/cosmicfish_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from cosmicfishpie.analysis.fisher_operations import marginalise_over
from cosmicfishpie.utilities.utils import printing as cpr


Expand All @@ -13,3 +14,13 @@ def test_FisherMatrix(spectro_fisher_matrix):
assert hasattr(fish, "fisher_matrix")
assert hasattr(fish, "fisher_matrix_inv")
assert hasattr(fish, "get_confidence_bounds")


def test_marginalise_over(spectro_fisher_matrix):
fish = spectro_fisher_matrix.compute(max_z_bins=1)
marginalized_fish = marginalise_over(fish, ["h"])
assert hasattr(marginalized_fish, "fisher_matrix")
assert hasattr(marginalized_fish, "fisher_matrix_inv")
assert hasattr(marginalized_fish, "get_confidence_bounds")
assert hasattr(marginalized_fish, "get_param_names")
assert len(marginalized_fish.get_param_names()) == (1 + 2)
35 changes: 35 additions & 0 deletions tests/photo_cov_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from cosmicfishpie.LSSsurvey.photo_cov import PhotoCov

# You might need to add more imports depending on what you're testing


def test_photo_cov_initialization(photo_fisher_matrix):
cosmopars = {"Omegam": 0.3, "h": 0.7} # Add more parameters as needed
cosmoFM = photo_fisher_matrix
photo_cov = PhotoCov(cosmopars, cosmoFM.photopars, cosmoFM.IApars, cosmoFM.biaspars)
assert isinstance(photo_cov, PhotoCov)
assert photo_cov.cosmopars == cosmopars


def test_get_cls(photo_fisher_matrix):
cosmoFM = photo_fisher_matrix
cosmopars = {"Omegam": 0.3, "h": 0.7} # Add more parameters as needed
photo_cov = PhotoCov(cosmopars, cosmoFM.photopars, cosmoFM.IApars, cosmoFM.biaspars)
allparsfid = dict()
allparsfid.update(cosmopars)
allparsfid.update(cosmoFM.IApars)
allparsfid.update(cosmoFM.biaspars)
allparsfid.update(cosmoFM.photopars)
cls = photo_cov.getcls(allparsfid)
assert isinstance(cls, dict)
# Add more specific assertions based on what you expect in the result


def test_get_cls_noise(photo_fisher_matrix):
cosmoFM = photo_fisher_matrix
cosmopars = {"Omegam": 0.3, "h": 0.7} # Add more parameters as needed
photo_cov = PhotoCov(cosmopars, cosmoFM.photopars, cosmoFM.IApars, cosmoFM.biaspars)
cls = photo_cov.getcls(photo_cov.allparsfid)
noisy_cls = photo_cov.getclsnoise(cls)
assert isinstance(noisy_cls, dict)
# Add more specific assertions based on what you expect in the result

0 comments on commit c6be5bc

Please sign in to comment.