changed from using Max aggregatio to a separate query for the contamination status

This commit is contained in:
Никита Тырин 2025-05-26 17:28:40 +03:00
parent a36163f731
commit 42c63547b1

View File

@ -412,7 +412,6 @@ class UpperLimitView(APIView):
.values("hpid")
.annotate(
counts=Sum("counts"),
contaminated=Max("contaminated"),
)
.order_by("hpid")
)
@ -423,7 +422,14 @@ class UpperLimitView(APIView):
# get lists of healpix indices and count values
map_healpix_list = [d["hpid"] for d in map_pixels_list]
map_counts_list = [d["counts"] for d in map_pixels_list]
map_contaminated_list = [d["contaminated"] for d in map_pixels_list]
cont_dict = dict(
Pixel.objects.filter(hpid__in=map_healpix_list, survey__in=survey_numbers)
.values_list("hpid", "contaminated")
.distinct()
)
map_contaminated_list = [cont_dict[h] for h in map_healpix_list]
# set map nside
map_nside = 4096