Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mag and e_mag values when forcediffimflux and/or forcediffimfluxunc is -99999 #323

Merged
merged 21 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
beeeb7a
Fix mag and e_mag values when forcediffimflux and/or forcediffimfluxu…
ale-munozarancibia Dec 6, 2023
c5dac92
Simplified expressions
ale-munozarancibia Dec 6, 2023
1d7b0c4
Fixed if condition
ale-munozarancibia Dec 6, 2023
4bce93e
Fixed black error
ale-munozarancibia Dec 6, 2023
356750e
chore: update value
dirodriguezm Dec 5, 2023
ab03119
fix: add early classifier
dirodriguezm Dec 5, 2023
f827328
fix: psql default values
dirodriguezm Dec 6, 2023
d453f2b
tests: fix mock data
dirodriguezm Dec 6, 2023
bc0d8a1
tests: fix mock data with non nullable fields
dirodriguezm Dec 6, 2023
ab2b891
tests: fix mock data with non nullable fields
dirodriguezm Dec 6, 2023
e0bd983
tests: fix mock data with non nullable fields on the rest of the tests
dirodriguezm Dec 6, 2023
6929af3
chore: update version
alerceadmin Dec 6, 2023
38ff93f
chore: apply formatting
dirodriguezm Dec 6, 2023
3de57dd
fix: forced photometry extra fields as columns only consider extra_fi…
dirodriguezm Dec 6, 2023
90373b4
fix: forced_photometry extra fields
dirodriguezm Dec 6, 2023
33f6b76
tests: add update case and assertions
dirodriguezm Dec 6, 2023
d1c2233
refactor: use execute multiple values instead of insert with a list
dirodriguezm Dec 6, 2023
9e8ce4f
chore: update version
alerceadmin Dec 6, 2023
10f285b
refactor: keep -999999 value (as ztf does) instead of nan
dirodriguezm Dec 6, 2023
86eee1c
Fixed -99999 fluxes to _ZERO_MAG magnitudes and inf corrected magnitudes
ale-munozarancibia Dec 6, 2023
97da122
Merge branch 'main' of github.com:alercebroker/pipeline into fix/forc…
dirodriguezm Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions correction_step/correction/core/strategy/ztf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
SHARPNR_MAX = 0.1
SHARPNR_MIN = -0.13

_ZERO_MAG = 100.0


def is_corrected(detections: pd.DataFrame) -> pd.Series:
"""Whether the nearest source is closer than `DISTANCE_THRESHOLD`"""
Expand Down Expand Up @@ -70,6 +72,12 @@ def correct(detections: pd.DataFrame) -> pd.DataFrame:
e_mag_corr = np.where(aux4 < 0, np.inf, np.sqrt(aux4) / aux3)
e_mag_corr_ext = aux2 * detections["e_mag"] / aux3

mask = np.array(np.isclose(detections["mag"], _ZERO_MAG))
mag_corr[mask] = np.inf
mask = np.array(np.isclose(detections["mag"], _ZERO_MAG) or np.isclose(detections["e_mag"], _ZERO_MAG))
e_mag_corr[mask] = np.inf
e_mag_corr_ext[mask] = np.inf

return pd.DataFrame({"mag_corr": mag_corr, "e_mag_corr": e_mag_corr, "e_mag_corr_ext": e_mag_corr_ext})


Expand Down
273 changes: 3 additions & 270 deletions early_classification_step/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,276 +22,6 @@ black = "^22.3.0"
[tool.black]
line-length = 88















































































































































































































































































[tool.poetry.group.test.dependencies]
coverage = "^7.2.7"
pytest = "^7.4.0"
Expand Down Expand Up @@ -566,7 +296,10 @@ pytest-docker = "^1.0.1"



<<<<<<< HEAD
=======

>>>>>>> fb88a003683ccefdbbc44715f7746038de5a6e21
[tool.poetry.group.model.dependencies]
ephem = "3.7.7.0"
absl-py = "0.7.1"
Expand Down
10 changes: 10 additions & 0 deletions prv_candidates_step/prv_candidates_step/core/strategy/ztf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from survey_parser_plugins.core.mapper import Mapper
from survey_parser_plugins.parsers import ZTFParser

_ZERO_MAG = 100.0


def prv_non_detections_mapper() -> dict:
mapping = copy.deepcopy(ZTFParser._mapping)
Expand Down Expand Up @@ -83,6 +85,14 @@ def __calculate_mag(cls, data):

mag = -2.5 * np.log10(np.abs(forcediffimflux)) + 23.9
e_mag = 1.0857 * forcediffimfluxunc / np.abs(forcediffimflux)

if np.isclose(data["forcediffimflux"], _ZERO_MAG):
mag = _ZERO_MAG
e_mag = _ZERO_MAG

if np.isclose(data["forcediffimfluxunc"], _ZERO_MAG):
e_mag = _ZERO_MAG

return mag, e_mag

@classmethod
Expand Down
Loading