srg/artsurvey/management/commands/05_artsurvey_first.py
2024-04-26 12:43:00 +03:00

38 lines
1.0 KiB
Python

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.models import HeasarcBase
from artsurvey.models import ArtSurveySource, ArtSurvey
from srglib.utils import load_vizier_first
class Command(BaseCommand):
help = 'Initiates data dase'
# def add_arguments(self, parser):
# parser.add_argument('poll_id', nargs='+', type=int)
def handle(self, *args, **options):
survey_version=12.0
try:
survey = ArtSurvey.objects.get(version=survey_version)
except ArtSurvey.DoesNotExist:
print("ArtSurvey {} not found".format(survey_version))
return
print("use ArtSurvey {}".format(survey))
srcs = survey.artsurveysource_set.all()
load_vizier_first(srcs, minrad=40, maxdist=120)
self.stdout.write(self.style.SUCCESS('Done'))