more apps
This commit is contained in:
36
artsurvey/management/commands/01_artsurvey_heasarc.py
Normal file
36
artsurvey/management/commands/01_artsurvey_heasarc.py
Normal file
@@ -0,0 +1,36 @@
|
||||
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 find_counterparts
|
||||
|
||||
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=2.3
|
||||
|
||||
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()
|
||||
find_counterparts(srcs, HeasarcBase.objects.all(),'heasarc',minrad=40,verbose=True)
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
||||
Reference in New Issue
Block a user