added separation to nearby sources, set nearby source search radius to 2x map radius

This commit is contained in:
Никита Тырин 2025-05-27 10:57:23 +03:00
parent e01941f06b
commit e2d0afa4c5

View File

@ -167,6 +167,13 @@ class UpperLimitView(APIView):
map_radius_value = request.query_params.get("mr") 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 # CREATE SKYCOORD, CONVERT TO GALACTIC BECAUSE THE HEALPIX
# MAP ITSELF WAS MADE IN GALACTIC COORDINATES # MAP ITSELF WAS MADE IN GALACTIC COORDINATES
# ************************************************************** # **************************************************************
@ -362,7 +369,7 @@ class UpperLimitView(APIView):
# NEARBY SOURCES CHECK # NEARBY SOURCES CHECK
# **************************************************************** # ****************************************************************
radius_as = 120 radius_as = map_radius * 2
radius_deg = radius_as / 3600 radius_deg = radius_as / 3600
dec_min = max(dec - radius_deg, -90) dec_min = max(dec - radius_deg, -90)
@ -384,7 +391,8 @@ class UpperLimitView(APIView):
# refine belt to circular region using astropy separation # refine belt to circular region using astropy separation
for catsrc in belt_sources: for catsrc in belt_sources:
catsrc_coord = SkyCoord(catsrc.ra_deg, catsrc.dec_deg, unit="deg") 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 continue
f = catsrc.flux or 0.0 f = catsrc.flux or 0.0
for lb in reversed(sorted_bounds): for lb in reversed(sorted_bounds):
@ -406,19 +414,13 @@ class UpperLimitView(APIView):
"new_xray": catsrc.new_xray, "new_xray": catsrc.new_xray,
"source_type": catsrc.source_type, "source_type": catsrc.source_type,
"mask_radius_deg": mask_radius, "mask_radius_deg": mask_radius,
"separation_deg": separation,
} }
) )
# REGION IMAGE SERVING # 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( map_pixel_list = hp.query_disc(
nside=4096, nside=4096,
vec=src_vec, vec=src_vec,