Skip to content

Commit

Permalink
Fixed renameDict error in model instantiation. (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcrenshaw committed Nov 4, 2022
1 parent 26d23f0 commit b1f0c5e
Show file tree
Hide file tree
Showing 10 changed files with 709 additions and 632 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
# (requires CODECOV_TOKEN in repository secrets)
#----------------------------------------------
- name: Upload coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # Only required for private repositories
file: ./coverage.xml
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ errModel = LsstErrorModel(renameDict={"u": "lsst_u", "g": "lsst_g", ...})
This tells `LsstErrorModel` to use all of the default parameters, but just change the names it gave to all of the bands.
If you are changing other dictionary-parameters at the same time (e.g. `nVisYr`, which sets the number of visits in each band per year), you can supply those parameters using *either* the new or old naming scheme!

### *Directly setting limiting magnitudes*

By default, PhotErr tries to use the provided information to calculate limiting magnitudes for you.
If you would like to directly supply your own $5\sigma$ limits, you can do so using the `m5` parameter.
Note that PhotErr assumes these are single-visit limiting magnitudes.
If you want to supply coadded depths, you should also set `nYrObs=1` and `nVisYr={u: 1, g: 1, ...}`, so that the calculated coadded depths are equal to those you provided.

### *Handling non-detections*

The other big thing you may want to change is how the error model identifies and handles non-detections.
Expand Down
2 changes: 1 addition & 1 deletion photerr/euclid.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ def __init__(self, **kwargs: Any) -> None:
Keyword arguments override default values in EuclidErrorParams.
"""
super().__init__(EuclidErrorParams(), **kwargs)
super().__init__(EuclidErrorParams(**kwargs))
2 changes: 1 addition & 1 deletion photerr/lsst.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ def __init__(self, **kwargs: Any) -> None:
Keyword arguments override default values in LsstErrorParams.
"""
super().__init__(LsstErrorParams(), **kwargs)
super().__init__(LsstErrorParams(**kwargs))
2 changes: 1 addition & 1 deletion photerr/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, *args: ErrorParams, **kwargs: Any) -> None:
elif len(args) > 0 and len(kwargs) == 0:
self._params = args[0]
elif len(args) == 0 and len(kwargs) > 0:
self._params = ErrorParams(**kwargs) # pragma: no cover
self._params = ErrorParams(**kwargs)
else:
self._params = args[0].copy()
self._params.update(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion photerr/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def update(self, *args: dict, **kwargs: Any) -> None:

# make sure that all of the keywords are in the class
for key in kwargs:
if key not in self.__dict__:
if key not in self.__dict__ and key not in ["renameDict", "validate"]:
raise ValueError(
f"'{key}' is not a valid parameter name. "
"Please check the docstring."
Expand Down
2 changes: 1 addition & 1 deletion photerr/roman.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ def __init__(self, **kwargs: Any) -> None:
Keyword arguments override default values in RomanErrorParams.
"""
super().__init__(RomanErrorParams(), **kwargs)
super().__init__(RomanErrorParams(**kwargs))
Loading

0 comments on commit b1f0c5e

Please sign in to comment.