Skip to content

Commit

Permalink
Add method to filter datapoints to positive ZTF detections.
Browse files Browse the repository at this point in the history
  • Loading branch information
wombaugh committed Oct 16, 2022
1 parent b68c040 commit 5de9ea2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ampel/ztf/view/ZTFT2Tabulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@


class ZTFT2Tabulator(AbsT2Tabulator):
def filter_detections(
self, dps: Iterable[DataPoint]
) -> Iterable[DataPoint]:
return [dp for dp in dps
if 'ZTF' in dp['tag'] and 'magpsf' in dp['body'].keys() ]

def get_flux_table(
self,
dps: Iterable[DataPoint],
) -> Table:
magpsf, sigmapsf, jd, fids, magzpsci, isdiffpos = self.get_values(
dps, ["magpsf", "sigmapsf", "jd", "fid", "magzpsci", "isdiffpos"]
self.filter_detections(dps),
["magpsf", "sigmapsf", "jd", "fid", "magzpsci", "isdiffpos"]
)
filter_names = [ZTF_BANDPASSES[fid]["name"] for fid in fids]
signs = [signdict[el] for el in isdiffpos]
Expand All @@ -60,8 +67,9 @@ def get_flux_table(
def get_positions(
self, dps: Iterable[DataPoint]
) -> Sequence[tuple[float, float, float]]:
det_dps = self.filter_detections(dps)
return tuple(
zip(self.get_jd(dps), *self.get_values(dps, ["ra", "dec"]))
zip(self.get_jd(det_dps), *self.get_values(det_dps, ["ra", "dec"]))
)

def get_jd(
Expand Down

0 comments on commit 5de9ea2

Please sign in to comment.