srg/astrobasis/management/commands/00_status_gaia.py
2024-04-26 12:43:00 +03:00

53 lines
1.5 KiB
Python

from django.core.management.base import BaseCommand, CommandError
from datetime import date
from heasarc.models import INPUT_DATA_DIR
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
import numpy.ma as ma
from astrobasis.models import GaiaSourceFileDR3, GAIADR3
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 os
import glob
import logging
class Command(BaseCommand):
help = 'Initiates data dase'
def handle(self, *args, **options):
total_empty=GaiaSourceFileDR3.objects.filter(status__exact='empty').count()
print("Empty %d" % total_empty)
total_ready=GaiaSourceFileDR3.objects.filter(status__exact='ready').count()
print("Ready %d" % total_ready)
total_loaded=GaiaSourceFileDR3.objects.filter(status__exact='loaded').count()
print("Loaded %d" % total_loaded)
total_healpix=GaiaSourceFileDR3.objects.filter(status__exact='healpix').count()
print("Healpix %d" % total_healpix)
total=GaiaSourceFileDR3.objects.count()
print("Total %d = %d" % (total, total_empty+total_loaded+total_healpix))
#total=GAIADR3.objects.count()
#print("Total Gaia %d" % total)
return