srg/heasarc/management/commands/00_heasarcbase_match.py
2024-04-25 17:50:51 +03:00

34 lines
1.1 KiB
Python

from django.core.management.base import BaseCommand, CommandError
import time
from astrobasis.models import VLASS
from astrobasis.models import GLIMPSE
from astrobasis.models import GAIADR3
from astrobasis.models import TwoMASS
from astrobasis.models import AllWise
from heasarc.utils import heasarcbase_match
from heasarc.models import Heasarc4XMMDR12
class Command(BaseCommand):
help = 'Initiates data dase'
def handle(self, *args, **options):
start_time = time.time()
heasarcbase_match(VLASS.objects.all(),"vlass", survey=Heasarc4XMMDR12)
heasarcbase_match(GLIMPSE.objects.all(),"glimpse", survey=Heasarc4XMMDR12)
heasarcbase_match(GAIADR3.objects.all(),"gaia3", survey=Heasarc4XMMDR12)
heasarcbase_match(TwoMASS.objects.all(),"twomass", survey=Heasarc4XMMDR12)
heasarcbase_match(AllWise.objects.all(),"allwise", survey=Heasarc4XMMDR12)
hours = (time.time() - start_time)/60/60
print("--- {:.2f} hours ---".format(hours))
self.stdout.write(self.style.SUCCESS('Done'))