background pixels with contaminated=True are removed from background calculation
This commit is contained in:
parent
fdc26bc4c4
commit
ada05dd34b
11
views.py
11
views.py
@ -209,7 +209,7 @@ class UpperLimitView(APIView):
|
||||
)
|
||||
|
||||
annulus_pixels = Pixel.objects.filter(
|
||||
hpid__in=annulus_pixel_list, survey__in=survey_numbers
|
||||
hpid__in=annulus_pixel_list, survey__in=survey_numbers, contaminated=False
|
||||
)
|
||||
|
||||
# check contamination
|
||||
@ -218,9 +218,14 @@ class UpperLimitView(APIView):
|
||||
or annulus_pixels.filter(contaminated=True).exists()
|
||||
)
|
||||
|
||||
if not source_pixels.exists() and not annulus_pixels.exists():
|
||||
# exclude contaminated pixels from the background calculations
|
||||
annulus_pixels = annulus_pixels.exclude(contaminated=True)
|
||||
|
||||
if not source_pixels.exists() or not annulus_pixels.exists():
|
||||
return Response(
|
||||
{"detail": "No pixel data for the given survey selection."},
|
||||
{
|
||||
"detail": "No background and/or source pixel data for the given survey selection."
|
||||
},
|
||||
status=status.HTTP_404_NOT_FOUND,
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user