from django.core.management.base import BaseCommand, CommandError from datetime import date import datetime from django.utils import timezone import astropy from astropy.io import ascii import pandas as pd import pymysql from sqlalchemy import create_engine from heasarc.tdat import tDat from heasarc.models import HeasarcTable, TableColumn, HeasarcObjectClass, NSIDE_SOURCES, ORDER from srgcat.models import ArtCat, ArtSource from astropy.table import Table from astropy_healpix import HEALPix from astropy.coordinates import SkyCoord # High-level coordinates from astropy.coordinates import ICRS, Galactic, FK4, FK5 # Low-level frames from astropy.coordinates import Angle, Latitude, Longitude # Angles import astropy.units as u import logging from astropy.io import fits from django.db.models import Q from datetime import datetime from astropy.time import Time from astropy.io import fits from srgcat.models import SkyMaps, SrgDataDump, SkyMapSource from monthplan.models import SurveyHealpixPlate from srglib.utils import TZ_MSK, load_srg_data_dumps, make_source_name, load_simbad_sources from srglib.utils import find_heasarc_counterparts, update_all_skymap_sources_counterparts, load_skymap_sources_dir from srglib.utils import mark_new_skymap_sources_in_latest, clean_skymap_sources, update_allsky_missed from srglib.utils import load_skymap_sources_for_artsurvey from srglib.utils import update_skymap_sources_for_artsurvey import glob import os import logging class Command(BaseCommand): help = 'Initiates data dase' def handle(self, *args, **options): logging.getLogger().setLevel(logging.DEBUG) path='/srg/work/oper/staff/kate/skymap/catalog' """ load_skymap_sources_for_artsurvey("{}/1y_cat_0.fits".format(path),'S12.E0',force=True) load_skymap_sources_for_artsurvey("{}/1y_cat_1.fits".format(path),'S12.E1',force=True) load_skymap_sources_for_artsurvey("{}/1y_cat_2.fits".format(path),'S12.E2',force=True) load_skymap_sources_for_artsurvey("{}/1y_cat_3.fits".format(path),'S12.E3',force=True) load_skymap_sources_for_artsurvey("{}/1y_cat_4.fits".format(path),'S12.E4',force=True) load_skymap_sources_for_artsurvey("{}/1h_cat_0.fits".format(path),'S1.E0',force=True) load_skymap_sources_for_artsurvey("{}/1h_cat_1.fits".format(path),'S1.E1',force=True) load_skymap_sources_for_artsurvey("{}/1h_cat_2.fits".format(path),'S1.E2',force=True) load_skymap_sources_for_artsurvey("{}/1h_cat_3.fits".format(path),'S1.E3',force=True) load_skymap_sources_for_artsurvey("{}/1h_cat_4.fits".format(path),'S1.E4',force=True) load_skymap_sources_for_artsurvey("{}/2h_cat_0.fits".format(path),'S2.E0',force=True) load_skymap_sources_for_artsurvey("{}/2h_cat_1.fits".format(path),'S2.E1',force=True) load_skymap_sources_for_artsurvey("{}/2h_cat_2.fits".format(path),'S2.E2',force=True) load_skymap_sources_for_artsurvey("{}/2h_cat_3.fits".format(path),'S2.E3',force=True) load_skymap_sources_for_artsurvey("{}/2h_cat_4.fits".format(path),'S2.E4',force=True) """ """ update_skymap_sources_for_artsurvey("{}/1y_cat_0.fits".format(path),'S12.E0') update_skymap_sources_for_artsurvey("{}/1y_cat_1.fits".format(path),'S12.E1') update_skymap_sources_for_artsurvey("{}/1y_cat_2.fits".format(path),'S12.E2') update_skymap_sources_for_artsurvey("{}/1y_cat_3.fits".format(path),'S12.E3') update_skymap_sources_for_artsurvey("{}/1y_cat_4.fits".format(path),'S12.E4') update_skymap_sources_for_artsurvey("{}/1h_cat_0.fits".format(path),'S1.E0') update_skymap_sources_for_artsurvey("{}/1h_cat_1.fits".format(path),'S1.E1') update_skymap_sources_for_artsurvey("{}/1h_cat_2.fits".format(path),'S1.E2') update_skymap_sources_for_artsurvey("{}/1h_cat_3.fits".format(path),'S1.E3') update_skymap_sources_for_artsurvey("{}/1h_cat_4.fits".format(path),'S1.E4') update_skymap_sources_for_artsurvey("{}/2h_cat_0.fits".format(path),'S2.E0') update_skymap_sources_for_artsurvey("{}/2h_cat_1.fits".format(path),'S2.E1') update_skymap_sources_for_artsurvey("{}/2h_cat_2.fits".format(path),'S2.E2') update_skymap_sources_for_artsurvey("{}/2h_cat_3.fits".format(path),'S2.E3') update_skymap_sources_for_artsurvey("{}/2h_cat_4.fits".format(path),'S2.E4') """ #load_skymap_sources_for_artsurvey("{}/15y_cat_0.fits".format(path),'S123.E0',force=True) #load_skymap_sources_for_artsurvey("{}/2y_cat_0.fits".format(path),'S1-4.E0',force=True) #load_skymap_sources_for_artsurvey("{}/3h_cat_0.fits".format(path),'S3.E0',force=True) #load_skymap_sources_for_artsurvey("{}/4h_cat_0.fits".format(path),'S4.E0',force=True) #load_skymap_sources_for_artsurvey("{}/34h_cat_0.fits".format(path),'S34.E0',force=True) #load_skymap_sources_for_artsurvey("{}/5h_cat_0.fits".format(path),'S5.E0',force=True) load_skymap_sources_for_artsurvey("{}/22y_cat_0.fits".format(path),'S1-5.E0',force=True) self.stdout.write(self.style.SUCCESS('Done'))