antares-devkit 0.9.2__tar.gz → 0.10.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/PKG-INFO +1 -1
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/decam_shadow/__init__.py +4 -2
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/extragalactic/__init__.py +20 -13
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/models.py +24 -3
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/pyproject.toml +1 -1
- antares_devkit-0.10.1/test/unit/antares_devkit/filters/test_test_dev_all.py +171 -0
- antares_devkit-0.9.2/test/unit/antares_devkit/filters/test_test_dev_all.py +0 -78
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/LICENSE.txt +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/README.md +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/bad_detection/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/bad_seeing/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/crash_filter/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/desi_target/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/dwarf_nova_outburst/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/ecl_transient_1/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/ecl_transient_2/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/highamp/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/highfluxchange/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/highsnr/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/if_anomaly_detection/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/if_anomaly_detection/data/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/if_anomaly_detection/data/paleo2_106IFmodel_472727objs_nest=1000_cont=0.001_transf.pkl +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/imbh/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/inm31/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/laiss_rfc_ad_filter/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/laiss_rfc_ad_filter/data/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/laiss_rfc_ad_filter/data/cls=binary_n_estimators=100_max_depth=35_rs=11_max_feats=35_cw=balanced.pkl +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/lantern/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/lantern/data/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/lantern/data/lantern_xgboost_t2.0.7.pkl +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/lsst_ddf/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/lsst_transient_quality_scimma/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/malanchev_anomaly_transient_dmdt/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/malanchev_anomaly_transient_dmdt/data/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/malanchev_anomaly_transient_dmdt/data/malanchev_ssiforest_v1.pickle +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/malanchev_features_v1/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/microlensing/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/novtest/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/nuclear_transient/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/nuttela_tao/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/passta_nearby_transients/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/persistent_dimmers/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/random_tagger_filter/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/recent_reddening/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/refitt_newsources_snrcut/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/rubin_NovTest_soraisam/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/sample_filter/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/shadow_virgo/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/siena_mag_coord_cut/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/sso/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/sub_lum/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/superphot_plus_v1/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/superphot_plus_ztf_v3/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/test_dev_all/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/test_dev_lsst/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/test_dev_ztf/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/uniform_random_sample/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/vpdf/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/vpdf/data/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/vpdf/data/matheson_percent_grid_v1 +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/young_extragalactic_candidate/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/young_rubin_transients_soraisam/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/utils.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/Dockerfile +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/__init__.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/conftest.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/data/large_locus.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/data/small_locus.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/unit/antares_devkit/filters/test_test_dev_lsst.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/unit/antares_devkit/filters/test_test_dev_ztf.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/unit/antares_devkit/test_models.py +0 -0
- {antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/unit/test_filters.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: antares-devkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.1
|
|
4
4
|
Summary: Provides tools and utility methods to write and debug ANTARES filters with Python.
|
|
5
5
|
Keywords: antares,devkit,filter development
|
|
6
6
|
Author-Email: NSF NOIRLab ANTARES Team <antares@noirlab.edu>
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/decam_shadow/__init__.py
RENAMED
|
@@ -66,8 +66,10 @@ class InDecamShadow(BaseFilter):
|
|
|
66
66
|
-31.6796, -31.2712, -32.3313])
|
|
67
67
|
shadow_hydra_ra = np.array([ 159.2305, 159.2126, 157.6973])
|
|
68
68
|
shadow_hydra_dec = np.array([-27.5186, -25.3493, -29.1417])
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
shadow_eridanus_ra = np.array([55.049339, 54.624471, 51.571778, 56.208088, 53.810654])
|
|
70
|
+
shadow_eridanus_dec = np.array([-18.580044, -23.027472, -21.335166, -21.91065, -20.373759])
|
|
71
|
+
shadow_all_ra = np.hstack((shadow_virgo_ra, shadow_antlia_ra, shadow_dorado_ra, shadow_fornax_ra, shadow_hydra_ra, shadow_eridanus_ra))
|
|
72
|
+
shadow_all_dec = np.hstack((shadow_virgo_dec, shadow_antlia_dec, shadow_dorado_dec, shadow_fornax_dec, shadow_hydra_dec, shadow_eridanus_dec))
|
|
71
73
|
field_centers = SkyCoord(ra=shadow_all_ra*u.deg, dec=shadow_all_dec*u.deg)
|
|
72
74
|
c = SkyCoord(ra*u.deg, dec*u.deg, frame='icrs')
|
|
73
75
|
sep = c.separation(field_centers)
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/extragalactic/__init__.py
RENAMED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
"""Description:
|
|
2
|
-
This filter finds locus that falls within 1 arcsec of a source listed in the 2MASS extended source catalog,
|
|
2
|
+
This filter finds locus that falls within 1 arcsec of a source listed in the 2MASS extended source catalog,
|
|
3
|
+
the NASA/IPAC Extragalactic Database, the NYU Value-Added Galaxy Catalog, the Sloan Digitized Sky Survey Galaxy catalog,
|
|
4
|
+
Milliquas, and the Veron Catalog of Quasars & AGNs, and within a radius corresponding to respective semi-major axis
|
|
5
|
+
for the Third Reference Catalog of bright galaxies. As new galaxy catalogs are added in ANTARES, we will update the filter accordingly.
|
|
3
6
|
"""
|
|
4
7
|
|
|
5
8
|
from antares_devkit.models import BaseFilter
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
class Extragalactic(BaseFilter):
|
|
9
|
-
# NAME = 'extragalactic' #for this default filter, name is same as its tag
|
|
10
12
|
SLACK_CHANNEL = "#filter-extragalactic"
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
]
|
|
14
|
+
TRIGGERING_SURVEY = "all"
|
|
15
|
+
REQUIRED_LOCUS_PROPERTIES = []
|
|
15
16
|
|
|
16
17
|
## bare absolute minimum alert properties proving it's good to go
|
|
17
18
|
REQUIRED_ALERT_PROPERTIES = [
|
|
18
|
-
"ztf_fid",
|
|
19
|
-
"ztf_magpsf",
|
|
20
|
-
"ztf_sigmapsf",
|
|
21
|
-
"ant_mjd",
|
|
22
19
|
"ant_survey",
|
|
23
20
|
]
|
|
24
21
|
|
|
@@ -29,14 +26,22 @@ class Extragalactic(BaseFilter):
|
|
|
29
26
|
},
|
|
30
27
|
]
|
|
31
28
|
|
|
32
|
-
# REQUIRES_FILES = []
|
|
33
|
-
|
|
34
29
|
def _run(self, locus):
|
|
30
|
+
survey = locus.alert.properties["ant_survey"]
|
|
35
31
|
if (
|
|
36
|
-
|
|
32
|
+
survey == 2
|
|
37
33
|
): # be sure we don't work with upper limits
|
|
38
34
|
return
|
|
39
35
|
|
|
36
|
+
# remove SSOs
|
|
37
|
+
if survey == 1:
|
|
38
|
+
if locus.properties['ztf_ssnamenr'] != 'null':
|
|
39
|
+
return
|
|
40
|
+
|
|
41
|
+
if survey == 4:
|
|
42
|
+
if len(locus.properties['survey']['lsst']['ss_object_id']) != 0:
|
|
43
|
+
return
|
|
44
|
+
|
|
40
45
|
matching_catalog_names = locus.catalog_objects.keys()
|
|
41
46
|
|
|
42
47
|
# These are the catalogs (Antares-based names) with extended sources
|
|
@@ -47,8 +52,10 @@ class Extragalactic(BaseFilter):
|
|
|
47
52
|
"sdss_gals",
|
|
48
53
|
"veron_agn_qso",
|
|
49
54
|
"RC3",
|
|
55
|
+
"milliquas",
|
|
50
56
|
]
|
|
51
57
|
|
|
58
|
+
|
|
52
59
|
if set(matching_catalog_names) & set(xsc_cats):
|
|
53
|
-
# print (f'Extragalctic hit!!! {alert_id} {ztf_object_id}')
|
|
54
60
|
locus.tag("extragalactic")
|
|
61
|
+
|
|
@@ -21,6 +21,12 @@ SURVEYS = {
|
|
|
21
21
|
"all": [1, 2, 3, 4],
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
PROPERTY_PREFIX = {
|
|
25
|
+
"ztf": "ztf_",
|
|
26
|
+
"decat": "decat_",
|
|
27
|
+
"lsst": "lsst_",
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
ES_FLOAT_MAX_VALUE = (2 - 2**-23) * 2**127
|
|
25
31
|
ES_FLOAT_MIN_VALUE = -ES_FLOAT_MAX_VALUE
|
|
26
32
|
|
|
@@ -608,8 +614,12 @@ class DevKitLocus(BaseModel):
|
|
|
608
614
|
if not isinstance(value, (str, float, int)):
|
|
609
615
|
raise ValueError("Properties must be integer, string or float")
|
|
610
616
|
|
|
611
|
-
if isinstance(value, float) and (
|
|
612
|
-
|
|
617
|
+
if isinstance(value, float) and (
|
|
618
|
+
value < ES_FLOAT_MIN_VALUE or ES_FLOAT_MAX_VALUE < value
|
|
619
|
+
):
|
|
620
|
+
raise ValueError(
|
|
621
|
+
f"Value `{value}` must be greater than {ES_FLOAT_MIN_VALUE} and lower than {ES_FLOAT_MAX_VALUE}"
|
|
622
|
+
)
|
|
613
623
|
|
|
614
624
|
self.user_properties[key] = value
|
|
615
625
|
|
|
@@ -707,8 +717,19 @@ class BaseFilter(abc.ABC):
|
|
|
707
717
|
return True
|
|
708
718
|
|
|
709
719
|
def _satisfies_alert_contraints(self, alert: DevkitAlert) -> bool:
|
|
720
|
+
is_ztf_alert = alert.properties["ant_survey"] in SURVEYS["ztf"]
|
|
721
|
+
is_lsst_alert = alert.properties["ant_survey"] in SURVEYS["lsst"]
|
|
722
|
+
is_decat_alert = alert.properties["ant_survey"] in SURVEYS["decat"]
|
|
710
723
|
for prop in self.REQUIRED_ALERT_PROPERTIES:
|
|
711
|
-
if prop
|
|
724
|
+
# if the required prop is survey specific and it doesn't match the survey
|
|
725
|
+
# for this alert then simply ignore that required prop.
|
|
726
|
+
if not is_lsst_alert and prop.startswith(PROPERTY_PREFIX["lsst"]):
|
|
727
|
+
continue
|
|
728
|
+
elif not is_ztf_alert and prop.startswith(PROPERTY_PREFIX["ztf"]):
|
|
729
|
+
continue
|
|
730
|
+
elif not is_decat_alert and prop.startswith(PROPERTY_PREFIX["decat"]):
|
|
731
|
+
continue
|
|
732
|
+
elif prop not in alert.properties:
|
|
712
733
|
return False
|
|
713
734
|
if max_level := self.REQUIRED_GRAV_WAVE_PROB_REGION:
|
|
714
735
|
matches = [
|
|
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "antares-devkit"
|
|
9
|
-
version = "0.
|
|
9
|
+
version = "0.10.1"
|
|
10
10
|
description = "Provides tools and utility methods to write and debug ANTARES filters with Python."
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
requires-python = ">=3.9"
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import copy
|
|
2
|
+
from test.data.large_locus import d as large_locus_dict
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from antares_devkit.filters.test_dev_all import TestDevAll
|
|
7
|
+
from antares_devkit.models import DevKitLocus
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TestTestDevAll:
|
|
11
|
+
def setup_method(self):
|
|
12
|
+
self._filter = TestDevAll()
|
|
13
|
+
|
|
14
|
+
def test_filter_should_be_skipped_when_required_alert_properties_not_satisfied(
|
|
15
|
+
self,
|
|
16
|
+
):
|
|
17
|
+
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
18
|
+
alert = locus_dict_copy["alerts"][-1]
|
|
19
|
+
# Change triggering alert to have no magnitude
|
|
20
|
+
alert["properties"].pop("ant_mag")
|
|
21
|
+
|
|
22
|
+
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
23
|
+
filter_returned = self._filter.run(locus)
|
|
24
|
+
assert filter_returned.status == "Skipped"
|
|
25
|
+
|
|
26
|
+
def test_filter_should_succeed_when_required_alert_properties_satisfied(
|
|
27
|
+
self,
|
|
28
|
+
):
|
|
29
|
+
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
30
|
+
alert = locus_dict_copy["alerts"][-1]
|
|
31
|
+
# force the ant_mag property to be set. This is a required prop for
|
|
32
|
+
# the TestDevAll filter
|
|
33
|
+
alert["properties"]["ant_mag"] = 1234
|
|
34
|
+
# ensure that the filter succeeds since the required alert prop is
|
|
35
|
+
# present
|
|
36
|
+
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
37
|
+
filter_returned = self._filter.run(locus)
|
|
38
|
+
assert filter_returned.status == "Succeeded"
|
|
39
|
+
|
|
40
|
+
def test_filter_should_succeed_when_no_required_alert_props_are_defined(
|
|
41
|
+
self,
|
|
42
|
+
):
|
|
43
|
+
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
44
|
+
alert = locus_dict_copy["alerts"][-1]
|
|
45
|
+
test_filter = TestDevAll()
|
|
46
|
+
test_filter.REQUIRED_ALERT_PROPERTIES = []
|
|
47
|
+
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
48
|
+
filter_returned = test_filter.run(locus)
|
|
49
|
+
assert filter_returned.status == "Succeeded"
|
|
50
|
+
|
|
51
|
+
def test_should_be_skipped_when_many_required_alert_properties_not_satisfied(self):
|
|
52
|
+
"""
|
|
53
|
+
When a survey specific required prop is present but doesn't match survey
|
|
54
|
+
and a general one is not satisfied the filter should still be skipped.
|
|
55
|
+
This ensures survey specific property logic doesn't interfere with general
|
|
56
|
+
required properties.
|
|
57
|
+
"""
|
|
58
|
+
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
59
|
+
alert = locus_dict_copy["alerts"][-1]
|
|
60
|
+
# Change triggering alert to have no magnitude
|
|
61
|
+
alert["properties"].pop("ant_mag")
|
|
62
|
+
# Change triggering alert to be an ZTF
|
|
63
|
+
alert["properties"]["ant_survey"] = 1
|
|
64
|
+
# Add a survey specific required property that doesn't match the survey
|
|
65
|
+
test_filter = TestDevAll()
|
|
66
|
+
test_filter.REQUIRED_ALERT_PROPERTIES = (
|
|
67
|
+
test_filter.REQUIRED_ALERT_PROPERTIES + ["lsst_diaSource_diaSourceId"]
|
|
68
|
+
)
|
|
69
|
+
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
70
|
+
filter_returned = test_filter.run(locus)
|
|
71
|
+
assert filter_returned.status == "Skipped"
|
|
72
|
+
|
|
73
|
+
@pytest.mark.parametrize(
|
|
74
|
+
"ant_survey,missing_alert_prop,present_alert_prop,expected_status",
|
|
75
|
+
[
|
|
76
|
+
(
|
|
77
|
+
1,
|
|
78
|
+
"lsst_diaSource_diaSourceId",
|
|
79
|
+
{"ztf_object_id": "ztf:123456"},
|
|
80
|
+
"Succeeded",
|
|
81
|
+
),
|
|
82
|
+
(3, "ztf_object_id", {"decat_object_id": "123456"}, "Succeeded"),
|
|
83
|
+
(4, "ztf_object_id", {"lsst_diaSource_diaSourceId": "123456"}, "Succeeded"),
|
|
84
|
+
(1, "ztf_object_id", {"lsst_diaSource_diaSourceId": "123456"}, "Skipped"),
|
|
85
|
+
(3, "decat_object_id", {"ztf_object_id": "123456"}, "Skipped"),
|
|
86
|
+
(
|
|
87
|
+
4,
|
|
88
|
+
"lsst_diaSource_diaSourceId",
|
|
89
|
+
{"ztf_object_id": "ztf:123456"},
|
|
90
|
+
"Skipped",
|
|
91
|
+
),
|
|
92
|
+
],
|
|
93
|
+
)
|
|
94
|
+
def test_should_only_skip_if_required_prop_matches_survey(
|
|
95
|
+
self, ant_survey, missing_alert_prop, present_alert_prop, expected_status
|
|
96
|
+
):
|
|
97
|
+
# Initialize a special filter that requires both ZTF and LSST props
|
|
98
|
+
test_filter = TestDevAll()
|
|
99
|
+
test_filter.REQUIRED_ALERT_PROPERTIES = [
|
|
100
|
+
"lsst_diaSource_diaSourceId",
|
|
101
|
+
"ztf_object_id",
|
|
102
|
+
"decat_object_id",
|
|
103
|
+
]
|
|
104
|
+
# copy a locus and retrieve one alert
|
|
105
|
+
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
106
|
+
alert = locus_dict_copy["alerts"][-1]
|
|
107
|
+
# Change triggering alert survey
|
|
108
|
+
alert["properties"]["ant_survey"] = ant_survey
|
|
109
|
+
# remove the prop that should be missing
|
|
110
|
+
if missing_alert_prop in alert["properties"]:
|
|
111
|
+
alert["properties"].pop(missing_alert_prop)
|
|
112
|
+
# add the prop that should be populated
|
|
113
|
+
alert["properties"] |= present_alert_prop
|
|
114
|
+
# Run the filter and ensure the status is as expected
|
|
115
|
+
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
116
|
+
filter_returned = test_filter.run(locus)
|
|
117
|
+
assert filter_returned.status == expected_status
|
|
118
|
+
|
|
119
|
+
@pytest.mark.parametrize(
|
|
120
|
+
"survey_name,ant_survey",
|
|
121
|
+
[("ZTF candidate", 1), ("ZTF upper limit", 2), ("DECAT", 3), ("LSST", 4)],
|
|
122
|
+
)
|
|
123
|
+
def test_filter_should_succeed_with_alerts_from_any_survey(
|
|
124
|
+
self,
|
|
125
|
+
survey_name,
|
|
126
|
+
ant_survey,
|
|
127
|
+
):
|
|
128
|
+
# {survey_name} case (variable not used, just descriptive of the case)
|
|
129
|
+
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
130
|
+
alert = locus_dict_copy["alerts"][-1]
|
|
131
|
+
# Change triggering alert to be {survey_name}
|
|
132
|
+
alert["properties"]["ant_survey"] = ant_survey
|
|
133
|
+
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
134
|
+
filter_returned = self._filter.run(locus)
|
|
135
|
+
assert filter_returned.status == "Succeeded"
|
|
136
|
+
|
|
137
|
+
@pytest.mark.parametrize(
|
|
138
|
+
"ant_survey,ant_mag",
|
|
139
|
+
[(1, 16.4), (2, 15.2), (3, 19.5), (4, 19.9)],
|
|
140
|
+
)
|
|
141
|
+
def test_filter_should_add_tag_if_max_mag_not_reached(
|
|
142
|
+
self,
|
|
143
|
+
ant_survey,
|
|
144
|
+
ant_mag,
|
|
145
|
+
):
|
|
146
|
+
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
147
|
+
alert = locus_dict_copy["alerts"][-1]
|
|
148
|
+
alert["properties"]["ant_survey"] = ant_survey
|
|
149
|
+
alert["properties"]["ant_mag"] = ant_mag
|
|
150
|
+
|
|
151
|
+
locus = DevKitLocus.model_validate(large_locus_dict)
|
|
152
|
+
self._filter.run(locus)
|
|
153
|
+
assert self._filter.OUTPUT_LOCUS_TAGS[0]["name"] in locus.tags
|
|
154
|
+
|
|
155
|
+
@pytest.mark.parametrize(
|
|
156
|
+
"ant_survey,ant_mag",
|
|
157
|
+
[(1, 20), (2, 24.2), (3, 20.1), (4, 31.5)],
|
|
158
|
+
)
|
|
159
|
+
def test_filter_should_not_add_tag_if_max_mag_reached(
|
|
160
|
+
self,
|
|
161
|
+
ant_survey,
|
|
162
|
+
ant_mag,
|
|
163
|
+
):
|
|
164
|
+
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
165
|
+
alert = locus_dict_copy["alerts"][-1]
|
|
166
|
+
alert["properties"]["ant_survey"] = ant_survey
|
|
167
|
+
alert["properties"]["ant_mag"] = ant_mag
|
|
168
|
+
|
|
169
|
+
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
170
|
+
self._filter.run(locus)
|
|
171
|
+
assert self._filter.OUTPUT_LOCUS_TAGS[0]["name"] not in locus.tags
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import copy
|
|
2
|
-
from test.data.large_locus import d as large_locus_dict
|
|
3
|
-
|
|
4
|
-
import pytest
|
|
5
|
-
|
|
6
|
-
from antares_devkit.filters.test_dev_all import TestDevAll
|
|
7
|
-
from antares_devkit.models import DevKitLocus
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class TestTestDevAll:
|
|
11
|
-
def setup_method(self):
|
|
12
|
-
self._filter = TestDevAll()
|
|
13
|
-
|
|
14
|
-
def test_filter_should_be_skipped_when_required_alert_properties_not_satisfied(
|
|
15
|
-
self,
|
|
16
|
-
):
|
|
17
|
-
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
18
|
-
alert = locus_dict_copy["alerts"][-1]
|
|
19
|
-
# Change triggering alert to have no magnitude
|
|
20
|
-
alert["properties"].pop("ant_mag")
|
|
21
|
-
|
|
22
|
-
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
23
|
-
filter_returned = self._filter.run(locus)
|
|
24
|
-
assert filter_returned.status == "Skipped"
|
|
25
|
-
|
|
26
|
-
@pytest.mark.parametrize(
|
|
27
|
-
"survey_name,ant_survey",
|
|
28
|
-
[("ZTF candidate", 1), ("ZTF upper limit", 2), ("DECAT", 3), ("LSST", 4)],
|
|
29
|
-
)
|
|
30
|
-
def test_filter_should_succeed_with_alerts_from_any_survey(
|
|
31
|
-
self,
|
|
32
|
-
survey_name,
|
|
33
|
-
ant_survey,
|
|
34
|
-
):
|
|
35
|
-
# {survey_name} case (variable not used, just descriptive of the case)
|
|
36
|
-
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
37
|
-
alert = locus_dict_copy["alerts"][-1]
|
|
38
|
-
# Change triggering alert to be {survey_name}
|
|
39
|
-
alert["properties"]["ant_survey"] = ant_survey
|
|
40
|
-
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
41
|
-
filter_returned = self._filter.run(locus)
|
|
42
|
-
assert filter_returned.status == "Succeeded"
|
|
43
|
-
|
|
44
|
-
@pytest.mark.parametrize(
|
|
45
|
-
"ant_survey,ant_mag",
|
|
46
|
-
[(1, 16.4), (2, 15.2), (3, 19.5), (4, 19.9)],
|
|
47
|
-
)
|
|
48
|
-
def test_filter_should_add_tag_if_max_mag_not_reached(
|
|
49
|
-
self,
|
|
50
|
-
ant_survey,
|
|
51
|
-
ant_mag,
|
|
52
|
-
):
|
|
53
|
-
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
54
|
-
alert = locus_dict_copy["alerts"][-1]
|
|
55
|
-
alert["properties"]["ant_survey"] = ant_survey
|
|
56
|
-
alert["properties"]["ant_mag"] = ant_mag
|
|
57
|
-
|
|
58
|
-
locus = DevKitLocus.model_validate(large_locus_dict)
|
|
59
|
-
self._filter.run(locus)
|
|
60
|
-
assert self._filter.OUTPUT_LOCUS_TAGS[0]["name"] in locus.tags
|
|
61
|
-
|
|
62
|
-
@pytest.mark.parametrize(
|
|
63
|
-
"ant_survey,ant_mag",
|
|
64
|
-
[(1, 20), (2, 24.2), (3, 20.1), (4, 31.5)],
|
|
65
|
-
)
|
|
66
|
-
def test_filter_should_not_add_tag_if_max_mag_reached(
|
|
67
|
-
self,
|
|
68
|
-
ant_survey,
|
|
69
|
-
ant_mag,
|
|
70
|
-
):
|
|
71
|
-
locus_dict_copy = copy.deepcopy(large_locus_dict)
|
|
72
|
-
alert = locus_dict_copy["alerts"][-1]
|
|
73
|
-
alert["properties"]["ant_survey"] = ant_survey
|
|
74
|
-
alert["properties"]["ant_mag"] = ant_mag
|
|
75
|
-
|
|
76
|
-
locus = DevKitLocus.model_validate(locus_dict_copy)
|
|
77
|
-
self._filter.run(locus)
|
|
78
|
-
assert self._filter.OUTPUT_LOCUS_TAGS[0]["name"] not in locus.tags
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/bad_detection/__init__.py
RENAMED
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/bad_seeing/__init__.py
RENAMED
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/crash_filter/__init__.py
RENAMED
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/desi_target/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/ecl_transient_1/__init__.py
RENAMED
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/ecl_transient_2/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/highfluxchange/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/lantern/data/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/microlensing/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/nuclear_transient/__init__.py
RENAMED
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/nuttela_tao/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/persistent_dimmers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/recent_reddening/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/sample_filter/__init__.py
RENAMED
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/shadow_virgo/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/superphot_plus_v1/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/test_dev_all/__init__.py
RENAMED
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/test_dev_lsst/__init__.py
RENAMED
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/antares_devkit/filters/test_dev_ztf/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{antares_devkit-0.9.2 → antares_devkit-0.10.1}/test/unit/antares_devkit/filters/test_test_dev_ztf.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|