removed contamination array from the map dict
This commit is contained in:
parent
c144285f88
commit
90b938a934
42
views.py
42
views.py
@ -436,37 +436,37 @@ class UpperLimitView(APIView):
|
|||||||
# fetch those pixels for the requested surveys
|
# fetch those pixels for the requested surveys
|
||||||
# summing counts and sorting by hpid
|
# 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 = (
|
map_pixels_qs = (
|
||||||
Pixel.objects.filter(hpid__in=map_pixel_list, survey__in=survey_numbers)
|
Pixel.objects.filter(hpid__in=map_pixel_list, survey__in=survey_numbers)
|
||||||
.values("hpid")
|
.values("hpid")
|
||||||
.annotate(
|
.annotate(counts=Sum("counts"))
|
||||||
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")
|
.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
|
# turn the queryset to a list
|
||||||
map_pixels_list = list(map_pixels_qs)
|
map_pixels_list = list(map_pixels_qs)
|
||||||
|
|
||||||
# get lists of healpix indices and count values
|
# get lists of healpix indices and count values
|
||||||
map_healpix_list = [d["hpid"] for d in map_pixels_list]
|
map_healpix_list = [d["hpid"] for d in map_pixels_list]
|
||||||
map_counts_list = [d["total_counts"] 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]
|
# map_contaminated_list = [d["contaminated"] for d in map_pixels_list]
|
||||||
|
|
||||||
# cont_dict = dict(
|
# cont_dict = dict(
|
||||||
# Pixel.objects.filter(hpid__in=map_healpix_list, survey__in=survey_numbers)
|
# Pixel.objects.filter(hpid__in=map_healpix_list, survey__in=survey_numbers)
|
||||||
@ -486,7 +486,7 @@ class UpperLimitView(APIView):
|
|||||||
map_dict = {
|
map_dict = {
|
||||||
"healpix": map_healpix_list,
|
"healpix": map_healpix_list,
|
||||||
"counts": map_counts_list,
|
"counts": map_counts_list,
|
||||||
"contaminated": map_contaminated_list,
|
# "contaminated": map_contaminated_list,
|
||||||
"nside": map_nside,
|
"nside": map_nside,
|
||||||
"order": map_order,
|
"order": map_order,
|
||||||
"radius_as": map_radius,
|
"radius_as": map_radius,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user