Removed Survey model, it is now a field in the Pixel model; all code rewritten for the change; added set_contaminated management command to set the source contamination flag; added CatalogSource model for the art-xc source catalog storage, the table is filled by the set_contaminated management script; the upper limit view now outputs extra fields, including a list of sources and their properties within 120 arcseconds
This commit is contained in:
@@ -5,7 +5,7 @@ from astropy.io import fits
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import transaction
|
||||
from uplim.models import Pixel, Survey
|
||||
from uplim.models import Pixel#, Survey
|
||||
from django.db.models import Max
|
||||
|
||||
from itertools import islice
|
||||
@@ -109,32 +109,34 @@ class Command(BaseCommand):
|
||||
# CREATE THE SURVEY IF IT DOES NOT EXIST
|
||||
# **************************************************************
|
||||
|
||||
with transaction.atomic():
|
||||
# with transaction.atomic():
|
||||
|
||||
survey,created = Survey.objects.get_or_create(number=survey_number)
|
||||
# survey,created = Survey.objects.get_or_create(number=survey_number)
|
||||
|
||||
if created:
|
||||
self.stdout.write(f"Created a new survey instance with number: {survey.number}")
|
||||
else:
|
||||
self.stdout.write(f"Using existing survey instance with the number: {survey.number}")
|
||||
# if created:
|
||||
# self.stdout.write(f"Created a new survey instance with number: {survey.number}")
|
||||
# else:
|
||||
# self.stdout.write(f"Using existing survey instance with the number: {survey.number}")
|
||||
|
||||
# FETCH THE LAST PROCESSED HPID AND CONTINUE FROM IT
|
||||
# **************************************************************
|
||||
|
||||
last_hpid = (
|
||||
Pixel.objects
|
||||
.filter(survey=survey)
|
||||
.filter(survey=survey_number)
|
||||
.aggregate(max_hpid=Max('hpid'))['max_hpid']
|
||||
or -1
|
||||
)
|
||||
start_index = last_hpid + 1
|
||||
|
||||
|
||||
|
||||
pixel_generator = (
|
||||
Pixel(
|
||||
hpid=i,
|
||||
counts=int(count),
|
||||
exposure=float(exposure),
|
||||
survey=survey
|
||||
survey=survey_number
|
||||
)
|
||||
for i, (count, exposure) in enumerate(zip(counts_data, exposure_data))
|
||||
if i >= start_index
|
||||
|
Reference in New Issue
Block a user