From 90b938a9348a8d351a7d8d35bf64453b1e149de2 Mon Sep 17 00:00:00 2001 From: tyrin Date: Tue, 27 May 2025 12:42:02 +0300 Subject: [PATCH] removed contamination array from the map dict --- views.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/views.py b/views.py index e626adc..5ec1f34 100644 --- a/views.py +++ b/views.py @@ -436,37 +436,37 @@ class UpperLimitView(APIView): # fetch those pixels for the requested surveys # summing counts and sorting by hpid - # map_pixels_qs = ( - # Pixel.objects.filter(hpid__in=map_pixel_list, survey__in=survey_numbers) - # .values("hpid") - # .annotate(counts=Sum("counts")) - # .order_by("hpid") - # ) - map_pixels_qs = ( Pixel.objects.filter(hpid__in=map_pixel_list, survey__in=survey_numbers) .values("hpid") - .annotate( - total_counts=Sum("counts"), - max_contaminated_int=Max(Cast("contaminated", IntegerField())), - ) - .annotate( - contaminated=Case( - When(max_contaminated_int=1, then=Value(True)), - default=Value(False), - output_field=BooleanField(), - ) - ) + .annotate(counts=Sum("counts")) .order_by("hpid") ) + # map_pixels_qs = ( + # Pixel.objects.filter(hpid__in=map_pixel_list, survey__in=survey_numbers) + # .values("hpid") + # .annotate( + # total_counts=Sum("counts"), + # max_contaminated_int=Max(Cast("contaminated", IntegerField())), + # ) + # .annotate( + # contaminated=Case( + # When(max_contaminated_int=1, then=Value(True)), + # default=Value(False), + # output_field=BooleanField(), + # ) + # ) + # .order_by("hpid") + # ) + # turn the queryset to a list map_pixels_list = list(map_pixels_qs) # get lists of healpix indices and count values map_healpix_list = [d["hpid"] for d in map_pixels_list] - map_counts_list = [d["total_counts"] for d in map_pixels_list] - map_contaminated_list = [d["contaminated"] 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) @@ -486,7 +486,7 @@ class UpperLimitView(APIView): map_dict = { "healpix": map_healpix_list, "counts": map_counts_list, - "contaminated": map_contaminated_list, + # "contaminated": map_contaminated_list, "nside": map_nside, "order": map_order, "radius_as": map_radius,