housekeeping

This commit is contained in:
2025-10-03 09:56:54 +03:00
parent cc88de2c69
commit b246ead973
5 changed files with 12 additions and 18 deletions

View File

@@ -1,3 +1,5 @@
# uplim/admin.py
from django.contrib import admin from django.contrib import admin
# Register your models here. # Register your models here.

View File

@@ -1,6 +1,8 @@
# uplim/apps.py
from django.apps import AppConfig from django.apps import AppConfig
class AxcUlConfig(AppConfig): class AxcUlConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField' default_auto_field = "django.db.models.BigAutoField"
name = 'uplim' name = "uplim"

View File

@@ -1,3 +1,5 @@
# uplim/tests.py
from django.test import TestCase from django.test import TestCase
# Create your tests here. # Create your tests here.

View File

@@ -1,3 +1,5 @@
# uplim/utils/decorators.py
import time import time
from functools import wraps from functools import wraps
from rest_framework.response import Response from rest_framework.response import Response

View File

@@ -1,7 +1,6 @@
# uplim/views.py # uplim/views.py
# from astropy_healpix import HEALPix does not have an option to # from astropy_healpix import HEALPix does not have an option to search for pixels non-inclusively so we have to use healpy
# search for pixels non-inclusively
import healpy as hp import healpy as hp
import astropy.units as u import astropy.units as u
import numpy as np import numpy as np
@@ -679,7 +678,7 @@ class StackedUpperLimitView(APIView):
or annulus_pixels.filter(contaminated=True).exists() or annulus_pixels.filter(contaminated=True).exists()
) )
# exclude contaminated pixels from the background and source regions # exclude contaminated pixels from the background regions
annulus_pixels = annulus_pixels.exclude(contaminated=True) annulus_pixels = annulus_pixels.exclude(contaminated=True)
# source_pixels = source_pixels.exclude(contaminated=True) # source_pixels = source_pixels.exclude(contaminated=True)
@@ -914,10 +913,6 @@ class StackedUpperLimitView(APIView):
# iterate over source vectors, making maps # iterate over source vectors, making maps
# # Create a single list to hold all Healpix IDs
# all_map_pixels = []
# source_indices = []
hpid_to_source_indices_map = defaultdict(list) hpid_to_source_indices_map = defaultdict(list)
# Iterate over source vectors and get all unique Healpix IDs # Iterate over source vectors and get all unique Healpix IDs
@@ -950,15 +945,6 @@ class StackedUpperLimitView(APIView):
map_exposure_list = [] map_exposure_list = []
map_source_indices_list = [] map_source_indices_list = []
# # 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["counts"] for d in map_pixels_list]
# map_exposure_list = [d["exposure"] for d in map_pixels_list]
# # map_contaminated_list = [d["contaminated"] for d in map_pixels_list]
for hpid, source_indices in hpid_to_source_indices_map.items(): for hpid, source_indices in hpid_to_source_indices_map.items():
# Check if this pixel was actually found in the database query # Check if this pixel was actually found in the database query
if hpid in db_results_map: if hpid in db_results_map: