From d6900bed1035440e2ae31ed7431abc6efbf6e70e Mon Sep 17 00:00:00 2001 From: simeonreusch Date: Wed, 18 Aug 2021 16:15:44 +0200 Subject: [PATCH] pretty date in GCN draft --- nuztf/ampel_magic.py | 32 +++++++++++++------------------- tests/test_neutrino_scanner.py | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/nuztf/ampel_magic.py b/nuztf/ampel_magic.py index 2d334965..762310c1 100644 --- a/nuztf/ampel_magic.py +++ b/nuztf/ampel_magic.py @@ -448,29 +448,23 @@ def parse_candidates(self): def draft_gcn(self): + first_obs_dt = self.first_obs.datetime + pretty_date = first_obs_dt.strftime('%Y-%m-%d') + pretty_time = first_obs_dt.strftime('%H:%M') + text = ( - "Astronomer Name (Institute of Somewhere), ............. report,\n" - "On behalf of the Zwicky Transient Facility (ZTF) and Global Relay of Observatories Watching Transients Happen (GROWTH) collaborations: \n" - "We observed the localization region of the {0} with the Palomar 48-inch telescope, equipped with the 47 square degree ZTF camera (Bellm et al. 2019, Graham et al. 2019). {1}" - "We started observations in the g-band and r-band beginning at {2} UTC, " - "approximately {3:.1f} hours after event time. {4}" - "{5} \n \n" + f"Astronomer Name (Institute of Somewhere), ............. report,\n" + f"On behalf of the Zwicky Transient Facility (ZTF) and Global Relay of Observatories Watching Transients Happen (GROWTH) collaborations: \n" + f"We observed the localization region of the {self.get_full_name()} with the Palomar 48-inch telescope, equipped with the 47 square degree ZTF camera (Bellm et al. 2019, Graham et al. 2019). {self.get_tiling_line()}" + f"We started observations in the g-band and r-band beginning at {pretty_date} {pretty_time} UTC, " + f"approximately {(self.first_obs.jd - self.t_min.jd) * 24.0:.1f} hours after event time. {self.get_overlap_line()}" + f"{self.get_obs_line()} \n \n" "The images were processed in real-time through the ZTF reduction and image subtraction pipelines at IPAC to search for potential counterparts (Masci et al. 2019). " "AMPEL (Nordin et al. 2019, Stein et al. 2021) was used to search the alerts database for candidates. " "We reject stellar sources (Tachibana and Miller 2018) and moving objects, and " - "apply machine learning algorithms (Mahabal et al. 2019) {6}. We are left with the following high-significance transient " + f"apply machine learning algorithms (Mahabal et al. 2019) {self.remove_variability_line()}. We are left with the following high-significance transient " "candidates by our pipeline, all lying within the " - "{7}% localization of the skymap. \n\n{8} \n\n".format( - self.get_full_name(), - self.get_tiling_line(), - self.first_obs.utc, - (self.first_obs.jd - self.t_min.jd) * 24.0, - self.get_overlap_line(), - self.get_obs_line(), - self.remove_variability_line(), - 100 * self.prob_threshold, - self.parse_candidates(), - ) + f"{100 * self.prob_threshold}% localization of the skymap.\n\n{self.parse_candidates()} \n\n" ) if self.dist: @@ -482,7 +476,7 @@ def draft_gcn(self): else: pass - text += "Amongst our candidates, \n{0}. \n \n".format(self.text_summary()) + text += "Amongst our candidates, \n{0}\n \n".format(self.text_summary()) text += ( "ZTF and GROWTH are worldwide collaborations comprising Caltech, USA; IPAC, USA; WIS, Israel; OKC, Sweden; JSI/UMd, USA; DESY, Germany; TANGO, Taiwan; UW Milwaukee, USA; LANL, USA; TCD, Ireland; IN2P3, France.\n\n" diff --git a/tests/test_neutrino_scanner.py b/tests/test_neutrino_scanner.py index b871128c..27151713 100644 --- a/tests/test_neutrino_scanner.py +++ b/tests/test_neutrino_scanner.py @@ -33,7 +33,7 @@ def test_scan(self): res = nu.draft_gcn() # Update the true using repr(res) - true_gcn = "Astronomer Name (Institute of Somewhere), ............. report,\nOn behalf of the Zwicky Transient Facility (ZTF) and Global Relay of Observatories Watching Transients Happen (GROWTH) collaborations: \nWe observed the localization region of the neutrino event IceCube-200620A (Santander et. al, GCN 27997) with the Palomar 48-inch telescope, equipped with the 47 square degree ZTF camera (Bellm et al. 2019, Graham et al. 2019). We started observations in the g-band and r-band beginning at 2020-06-21T04:53:57.415 UTC, approximately 25.8 hours after event time. We covered 1.2 sq deg, corresponding to 77.7% of the reported localization region. This estimate accounts for chip gaps. Each exposure was 300s with a typical depth of 21.0 mag. \n \nThe images were processed in real-time through the ZTF reduction and image subtraction pipelines at IPAC to search for potential counterparts (Masci et al. 2019). AMPEL (Nordin et al. 2019, Stein et al. 2021) was used to search the alerts database for candidates. We reject stellar sources (Tachibana and Miller 2018) and moving objects, and apply machine learning algorithms (Mahabal et al. 2019) . We are left with the following high-significance transient candidates by our pipeline, all lying within the 90.0% localization of the skymap. \n\n+--------------------------------------------------------------------------------+\n| ZTF Name | IAU Name | RA (deg) | DEC (deg) | Filter | Mag | MagErr |\n+--------------------------------------------------------------------------------+\n| ZTF18acvhwtf | AT2020ncs | 162.0678527 | +12.1263986 | r | 20.11 | 0.16 | (MORE THAN ONE DAY SINCE SECOND DETECTION) \n| ZTF20abgvabi | AT2020ncr | 162.5306341 | +12.1461187 | g | 20.58 | 0.19 | (MORE THAN ONE DAY SINCE SECOND DETECTION) \n+--------------------------------------------------------------------------------+\n\n \n\nAmongst our candidates, \nZTF18acvhwtf was first detected on 2458461.9815278. It has a spec-z of 0.291 [1548 Mpc] and an abs. mag of -20.8. Distance to SDSS galaxy is 0.52 arcsec. \nZTF20abgvabi was first detected on 2458995.6705903. \n. \n \nZTF and GROWTH are worldwide collaborations comprising Caltech, USA; IPAC, USA; WIS, Israel; OKC, Sweden; JSI/UMd, USA; DESY, Germany; TANGO, Taiwan; UW Milwaukee, USA; LANL, USA; TCD, Ireland; IN2P3, France.\n\nGROWTH acknowledges generous support of the NSF under PIRE Grant No 1545949.\nAlert distribution service provided by DIRAC@UW (Patterson et al. 2019).\nAlert database searches are done by AMPEL (Nordin et al. 2019).\nAlert filtering is performed with the AMPEL Follow-up Pipeline (Stein et al. 2021).\n" + true_gcn = "Astronomer Name (Institute of Somewhere), ............. report,\nOn behalf of the Zwicky Transient Facility (ZTF) and Global Relay of Observatories Watching Transients Happen (GROWTH) collaborations: \nWe observed the localization region of the neutrino event IceCube-200620A (Santander et. al, GCN 27997) with the Palomar 48-inch telescope, equipped with the 47 square degree ZTF camera (Bellm et al. 2019, Graham et al. 2019). We started observations in the g-band and r-band beginning at 2020-06-21 04:53 UTC, approximately 25.8 hours after event time. We covered 1.2 sq deg, corresponding to 77.7% of the reported localization region. This estimate accounts for chip gaps. Each exposure was 300s with a typical depth of 21.0 mag. \n \nThe images were processed in real-time through the ZTF reduction and image subtraction pipelines at IPAC to search for potential counterparts (Masci et al. 2019). AMPEL (Nordin et al. 2019, Stein et al. 2021) was used to search the alerts database for candidates. We reject stellar sources (Tachibana and Miller 2018) and moving objects, and apply machine learning algorithms (Mahabal et al. 2019) . We are left with the following high-significance transient candidates by our pipeline, all lying within the 90.0% localization of the skymap.\n\n+--------------------------------------------------------------------------------+\n| ZTF Name | IAU Name | RA (deg) | DEC (deg) | Filter | Mag | MagErr |\n+--------------------------------------------------------------------------------+\n| ZTF18acvhwtf | AT2020ncs | 162.0678527 | +12.1263986 | r | 20.11 | 0.16 | (MORE THAN ONE DAY SINCE SECOND DETECTION) \n| ZTF20abgvabi | AT2020ncr | 162.5306341 | +12.1461187 | g | 20.58 | 0.19 | (MORE THAN ONE DAY SINCE SECOND DETECTION) \n+--------------------------------------------------------------------------------+\n\n \n\nAmongst our candidates, \nZTF18acvhwtf was first detected on 2458461.9815278. It has a spec-z of 0.291 [1548 Mpc] and an abs. mag of -20.8. Distance to SDSS galaxy is 0.52 arcsec. \nZTF20abgvabi was first detected on 2458995.6705903.\n \nZTF and GROWTH are worldwide collaborations comprising Caltech, USA; IPAC, USA; WIS, Israel; OKC, Sweden; JSI/UMd, USA; DESY, Germany; TANGO, Taiwan; UW Milwaukee, USA; LANL, USA; TCD, Ireland; IN2P3, France.\n\nGROWTH acknowledges generous support of the NSF under PIRE Grant No 1545949.\nAlert distribution service provided by DIRAC@UW (Patterson et al. 2019).\nAlert database searches are done by AMPEL (Nordin et al. 2019).\nAlert filtering is performed with the AMPEL Follow-up Pipeline (Stein et al. 2021).\n" self.assertEqual( res,