From e2d0afa4c513110178907a2f46492880e4e252f6 Mon Sep 17 00:00:00 2001 From: tyrin Date: Tue, 27 May 2025 10:57:23 +0300 Subject: [PATCH] added separation to nearby sources, set nearby source search radius to 2x map radius --- views.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/views.py b/views.py index 763ba1d..f1b1b09 100644 --- a/views.py +++ b/views.py @@ -167,6 +167,13 @@ class UpperLimitView(APIView): map_radius_value = request.query_params.get("mr") + # default value if not specified in the query + # get hpids within a circle of radius sqrt(2) * outer annulus radius + if map_radius_value is None: + map_radius = annulus_outer * np.sqrt(2) + else: + map_radius = float(map_radius_value) + # CREATE SKYCOORD, CONVERT TO GALACTIC BECAUSE THE HEALPIX # MAP ITSELF WAS MADE IN GALACTIC COORDINATES # ************************************************************** @@ -362,7 +369,7 @@ class UpperLimitView(APIView): # NEARBY SOURCES CHECK # **************************************************************** - radius_as = 120 + radius_as = map_radius * 2 radius_deg = radius_as / 3600 dec_min = max(dec - radius_deg, -90) @@ -384,7 +391,8 @@ class UpperLimitView(APIView): # refine belt to circular region using astropy separation for catsrc in belt_sources: catsrc_coord = SkyCoord(catsrc.ra_deg, catsrc.dec_deg, unit="deg") - if center_coord.separation(catsrc_coord).deg > radius_deg: + separation = center_coord.separation(catsrc_coord).deg + if separation > radius_deg: continue f = catsrc.flux or 0.0 for lb in reversed(sorted_bounds): @@ -406,19 +414,13 @@ class UpperLimitView(APIView): "new_xray": catsrc.new_xray, "source_type": catsrc.source_type, "mask_radius_deg": mask_radius, + "separation_deg": separation, } ) # REGION IMAGE SERVING # **************************************************************** - # default value if not specified in the query - # get hpids within a circle of radius sqrt(2) * outer annulus radius - if map_radius_value is None: - map_radius = annulus_outer * np.sqrt(2) - else: - map_radius = float(map_radius_value) - map_pixel_list = hp.query_disc( nside=4096, vec=src_vec,