diff --git a/.github/workflows/testing-and-coverage.yml b/.github/workflows/testing-and-coverage.yml index 64117bb..c3fc2bb 100644 --- a/.github/workflows/testing-and-coverage.yml +++ b/.github/workflows/testing-and-coverage.yml @@ -34,4 +34,6 @@ jobs: run: | python -m pytest tests -m "not slow" --cov=lephare --cov-report=xml - name: Upload coverage report to codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index 464ef1f..d7c97d6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # pz-rail-lephare [![Template](https://img.shields.io/badge/Template-LINCC%20Frameworks%20Python%20Project%20Template-brightgreen)](https://lincc-ppt.readthedocs.io/en/latest/) -[![codecov](https://codecov.io/gh/LSSTDESC/pz-rail-lephare/branch/main/graph/badge.svg)](https://codecov.io/gh/LSSTDESC/pz-rail-lephare) +[![codecov](https://codecov.io/gh/LSSTDESC/rail_lephare/graph/badge.svg?token=I597zffkaM)](https://codecov.io/gh/LSSTDESC/rail_lephare) [![PyPI](https://img.shields.io/pypi/v/pz-rail-lephare?color=blue&logo=pypi&logoColor=white)](https://pypi.org/project/pz-rail-lephare/) ## RAIL LePHARE diff --git a/src/rail/estimation/algos/lephare.py b/src/rail/estimation/algos/lephare.py index 810f66a..e4b1dcb 100644 --- a/src/rail/estimation/algos/lephare.py +++ b/src/rail/estimation/algos/lephare.py @@ -261,7 +261,7 @@ def _rail_to_lephare_input(data, mag_cols, mag_err_cols): """ - ng = data["redshift"].shape[0] + ng = data[mag_cols[0]].shape[0] # Make input catalogue in standard lephare format input = Table() try: @@ -280,12 +280,15 @@ def _rail_to_lephare_input(data, mag_cols, mag_err_cols): mask &= input[mag_err_cols[n]] > 0 mask &= ~np.isnan(input[mag_err_cols[n]]) context += mask * 2**n - # Set context to data value or excluding all negative and nan values + # Set context to data value if set or else exclude all negative and nan values try: input["context"] = data["context"] except KeyError: input["context"] = context - input["zspec"] = data["redshift"] + try: + input["zspec"] = data["redshift"] + except KeyError: + input["zspec"] = np.full(ng,-99.) input["string_data"] = " " return input