From 15829b4a8c0af195575a19fd82490876444e3fb4 Mon Sep 17 00:00:00 2001 From: Robert David Stein Date: Thu, 16 May 2024 20:38:26 -0700 Subject: [PATCH] Gaiapm (#427) --- nuztf/cat_match.py | 27 +++++++++++++++++++++++++-- nuztf/skymap_scanner.py | 7 +++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/nuztf/cat_match.py b/nuztf/cat_match.py index 2349953..2bc7aff 100644 --- a/nuztf/cat_match.py +++ b/nuztf/cat_match.py @@ -109,9 +109,14 @@ def ampel_api_tns( return full_name, discovery_date, source_group -def get_cross_match_info(raw: dict, logger=None): - """ """ +def get_cross_match_info(raw: dict, logger=None) -> str: + """ + Function to get cross-match info for a given alert + :param raw: Raw alert data + :param logger: Logger + :return: String with cross-match info + """ cache_file = CROSSMATCH_CACHE.joinpath(f"{raw['objectId']}.json") if cache_file.exists(): @@ -184,6 +189,7 @@ def get_cross_match_info(raw: dict, logger=None): logger=logger, ) if res is not None: + if res[0]["body"]["Plx"] is not None: plx_sig = res[0]["body"]["Plx"] / res[0]["body"]["ErrPlx"] if plx_sig > 3.0: @@ -192,6 +198,23 @@ def get_cross_match_info(raw: dict, logger=None): f"({res[0]['dist_arcsec']:.2f} arsec)]" ) + elif res[0]["body"]["PMRA"] is not None: + pmra_sig = abs(res[0]["body"]["PMRA"] / res[0]["body"]["ErrPMRA"]) + if pmra_sig > 3.0: + label = ( + f"[GAIADR2: {pmra_sig:.1f}-sigma proper motion (RA) " + f"({res[0]['dist_arcsec']:.2f} arsec)]" + ) + elif res[0]["body"]["PMDec"] is not None: + pmdec_sig = abs( + res[0]["body"]["PMDec"] / res[0]["body"]["ErrPMDec"] + ) + if pmdec_sig > 3.0: + label = ( + f"[GAIADR2: {pmdec_sig:.1f}-sigma proper motion (Dec) " + f"({res[0]['dist_arcsec']:.2f} arsec)]" + ) + # Check if classified as probable star in SDSS if label == "": diff --git a/nuztf/skymap_scanner.py b/nuztf/skymap_scanner.py index 7189bea..3e84994 100644 --- a/nuztf/skymap_scanner.py +++ b/nuztf/skymap_scanner.py @@ -427,6 +427,13 @@ def unpack_skymap(self, output_nside: None | int = None): mask = self.skymap.data[self.skymap.key] > self.skymap.pixel_threshold + max_pix = max(self.skymap.data[self.skymap.key]) + idx_max = list(self.skymap.data[self.skymap.key]).index(max_pix) + + ra, dec = self.extract_ra_dec(nside, idx_max) + + self.logger.info(f"hottest_pixel: {ra} {dec}") + map_coords = [] pixel_nos = []