HEASARC
This commit is contained in:
0
heasarc/__init__.py
Normal file
0
heasarc/__init__.py
Normal file
9
heasarc/admin.py
Normal file
9
heasarc/admin.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from heasarc.models import HeasarcTable, HeasarcSimpleClass
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(HeasarcTable)
|
||||
admin.site.register(HeasarcSimpleClass)
|
||||
|
5
heasarc/apps.py
Normal file
5
heasarc/apps.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class HeasarcConfig(AppConfig):
|
||||
name = 'heasarc'
|
34
heasarc/management/commands/00_clean_gaia.py
Normal file
34
heasarc/management/commands/00_clean_gaia.py
Normal file
@@ -0,0 +1,34 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcBase, HeasarcGAIADR2, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
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):
|
||||
|
||||
tables = HeasarcGAIADR2.objects.all()
|
||||
tables.delete()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
149
heasarc/management/commands/00_heasarc_2sxps.py
Normal file
149
heasarc/management/commands/00_heasarc_2sxps.py
Normal file
@@ -0,0 +1,149 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, Heasarc2SXPS, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
from astropy.time import Time, TimezoneInfo
|
||||
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
data = astropy.table.Table.read(filename, format='ascii.csv',encoding='latin1')
|
||||
|
||||
"""
|
||||
keywords = data.meta['keywords']
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
"""
|
||||
|
||||
tables = Heasarc2SXPS.objects.all()
|
||||
tables.delete()
|
||||
|
||||
utc_moscow = TimezoneInfo(utc_offset=3*u.hour)
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
tm = Time(item['FirstObsDate'], format='iso', scale='utc')
|
||||
FirstObsDate_dt = tm.to_datetime(timezone=utc_moscow)
|
||||
|
||||
tm = Time(item['LastObsDate'], format='iso', scale='utc')
|
||||
LastObsDate_dt = tm.to_datetime(timezone=utc_moscow)
|
||||
|
||||
tm = Time(item['FirstDetDate'], format='iso', scale='utc')
|
||||
FirstDetDate_dt = tm.to_datetime(timezone=utc_moscow)
|
||||
|
||||
tm = Time(item['LastDetDate'], format='iso', scale='utc')
|
||||
LastDetDate_dt = tm.to_datetime(timezone=utc_moscow)
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
if not (ma.is_masked(item['RA']) or ma.is_masked(item['Decl'])):
|
||||
ra = float(item['RA'])
|
||||
dec = float(item['Decl'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
else:
|
||||
continue
|
||||
|
||||
obj = Heasarc2SXPS.objects.create(healpix=healpix,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii=item['l'],
|
||||
bii=item['b'],
|
||||
error_radius=item['Err90'],
|
||||
name=item['IAUName'],
|
||||
Exposure = item['Exposure'],
|
||||
LastObsDate = LastObsDate_dt,
|
||||
FirstObsDate = FirstObsDate_dt,
|
||||
FirstDetDate = FirstDetDate_dt,
|
||||
LastDetDate = LastDetDate_dt,
|
||||
BestDetectionID = item['BestDetectionID'],
|
||||
DetFlag = item['DetFlag'],
|
||||
Rate_band0 = item['Rate_band0'],
|
||||
Rate_band0_pos = item['Rate_band0_pos'],
|
||||
Rate_band0_neg = item['Rate_band0_neg'],
|
||||
Rate_band1 = item['Rate_band1'],
|
||||
Rate_band1_pos = item['Rate_band1_pos'],
|
||||
Rate_band1_neg = item['Rate_band1_neg'],
|
||||
Rate_band2 = item['Rate_band2'],
|
||||
Rate_band2_pos = item['Rate_band2_pos'],
|
||||
Rate_band2_neg = item['Rate_band2_neg'],
|
||||
Rate_band3 = item['Rate_band3'],
|
||||
Rate_band3_pos = item['Rate_band3_pos'],
|
||||
Rate_band3_neg = item['Rate_band3_neg'],
|
||||
PeakRate_band0_pos = item['PeakRate_band0_pos'],
|
||||
PeakRate_band0_neg = item['PeakRate_band0_neg'],
|
||||
PeakRate_band1 = item['PeakRate_band1'],
|
||||
PeakRate_band1_pos = item['PeakRate_band1_pos'],
|
||||
PeakRate_band1_neg = item['PeakRate_band1_neg'],
|
||||
PeakRate_band2 = item['PeakRate_band2'],
|
||||
PeakRate_band2_pos = item['PeakRate_band2_pos'],
|
||||
PeakRate_band2_neg = item['PeakRate_band2_neg'],
|
||||
PeakRate_band3 = item['PeakRate_band3'],
|
||||
PeakRate_band3_pos = item['PeakRate_band3_pos'],
|
||||
PeakRate_band3_neg = item['PeakRate_band3_neg'],
|
||||
PowFlux =item['PowFlux'],
|
||||
PowFlux_pos= item['PowFlux_pos'],
|
||||
PowFlux_neg= item['PowFlux_neg'],
|
||||
APECFlux= item['APECFlux'],
|
||||
APECFlux_pos= item['APECFlux_pos'],
|
||||
APECFlux_neg= item['APECFlux_neg'],
|
||||
PowPeakFlux=item['PowPeakFlux'],
|
||||
PowPeakFlux_pos=item['PowPeakFlux_pos'],
|
||||
PowPeakFlux_neg=item['PowPeakFlux_neg'],
|
||||
FittedPowNH=item['FittedPowNH'],
|
||||
FittedPowRedChi=item['FittedPowReducedChi2'],
|
||||
FittedAPECNH=item['FittedAPECNH'],
|
||||
FittedAPECRedChi =item['FittedAPECReducedChi2'])
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('/data/2SXPS/2SXPS_Sources.csv.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
85
heasarc/management/commands/00_heasarc_3maxi.py
Normal file
85
heasarc/management/commands/00_heasarc_3maxi.py
Normal file
@@ -0,0 +1,85 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, Heasarc3MAXI, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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
|
||||
from astropy.io import fits
|
||||
import math
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
"""
|
||||
['Seq', '3MAXI', 'RAdeg', 'DEdeg', 'ePos', 's4-10keV', 'F4-10keV', 'e_F4-10keV', 's3-4keV', 'F3-4keV', 'l_F3-4keV', 'e_F3-4keV', 's10-20keV', 'F10-20keV', 'l_F10-20keV', 'e_F10-20keV', 'F3-10keV', 'e_F3-10keV', 'HR1', 'e_HR1', 'HR2', 'e_HR2', 'HR3', 'e_HR3', 'TSVar', 'XVA', 'e_XVA']
|
||||
"""
|
||||
|
||||
hdul = fits.open(filename)
|
||||
data = hdul[1].data
|
||||
cols = hdul[1].columns
|
||||
print(cols.names)
|
||||
|
||||
#tables = HeasarcSwiftBAT105m.objects.all()
|
||||
#tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
for item in data:
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
lon = 0.0
|
||||
lat = 0.0
|
||||
if not (ma.is_masked(item['RAdeg']) or ma.is_masked(item['DEdeg'])):
|
||||
ra = float(item['RAdeg'])
|
||||
dec = float(item['DEdeg'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
lon = crd.galactic.l.value
|
||||
lat = crd.galactic.b.value
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
else:
|
||||
continue
|
||||
|
||||
sign=item['s4-10keV']
|
||||
|
||||
obj = Heasarc3MAXI.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii = lon,
|
||||
bii = lat,
|
||||
name="3MAXI {}".format(item['3MAXI']),
|
||||
error_radius = float(item['ePos'])*60*60,
|
||||
sign = sign,
|
||||
flux = float(item['F4-10keV']),)
|
||||
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initiates data dase'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
load_heasarc_table('/data/VizieR/3MAXI/table1.fits')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
149
heasarc/management/commands/00_heasarc_4xmm.py
Normal file
149
heasarc/management/commands/00_heasarc_4xmm.py
Normal file
@@ -0,0 +1,149 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, Heasarc4XMMDR12, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
|
||||
|
||||
data = astropy.table.Table.read(filename, format='ascii.csv',encoding='latin1')
|
||||
print(data.info)
|
||||
|
||||
"""
|
||||
keywords = data.meta['keywords']
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
,0.525479,0,,-0.523192,,,0,56086.7429513889,56087.5881944444,,,1,f,http://xmm-catalog.irap.omp.eu/source/206931901010113/
|
||||
|
||||
"""
|
||||
|
||||
|
||||
tables = Heasarc4XMMDR12.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
url=''
|
||||
if not (ma.is_masked(item['webpage_url'])):
|
||||
url=item['webpage_url']
|
||||
|
||||
n_detections=0
|
||||
if not (ma.is_masked(item['n_detections'])):
|
||||
m_detections=item['n_detections']
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
lon = 0.0
|
||||
lat = 0.0
|
||||
if not (ma.is_masked(item['sc_ra']) or ma.is_masked(item['sc_dec'])):
|
||||
ra = float(item['sc_ra'])
|
||||
dec = float(item['sc_dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
lon = crd.galactic.l.value
|
||||
lat = crd.galactic.b.value
|
||||
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
else:
|
||||
continue
|
||||
|
||||
obj = Heasarc4XMMDR12.objects.create(healpix=healpix,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii = lon,
|
||||
bii = lat,
|
||||
name=item['iauname'],
|
||||
error_radius = item['sc_poserr'],
|
||||
SRCID = item['srcid'],
|
||||
radec_error = item['sc_poserr'],
|
||||
DET_ML = item['sc_det_ml'],
|
||||
EP_1_FLUX = item['sc_ep_1_flux'],
|
||||
EP_1_FLUX_ERR = item['sc_ep_1_flux_err'],
|
||||
EP_2_FLUX= item['sc_ep_2_flux'],
|
||||
EP_2_FLUX_ERR =item['sc_ep_2_flux_err'],
|
||||
EP_3_FLUX = item['sc_ep_3_flux'],
|
||||
EP_3_FLUX_ERR = item['sc_ep_3_flux_err'],
|
||||
EP_4_FLUX = item['sc_ep_4_flux'],
|
||||
EP_4_FLUX_ERR = item['sc_ep_4_flux_err'],
|
||||
EP_5_FLUX = item['sc_ep_5_flux'],
|
||||
EP_5_FLUX_ERR = item['sc_ep_5_flux_err'],
|
||||
EP_8_FLUX = item['sc_ep_8_flux'],
|
||||
EP_8_FLUX_ERR = item['sc_ep_8_flux_err'],
|
||||
EP_9_FLUX = item['sc_ep_9_flux'],
|
||||
EP_9_FLUX_ERR = item['sc_ep_9_flux_err'],
|
||||
HR1 = item['sc_hr1'],
|
||||
HR1_ERR = item['sc_hr1_err'],
|
||||
HR2 = item['sc_hr2'],
|
||||
HR2_ERR = item['sc_hr2_err'],
|
||||
HR3 = item['sc_hr3'],
|
||||
HR3_ERR = item['sc_hr3_err'],
|
||||
HR4 = item['sc_hr4'],
|
||||
HR4_ERR = item['sc_hr4_err'],
|
||||
EXTENT = item['sc_extent'],
|
||||
EXT_ERR = item['sc_ext_err'],
|
||||
#EXT_ML = item['sc_ext_ml'],
|
||||
#CHI2PROB = item['sc_chi2prob'],
|
||||
FVAR = item['sc_fvar'],
|
||||
FVARERR = item['sc_fvarerr'],
|
||||
#VAR_FLAG = item['sc_var_flag'],
|
||||
SUM_FLAG = item['sc_sum_flag'],
|
||||
EP_8_FMIN = item['sc_ep_8_fmin'],
|
||||
EP_8_FMIN_ERR = item['sc_ep_8_fmin_err'],
|
||||
EP_8_FMAX = item['sc_ep_8_fmax'],
|
||||
EP_8_FMAX_ERR = item['sc_ep_8_fmax_err'],
|
||||
MJD_FIRST = item['mjd_first'],
|
||||
MJD_LAST = item['mjd_last'],
|
||||
N_DETECTIONS = n_detections,
|
||||
CONFUSED = item['confused'],
|
||||
WEBPAGE_URL = url,)
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
tables = Heasarc4XMMDR12.objects.all()
|
||||
|
||||
print("Selected {} in total".format(tables.count()))
|
||||
|
||||
#load_heasarc_table('/data/4XMM/4XMM_DR9cat_slim_v1.0.csv.gz')
|
||||
#load_heasarc_table('/data/4XMM/4XMM_DR10cat_slim_v1.0.csv.gz')
|
||||
load_heasarc_table('/data/4XMM/4XMM_DR12cat_slim_v1.0.csv.gz')
|
||||
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
158
heasarc/management/commands/00_heasarc_4xmm_print.py
Normal file
158
heasarc/management/commands/00_heasarc_4xmm_print.py
Normal file
@@ -0,0 +1,158 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, Heasarc4XMMDR9, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
|
||||
|
||||
data = astropy.table.Table.read(filename, format='ascii.csv',encoding='latin1')
|
||||
print(data.info)
|
||||
|
||||
"""
|
||||
keywords = data.meta['keywords']
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
,0.525479,0,,-0.523192,,,0,56086.7429513889,56087.5881944444,,,1,f,http://xmm-catalog.irap.omp.eu/source/206931901010113/
|
||||
|
||||
"""
|
||||
|
||||
tables = Heasarc4XMMDR9.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
url=''
|
||||
if not (ma.is_masked(item['webpage_url'])):
|
||||
url=item['webpage_url']
|
||||
|
||||
n_detections=0
|
||||
if not (ma.is_masked(item['n_detections'])):
|
||||
url=item['n_detections']
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
lon = 0.0
|
||||
lat = 0.0
|
||||
if not (ma.is_masked(item['sc_ra']) or ma.is_masked(item['sc_dec'])):
|
||||
ra = float(item['sc_ra'])
|
||||
dec = float(item['sc_dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
lon = crd.galactic.l.value
|
||||
lat = crd.galactic.b.value
|
||||
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
else:
|
||||
continue
|
||||
|
||||
obj = Heasarc4XMMDR9.objects.create(healpix=healpix,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii = lon,
|
||||
bii = lat,
|
||||
name=item['iauname'],
|
||||
error_radius = item['sc_poserr'],
|
||||
SRCID = item['srcid'],
|
||||
POSERR = item['sc_poserr'],
|
||||
DET_ML = item['sc_det_ml'],
|
||||
EP_1_FLUX = item['sc_ep_1_flux'],
|
||||
EP_1_FLUX_ERR = item['sc_ep_1_flux_err'],
|
||||
EP_2_FLUX= item['sc_ep_2_flux'],
|
||||
EP_2_FLUX_ERR =item['sc_ep_2_flux_err'],
|
||||
EP_3_FLUX = item['sc_ep_3_flux'],
|
||||
EP_3_FLUX_ERR = item['sc_ep_3_flux_err'],
|
||||
EP_4_FLUX = item['sc_ep_4_flux'],
|
||||
EP_4_FLUX_ERR = item['sc_ep_4_flux_err'],
|
||||
EP_5_FLUX = item['sc_ep_5_flux'],
|
||||
EP_5_FLUX_ERR = item['sc_ep_5_flux_err'],
|
||||
EP_8_FLUX = item['sc_ep_8_flux'],
|
||||
EP_8_FLUX_ERR = item['sc_ep_8_flux_err'],
|
||||
EP_9_FLUX = item['sc_ep_9_flux'],
|
||||
EP_9_FLUX_ERR = item['sc_ep_9_flux_err'],
|
||||
HR1 = item['sc_hr1'],
|
||||
HR1_ERR = item['sc_hr1_err'],
|
||||
HR2 = item['sc_hr2'],
|
||||
HR2_ERR = item['sc_hr2_err'],
|
||||
HR3 = item['sc_hr3'],
|
||||
HR3_ERR = item['sc_hr3_err'],
|
||||
HR4 = item['sc_hr4'],
|
||||
HR4_ERR = item['sc_hr4_err'],
|
||||
EXTENT = item['sc_extent'],
|
||||
EXT_ERR = item['sc_ext_err'],
|
||||
#EXT_ML = item['sc_ext_ml'],
|
||||
#CHI2PROB = item['sc_chi2prob'],
|
||||
FVAR = item['sc_fvar'],
|
||||
FVARERR = item['sc_fvarerr'],
|
||||
#VAR_FLAG = item['sc_var_flag'],
|
||||
SUM_FLAG = item['sc_sum_flag'],
|
||||
EP_8_FMIN = item['sc_ep_8_fmin'],
|
||||
EP_8_FMIN_ERR = item['sc_ep_8_fmin_err'],
|
||||
EP_8_FMAX = item['sc_ep_8_fmax'],
|
||||
EP_8_FMAX_ERR = item['sc_ep_8_fmax_err'],
|
||||
MJD_FIRST = item['mjd_first'],
|
||||
MJD_LAST = item['mjd_last'],
|
||||
N_DETECTIONS = n_detections,
|
||||
CONFUSED = item['confused'],
|
||||
WEBPAGE_URL = url,)
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
ra_map=34.577746
|
||||
dec_map=-4.7238375
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
crd = SkyCoord(ra_map, dec_map, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
hlist = hp.cone_search_skycoord(crd,u.Quantity(2.0,unit="deg"))
|
||||
xmm = Heasarc4XMMDR9.objects.all().filter(healpix__in=hlist)
|
||||
for src in xmm:
|
||||
print("fk5;point({}, {}) # point=cross".format(src.ra,src.dec))
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
138
heasarc/management/commands/00_heasarc_allwiseagn.py
Normal file
138
heasarc/management/commands/00_heasarc_allwiseagn.py
Normal file
@@ -0,0 +1,138 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcALLWISEAGN, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat',encoding='latin1')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=keywords['table_author']
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
# convert data frame to pandas
|
||||
# df = data.to_pandas()
|
||||
# sql = 'DROP TABLE IF EXISTS '+table_name+';'
|
||||
# result = engine.execute(sql)
|
||||
# Insert whole DataFrame into MySQL
|
||||
# df.to_sql(table_name, con = engine, if_exists = 'append', chunksize = 200000)
|
||||
|
||||
print("*** Delete all ALLWISEAGN objects ***")
|
||||
tables = HeasarcALLWISEAGN.objects.all()
|
||||
tables.delete()
|
||||
|
||||
print("*** Create new ALLWISEAGN objects ***")
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
redshift_flag=''
|
||||
if not (ma.is_masked(item['redshift_flag'])):
|
||||
redshift_flag=item['redshift_flag']
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
if not (ma.is_masked(item['ra']) or ma.is_masked(item['dec'])):
|
||||
ra = float(item['ra'])
|
||||
dec = float(item['dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
obj = HeasarcALLWISEAGN.objects.create(healpix=healpix,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
name=item['name'],
|
||||
w1w2_color = item['w1w2_color'],
|
||||
w2w3_color = item['w2w3_color'],
|
||||
w1_mag = item['w1_mag'],
|
||||
gmag = item['gmag'],
|
||||
redshift = item['redshift'],
|
||||
redshift_flag = redshift_flag,
|
||||
lqac2_name = item['lqac2_name'],
|
||||
dr12q_name = item['dr12q_name'],
|
||||
milliquas_name = item['milliquas_name'])
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_allwiseagn.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
146
heasarc/management/commands/00_heasarc_chanmaster.py
Normal file
146
heasarc/management/commands/00_heasarc_chanmaster.py
Normal file
@@ -0,0 +1,146 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcCHANMASTER, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat',encoding='latin1')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=keywords['table_author']
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
# convert data frame to pandas
|
||||
# df = data.to_pandas()
|
||||
# sql = 'DROP TABLE IF EXISTS '+table_name+';'
|
||||
# result = engine.execute(sql)
|
||||
# Insert whole DataFrame into MySQL
|
||||
# df.to_sql(table_name, con = engine, if_exists = 'append', chunksize = 200000)
|
||||
|
||||
tables = HeasarcCHANMASTER.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
public_date = 0
|
||||
if not (ma.is_masked(item['public_date'])):
|
||||
public_date = int(item['public_date'])
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
if not (ma.is_masked(item['ra']) or ma.is_masked(item['dec'])):
|
||||
ra = float(item['ra'])
|
||||
dec = float(item['dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
|
||||
obj = HeasarcCHANMASTER.objects.create(healpix=healpix,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
name=item['name'],
|
||||
obsid=item['obsid'],
|
||||
time = float(item['time']),
|
||||
status=item['status'],
|
||||
detector=item['detector'],
|
||||
grating=item['grating'],
|
||||
exposure = float(item['exposure']),
|
||||
obstype=item['type'],
|
||||
pi=item['pi'],
|
||||
cycle = int(item['cycle']),
|
||||
proposal=item['proposal'],
|
||||
public_date = public_date,
|
||||
sequence_number=item['sequence_number'],
|
||||
data_mode=item['data_mode'],
|
||||
category=item['category'],
|
||||
class_id = int(item['class']),)
|
||||
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_chanmaster.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
139
heasarc/management/commands/00_heasarc_csc.py
Normal file
139
heasarc/management/commands/00_heasarc_csc.py
Normal file
@@ -0,0 +1,139 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcCSC, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat',encoding='latin1')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=keywords['table_author']
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
# convert data frame to pandas
|
||||
# df = data.to_pandas()
|
||||
# sql = 'DROP TABLE IF EXISTS '+table_name+';'
|
||||
# result = engine.execute(sql)
|
||||
# Insert whole DataFrame into MySQL
|
||||
# df.to_sql(table_name, con = engine, if_exists = 'append', chunksize = 200000)
|
||||
|
||||
tables = HeasarcCSC.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
conf_flag=''
|
||||
if(item['conf_flag'] == 'NULL'):
|
||||
conf_flag = 'N'
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
if not (ma.is_masked(item['ra']) or ma.is_masked(item['dec'])):
|
||||
ra = float(item['ra'])
|
||||
dec = float(item['dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
obj = HeasarcCSC.objects.create(healpix=healpix,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
name=item['name'],
|
||||
significance=item['significance'],
|
||||
extent_flag=item['extent_flag'],
|
||||
conf_flag=conf_flag,
|
||||
error_ellipse_r0=item['error_ellipse_r0'],
|
||||
error_ellipse_r1=item['error_ellipse_r1'],
|
||||
error_ellipse_angle=item['error_ellipse_angle'],
|
||||
b_flux_ap=item['b_flux_ap'],
|
||||
b_flux_ap_hi=item['b_flux_ap_hi'],
|
||||
b_flux_ap_lo=item['b_flux_ap_lo'],
|
||||
m_flux_ap=item['m_flux_ap'],
|
||||
m_flux_ap_hi=item['m_flux_ap_hi'],
|
||||
m_flux_ap_lo=item['m_flux_ap_lo'],
|
||||
s_flux_ap = item['s_flux_ap'],
|
||||
s_flux_ap_hi = item['s_flux_ap_hi'],
|
||||
m_photflux_ap=item['m_photflux_ap'],
|
||||
m_photflux_ap_hi=item['m_photflux_ap_hi'],
|
||||
m_photflux_ap_lo=item['m_photflux_ap_lo'],
|
||||
s_photflux_ap=item['s_photflux_ap'],
|
||||
s_photflux_ap_hi=item['s_photflux_ap_hi'],
|
||||
s_photflux_ap_lo=item['s_photflux_ap_lo'],)
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_csc.tdat.gz')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
110
heasarc/management/commands/00_heasarc_fermi.py
Normal file
110
heasarc/management/commands/00_heasarc_fermi.py
Normal file
@@ -0,0 +1,110 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
import math, sys
|
||||
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, Heasarc4FGL, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
|
||||
#sys.exit()
|
||||
tables = Heasarc4FGL.objects.all()
|
||||
tables.delete()
|
||||
|
||||
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
for item in data:
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
|
||||
if not (ma.is_masked(item['semi_major_axis_68']) or ma.is_masked(item['semi_minor_axis_68'])):
|
||||
sx=float(item['semi_major_axis_68'])*3600
|
||||
sy=float(item['semi_minor_axis_68'])*3600
|
||||
else:
|
||||
continue
|
||||
|
||||
error_radius = max(sx,sy)
|
||||
|
||||
name=item['name']
|
||||
|
||||
koeff=1.42 # Paper I
|
||||
|
||||
R68=math.sqrt(-2*math.log(1-0.68))
|
||||
R95=math.sqrt(-2*math.log(1-0.95))
|
||||
R98=math.sqrt(-2*math.log(1-0.98))
|
||||
|
||||
obj = Heasarc4FGL.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
error_radius=error_radius*R98,
|
||||
name=item['name'],
|
||||
flux=item['energy_flux'],sign=item['detection_significance'],)
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_fermilpsc.tdat.gz')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
216
heasarc/management/commands/00_heasarc_gaia.py
Normal file
216
heasarc/management/commands/00_heasarc_gaia.py
Normal file
@@ -0,0 +1,216 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcBase, HeasarcGAIADR2
|
||||
from heasarc.models import HeasarcObjectClass, GaiaSourceFile
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
from django.db import DatabaseError, transaction
|
||||
|
||||
import os
|
||||
import glob
|
||||
import logging
|
||||
|
||||
def load_heasarc_table_atomic(filepath):
|
||||
|
||||
filename_w_ext = os.path.basename(filepath)
|
||||
filename, file_extension = os.path.splitext(filename_w_ext)
|
||||
|
||||
#print(filename_w_ext)
|
||||
|
||||
try:
|
||||
gaia = GaiaSourceFile.objects.get(filename=filename)
|
||||
print("Gaia: %s is already loaded, skip" % filename)
|
||||
return 0
|
||||
except GaiaSourceFile.DoesNotExist:
|
||||
print("Gaia: %s is not loaded" % filename)
|
||||
pass
|
||||
|
||||
gaia = GaiaSourceFile(filename=filename)
|
||||
gaia.save()
|
||||
|
||||
return
|
||||
|
||||
data = astropy.table.Table.read(filepath, format='ascii.csv',encoding='latin1')
|
||||
print(data.info)
|
||||
|
||||
tables = HeasarcGAIADR2.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
|
||||
try:
|
||||
with transaction.atomic():
|
||||
for item in data:
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
obj = HeasarcGAIADR2.objects.create(healpix=healpix,
|
||||
error_radius = max(item['ra_error'], item['dec_error']),
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii = item['l'],
|
||||
bii = item['b'],
|
||||
name=item['designation'],
|
||||
solution_id = item['solution_id'],
|
||||
source_id = item['source_id'],
|
||||
ref_epoch = item['ref_epoch'],
|
||||
ra_error = item['ra_error'],
|
||||
dec_error = item['dec_error'],
|
||||
parallax = item['parallax'],
|
||||
parallax_error = item['parallax_error'],
|
||||
pmra = item['pmra'],
|
||||
pmra_error = item['pmra_error'],
|
||||
pmdec = item['pmdec'],
|
||||
pmdec_error = item['pmdec_error'],
|
||||
phot_g_mean_mag = item['phot_g_mean_mag'],
|
||||
phot_bp_mean_mag = item['phot_bp_mean_mag'],
|
||||
phot_rp_mean_mag = item['phot_rp_mean_mag'])
|
||||
obj.save()
|
||||
|
||||
except DatabaseError:
|
||||
print('--> Database error "%s"' % filename)
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
data = astropy.table.Table.read(filename, format='ascii.csv',encoding='latin1')
|
||||
print(data.info)
|
||||
|
||||
tables = HeasarcGAIADR2.objects.all()
|
||||
tables.delete()
|
||||
|
||||
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
lon = 0.0
|
||||
lat = 0.0
|
||||
if not (ma.is_masked(item['ra']) or ma.is_masked(item['dec'])):
|
||||
ra = float(item['ra'])
|
||||
dec = float(item['dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
else:
|
||||
continue
|
||||
|
||||
obj = HeasarcGAIADR2.objects.create(healpix=healpix,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii = item['l'],
|
||||
bii = item['b'],
|
||||
name=item['designation'],
|
||||
solution_id = item['solution_id'],
|
||||
source_id = item['source_id'],
|
||||
ref_epoch = item['ref_epoch'],
|
||||
ra_error = item['ra_error'],
|
||||
dec_error = item['dec_error'],
|
||||
parallax = item['parallax'],
|
||||
parallax_error = item['parallax_error'],
|
||||
pmra = item['pmra'],
|
||||
pmra_error = item['pmra_error'],
|
||||
pmdec = item['pmdec'],
|
||||
pmdec_error = item['pmdec_error'],
|
||||
phot_g_mean_mag = item['phot_g_mean_mag'],
|
||||
phot_bp_mean_mag = item['phot_bp_mean_mag'],
|
||||
phot_rp_mean_mag = item['phot_rp_mean_mag'])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
def load_heasarc_table_bulk(filename):
|
||||
data = astropy.table.Table.read(filename, format='ascii.csv',encoding='latin1')
|
||||
print(data.info)
|
||||
|
||||
tables = HeasarcGAIADR2.objects.all()
|
||||
tables.delete()
|
||||
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
|
||||
|
||||
batch_size = 200
|
||||
objs = (HeasarcGAIADR2(ra=data[i]['ra'],
|
||||
dec=data[i]['dec'],
|
||||
name=data[i]['designation'],
|
||||
solution_id = data[i]['solution_id'],
|
||||
source_id = data[i]['source_id'],
|
||||
ref_epoch = data[i]['ref_epoch'],
|
||||
ra_error = data[i]['ra_error'],
|
||||
dec_error = data[i]['dec_error'],
|
||||
parallax = data[i]['parallax'],
|
||||
parallax_error = data[i]['parallax_error'],
|
||||
pmra = data[i]['pmra'],
|
||||
pmra_error = data[i]['pmra_error'],
|
||||
pmdec = data[i]['pmdec'],
|
||||
pmdec_error = data[i]['pmdec_error'],
|
||||
phot_g_mean_mag = data[i]['phot_g_mean_mag'],
|
||||
phot_bp_mean_mag = data[i]['phot_bp_mean_mag'],
|
||||
phot_rp_mean_mag = data[i]['phot_rp_mean_mag'],)
|
||||
for i in range(len(data)))
|
||||
|
||||
HeasarcBase.objects.bulk_create(objs,batch_size)
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
#load_heasarc_table_atomic('/data/Gaia/gaia_source/csv/GaiaSource_970579492690449408_970786789287579392.csv.gz')
|
||||
|
||||
files = []
|
||||
for file in glob.glob("/data/Gaia/gaia_source/csv/*.csv.gz"):
|
||||
files.append(file)
|
||||
|
||||
for file in files:
|
||||
print("Loading ",file)
|
||||
load_heasarc_table_atomic(file)
|
||||
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
36
heasarc/management/commands/00_heasarc_healpix_plate.py
Normal file
36
heasarc/management/commands/00_heasarc_healpix_plate.py
Normal file
@@ -0,0 +1,36 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcBase, HeasarcTable, TableColumn, HeasarcIntegral9, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initiates data dase'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
srcs = HeasarcBase.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
106
heasarc/management/commands/00_heasarc_integral2020.py
Normal file
106
heasarc/management/commands/00_heasarc_integral2020.py
Normal file
@@ -0,0 +1,106 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcIntegral2020, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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 math
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
|
||||
|
||||
data = astropy.table.Table.read(filename,format='ascii.csv')
|
||||
print(data.info)
|
||||
|
||||
tables = HeasarcIntegral2020.objects.all()
|
||||
tables.delete()
|
||||
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
lon = 0.0
|
||||
lat = 0.0
|
||||
|
||||
ra = float(item['RA'])
|
||||
dec = float(item['Dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
lon = crd.galactic.l.value
|
||||
lat = crd.galactic.b.value
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
|
||||
|
||||
sign=item['SIGN']
|
||||
#error_radius = math.sqrt((30.5/sign)**2 + 0.1*0.1)
|
||||
""" See Eq. 1 in 2018ApJS..235....4O """
|
||||
|
||||
error_radius = 2.1*60
|
||||
|
||||
"""
|
||||
if(sign <= 10):
|
||||
error_radius = 2.1*60
|
||||
elif(sign > 10 and sign <= 20):
|
||||
error_radius = 1.5*60
|
||||
else:
|
||||
error_radius = 0.8*60
|
||||
"""
|
||||
#print(ra,dec,sign,error_radius)
|
||||
#continue
|
||||
|
||||
P=0.98
|
||||
koeff=math.sqrt(-2*math.log(1-P))
|
||||
""" makes 90% interval for 2D case """
|
||||
|
||||
obj = HeasarcIntegral2020.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii = lon,
|
||||
bii = lat,
|
||||
name=item['NAME'],
|
||||
error_radius = error_radius*koeff,
|
||||
sign = item['SIGN'],
|
||||
flux = float(item['FLUX']),
|
||||
flux_error = float(item['ERR']),
|
||||
ref_id = int(item['ID']))
|
||||
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initiates data dase'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
load_heasarc_table('/export/django/srg/data/integral2020/e0017_0060.joint_20210818-112734.csv')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
110
heasarc/management/commands/00_heasarc_intibisgal.py
Normal file
110
heasarc/management/commands/00_heasarc_intibisgal.py
Normal file
@@ -0,0 +1,110 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcIntegral9, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
tables = HeasarcIntegral9.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
for item in data:
|
||||
class_id=9999
|
||||
if item['class'] != '':
|
||||
class_id = int(item['class'])
|
||||
try:
|
||||
object_class = HeasarcObjectClass.objects.get(class_id=class_id)
|
||||
except:
|
||||
print("HeasarcObjectClass not found for class_id=", class_id)
|
||||
object_class=None
|
||||
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
print(item['name'], healpix_plate)
|
||||
obj = HeasarcIntegral9.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
error_radius=240,
|
||||
name=item['name'],
|
||||
source_type=item['source_type'],
|
||||
flux=item['flux'],
|
||||
flux_error=item['flux'],
|
||||
class_id=class_id,
|
||||
object_class=object_class)
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_intibisgal.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXrayMaster.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
107
heasarc/management/commands/00_heasarc_intrefcat.py
Normal file
107
heasarc/management/commands/00_heasarc_intrefcat.py
Normal file
@@ -0,0 +1,107 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcIntRefCat, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
tables = HeasarcIntRefCat.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
for item in data:
|
||||
class_id=9999
|
||||
if item['class'] != '':
|
||||
class_id = int(item['class'])
|
||||
try:
|
||||
object_class = HeasarcObjectClass.objects.get(class_id=class_id)
|
||||
except:
|
||||
print("HeasarcObjectClass not found for class_id=", class_id)
|
||||
object_class=None
|
||||
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
|
||||
obj = HeasarcIntRefCat.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
error_radius=item['error_radius'],
|
||||
name=item['name'],
|
||||
class_id=class_id,
|
||||
object_class=object_class)
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_intrefcat.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXrayMaster.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
125
heasarc/management/commands/00_heasarc_match_gaia3.py
Normal file
125
heasarc/management/commands/00_heasarc_match_gaia3.py
Normal file
@@ -0,0 +1,125 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.paginator import Paginator
|
||||
|
||||
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
|
||||
|
||||
from multiprocessing import Pool, cpu_count
|
||||
|
||||
from datetime import date
|
||||
import datetime
|
||||
import time
|
||||
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_nvss
|
||||
from srglib.utils import load_vizier_first
|
||||
from srglib.utils import load_vizier_sumss
|
||||
|
||||
from astrobasis.models import GAIADR3
|
||||
from astrobasis.models import GLIMPSE
|
||||
|
||||
from srglib.utils import find_counterparts
|
||||
from srglib.utils import load_vizier_allwise
|
||||
from srglib.utils import load_simbad_for_skymap_sources
|
||||
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
NPARTS=10
|
||||
|
||||
def do_match():
|
||||
|
||||
minrad=5
|
||||
maxdist=30
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
|
||||
"""
|
||||
g=GLIMPSE.objects.all()
|
||||
g2=g.filter(healpix__exact=0)
|
||||
print("Total {} healpix=NULL {}".format(g.count(),g2.count()))
|
||||
print(g2[0].ra,g2[0].dec,g2[0].healpix)
|
||||
return
|
||||
"""
|
||||
|
||||
srcs = HeasarcBase.objects.all().filter(error_radius__lte=minrad)#.order_by("-id")
|
||||
|
||||
|
||||
pages = Paginator(srcs, 100000)
|
||||
pages_count = pages.count
|
||||
pages_num = pages.num_pages
|
||||
pages_range = pages.page_range
|
||||
|
||||
gaia3_all = GAIADR3.objects.all()
|
||||
|
||||
for i in pages_range:
|
||||
page = pages.page(i)
|
||||
start_time0 = time.time()
|
||||
for src in page.object_list:
|
||||
crd = SkyCoord(src.ra, src.dec, frame="fk5", unit="deg")
|
||||
heal = hp.cone_search_skycoord(crd, radius=maxdist*u.arcsecond)
|
||||
|
||||
src.gaia3.clear()
|
||||
try:
|
||||
gaia3_all_cone = gaia3_all.filter(healpix__in=heal)
|
||||
except:
|
||||
continue
|
||||
gaia_list=[]
|
||||
gaia_crd_cone = SkyCoord(gaia3_all_cone.values_list('ra', flat=True),
|
||||
gaia3_all_cone.values_list('dec', flat=True),
|
||||
frame="fk5", unit="deg")
|
||||
sep_cone = crd.separation(gaia_crd_cone).arcsecond
|
||||
isel = (sep_cone <= minrad)
|
||||
|
||||
index=0
|
||||
for gaia in gaia3_all_cone:
|
||||
#gaia_crd = SkyCoord(gaia.ra, gaia.dec, frame="fk5", unit="deg")
|
||||
#sep=crd.separation(gaia_crd).arcsecond
|
||||
if(isel[index]):
|
||||
gaia_list.append(gaia)
|
||||
index=index+1
|
||||
|
||||
if(gaia_list):
|
||||
src.gaia3.add(*gaia_list)
|
||||
|
||||
elapsed = time.time() - start_time0
|
||||
estimated = (elapsed*(pages_num-i))/60/60
|
||||
print("Page {}/{} for {:.2f} sec, est. {:.2f} hours".format(i,pages_num,elapsed,estimated))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#load_simbad_for_skymap_sources(srcs,minrad=minrad,maxdist=maxdist)
|
||||
#load_vizier_allwise(srcs, minrad=minrad, maxdist=maxdist)
|
||||
#load_vizier_nvss(srcs, minrad=minrad, maxdist=maxdist)
|
||||
#load_vizier_first(srcs, minrad=minrad, maxdist=maxdist)
|
||||
#load_vizier_sumss(srcs, minrad=minrad, maxdist=maxdist)
|
||||
#find_counterparts(srcs, GAIADR3.objects.all(), "gaia3", maxdist=maxdist, minrad=minrad)
|
||||
#for src in srcs:
|
||||
# src.heasarc.clear()
|
||||
|
||||
#find_counterparts(srcs, GAIADR3.objects.all(),'gaia3', maxdist=maxdist, minrad=minrad)
|
||||
#find_counterparts(srcs, GLIMPSE.objects.all(),'glimpse', maxdist=maxdist, minrad=minrad)
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initiates data dase'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
do_match()
|
||||
hours = (time.time() - start_time)/60/60
|
||||
print("--- {:.2f} hours ---".format(hours))
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
||||
|
111
heasarc/management/commands/00_heasarc_maxi7yr.py
Normal file
111
heasarc/management/commands/00_heasarc_maxi7yr.py
Normal file
@@ -0,0 +1,111 @@
|
||||
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, math
|
||||
from astropy.io import ascii
|
||||
import pandas as pd
|
||||
import pymysql
|
||||
from sqlalchemy import create_engine
|
||||
import numpy.ma as ma
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcMAXI7YR, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
|
||||
|
||||
tables = HeasarcMAXI7YR.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
for item in data:
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
"""
|
||||
this is correct only for 1 dimention
|
||||
|
||||
erf(1.65/sqrt(2)) corresponds to 90%
|
||||
|
||||
Чтобы получить 90% из 1 сигма, надо использовать коэффициент 1.42 (sqrt(4.61/2.3))
|
||||
|
||||
"""
|
||||
P=0.98
|
||||
koeff=math.sqrt(-2*math.log(1-P))
|
||||
sign = float(item['detsig_4_10'])
|
||||
error_radius_1sigma=4800/sign
|
||||
if not (ma.is_masked(item['error_radius'])):
|
||||
error_radius_1sigma=float(item['error_radius'])
|
||||
|
||||
#if (ma.is_masked(item['error_radius'])):
|
||||
print("{} {} {} --> {}".format(item['name'], item['error_radius'], item['catalog'], error_radius_1sigma*koeff))
|
||||
|
||||
"""
|
||||
We save 90% confidence interval for error_radius
|
||||
"""
|
||||
obj = HeasarcMAXI7YR.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
error_radius=error_radius_1sigma*koeff,
|
||||
name=item['name'],
|
||||
flux=item['flux_4_10'],sign=item['detsig_4_10'],)
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_maxigsc7yr.tdat.gz')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
143
heasarc/management/commands/00_heasarc_maxigschgl.py
Normal file
143
heasarc/management/commands/00_heasarc_maxigschgl.py
Normal file
@@ -0,0 +1,143 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcMAXIGSCHGL, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat',encoding='latin1')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table_author = (keywords['table_author'][:36]) if len(keywords['table_author']) > 36 else keywords['table_author']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=table_author
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
print("*** Delete all MAXI objects ***")
|
||||
tables = HeasarcMAXIGSCHGL.objects.all()
|
||||
tables.delete()
|
||||
|
||||
print("*** Create new MAXI objects ***")
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
class_id = int(item['class'])
|
||||
try:
|
||||
object_class = HeasarcObjectClass.objects.get(class_id=class_id)
|
||||
except:
|
||||
object_class = None
|
||||
pass
|
||||
|
||||
redshift=0.0
|
||||
if not (ma.is_masked(item['redshift'])):
|
||||
redshift=float(item['redshift'])
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
if not (ma.is_masked(item['ra']) or ma.is_masked(item['dec'])):
|
||||
ra = float(item['ra'])
|
||||
dec = float(item['dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
obj = HeasarcMAXIGSCHGL.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
name=item['name'],
|
||||
error_radius=float(item['error_radius']),
|
||||
redshift = redshift,
|
||||
object_class = object_class,
|
||||
class_id = int(item['class']),
|
||||
hardness_ratio = item['hardness_ratio'],
|
||||
hardness_ratio_error = item['hardness_ratio_error'],
|
||||
hb_flux = item['hb_flux'],
|
||||
hb_flux_error = item['hb_flux_error'],
|
||||
hb_significance = item['hb_significance'],
|
||||
ctrpart_name = item['ctrpart_name'])
|
||||
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_maxigschgl.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
51
heasarc/management/commands/00_heasarc_median_error.py
Normal file
51
heasarc/management/commands/00_heasarc_median_error.py
Normal file
@@ -0,0 +1,51 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcXMMSL2, HeasarcObjectClass
|
||||
from heasarc.models import Heasarc4FGL
|
||||
from heasarc.models import HeasarcIntegral2020, HeasarcSwiftBAT105m, HeasarcMAXI7YR, HeasarcRASS2RXS, Heasarc4FGL
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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 pandas as pd
|
||||
import numpy as np
|
||||
|
||||
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):
|
||||
|
||||
srcs = Heasarc4FGL.objects.all()
|
||||
|
||||
error=[]
|
||||
for s in srcs:
|
||||
error.append(s.error_radius)
|
||||
if(s.error_radius> 4000):
|
||||
print(s,s.error_radius)
|
||||
|
||||
s = pd.DataFrame(error)
|
||||
print("total {} median {:.1f} mean {:.1f} min {:.1f} max {:.1f}".format(srcs.count(),np.median(error),np.mean(error),np.min(error),np.max(error)))
|
||||
|
||||
#srcs = HeasarcIntegral2020.objects.all().filter(name__contains="SLX")
|
||||
#for s in srcs:
|
||||
# print(s.name,s.ra,s.dec,s.error_radius)
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
88
heasarc/management/commands/00_heasarc_object_class.py
Normal file
88
heasarc/management/commands/00_heasarc_object_class.py
Normal file
@@ -0,0 +1,88 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcObjectClass
|
||||
|
||||
def load_heasarc_table(filename, engine):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=keywords['table_author']
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
# convert data frame to pandas
|
||||
df = data.to_pandas()
|
||||
sql = 'DROP TABLE IF EXISTS '+table_name+';'
|
||||
result = engine.execute(sql)
|
||||
|
||||
# Insert whole DataFrame into MySQL
|
||||
df.to_sql(table_name, con = engine, if_exists = 'append', chunksize = 200000)
|
||||
|
||||
for item in data:
|
||||
obj = HeasarcObjectClass(table=table,
|
||||
class_id=int(item['class_id']),
|
||||
class_name=item['class_name'])
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_class.tdat.gz', engine)
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
159
heasarc/management/commands/00_heasarc_rass2rxs.py
Normal file
159
heasarc/management/commands/00_heasarc_rass2rxs.py
Normal file
@@ -0,0 +1,159 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcRASS2RXS, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat',encoding='latin1')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=keywords['table_author']
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
# convert data frame to pandas
|
||||
# df = data.to_pandas()
|
||||
# sql = 'DROP TABLE IF EXISTS '+table_name+';'
|
||||
# result = engine.execute(sql)
|
||||
# Insert whole DataFrame into MySQL
|
||||
# df.to_sql(table_name, con = engine, if_exists = 'append', chunksize = 200000)
|
||||
|
||||
tables = HeasarcRASS2RXS.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
source_quality_flag=0
|
||||
if not (ma.is_masked(item['source_quality_flag'])):
|
||||
source_quality_flag=int(item['source_quality_flag'])
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
if not (ma.is_masked(item['ra']) or ma.is_masked(item['dec'])):
|
||||
ra = float(item['ra'])
|
||||
dec = float(item['dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
obj = HeasarcRASS2RXS.objects.create(healpix=healpix,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
name=item['name'],
|
||||
detection_likelihood = item['detection_likelihood'],
|
||||
count_rate = item['count_rate'],
|
||||
count_rate_error = item['count_rate_error'],
|
||||
exposure = item['exposure'],
|
||||
source_extent = item['source_extent'],
|
||||
source_extent_prob = item['source_extent_prob'],
|
||||
source_quality_flag = source_quality_flag,
|
||||
hardness_ratio_1 = item['hardness_ratio_1'],
|
||||
hardness_ratio_2 = item['hardness_ratio_2'],
|
||||
plaw_flux = item['plaw_flux'],
|
||||
plaw_chi2_reduced = item['plaw_chi2_reduced'],
|
||||
plaw_nh = item['plaw_nh'],
|
||||
mekal_flux = item['mekal_flux'],
|
||||
mekal_chi2_reduced = item['mekal_chi2_reduced'],
|
||||
mekal_nh = item['mekal_nh'],
|
||||
bb_flux = item['bb_flux'],
|
||||
bb_chi2_reduced = item['bb_chi2_reduced'],
|
||||
bb_nh = item['bb_nh'],
|
||||
x_pixel_error = item['x_pixel_error'],
|
||||
y_pixel_error = item['y_pixel_error'],
|
||||
time = item['time'])
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initiates data dase'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
tables = HeasarcRASS2RXS.objects.all()
|
||||
for src in tables:
|
||||
print(src.error_radius)
|
||||
return
|
||||
|
||||
|
||||
#load_heasarc_table('heasarc_rass2rxs.tdat.gz')
|
||||
|
||||
# 14547279 | 28571450 | 180.63796 | 18.45888 | 247.99462296 | 75.7992302 | 11.33246061 | 2RXS J120233.1+182731 | 44 | 1.6219809792e-13 | 6975
|
||||
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
crd = SkyCoord(248.52271, -44.04758, frame=FK5(), unit="deg")
|
||||
h = hp_plate.skycoord_to_healpix(crd)
|
||||
print(h)
|
||||
return
|
||||
|
||||
# update healpix only
|
||||
srcs = HeasarcRASS2RXS.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
34
heasarc/management/commands/00_heasarc_simple_class.py
Normal file
34
heasarc/management/commands/00_heasarc_simple_class.py
Normal file
@@ -0,0 +1,34 @@
|
||||
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 heasarc.models import HeasarcSimpleClass
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
data = astropy.table.Table.read(filename, format='ascii.fast_no_header', delimiter=',')
|
||||
|
||||
cls = HeasarcSimpleClass.objects.all()
|
||||
cls.delete()
|
||||
|
||||
for item in data:
|
||||
obj = HeasarcSimpleClass(class_id=int(item[0]),
|
||||
class_name=item[1])
|
||||
obj.save()
|
||||
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('/export/django/srg/data/heasarc_object_class_cut.csv')
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
113
heasarc/management/commands/00_heasarc_swiftbat105m.py
Normal file
113
heasarc/management/commands/00_heasarc_swiftbat105m.py
Normal file
@@ -0,0 +1,113 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcSwiftBAT105m, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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 math
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
|
||||
|
||||
data = astropy.table.Table.read(filename, delimiter='|',format='ascii.fast_no_header', data_start=2)
|
||||
print(data.info)
|
||||
|
||||
tables = HeasarcSwiftBAT105m.objects.all()
|
||||
tables.delete()
|
||||
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
for item in data:
|
||||
|
||||
#crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
#healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
|
||||
redshift=0.0
|
||||
if not (ma.is_masked(item['col18'])):
|
||||
redshift=float(item['col18'])
|
||||
|
||||
lum=0.0
|
||||
if not (ma.is_masked(item['col19'])):
|
||||
lum=float(item['col19'])
|
||||
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
lon = 0.0
|
||||
lat = 0.0
|
||||
if not (ma.is_masked(item['col3']) or ma.is_masked(item['col4'])):
|
||||
ra = float(item['col3'])
|
||||
dec = float(item['col4'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
lon = crd.galactic.l.value
|
||||
lat = crd.galactic.b.value
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
else:
|
||||
continue
|
||||
|
||||
sign=item['col5']
|
||||
error_radius = math.sqrt((30.5/sign)**2 + 0.1*0.1)*60
|
||||
""" See Eq. 1 in 2018ApJS..235....4O """
|
||||
"""
|
||||
erf(1.65/sqrt(2)) corresponds to 90%
|
||||
"""
|
||||
#koeff=1.42
|
||||
P=0.98
|
||||
koeff=math.sqrt(-2*math.log(1-P))
|
||||
|
||||
#print(item['col1'],item['col2'],ra,dec,sign,error_radius)
|
||||
#continue
|
||||
|
||||
obj = HeasarcSwiftBAT105m.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii = lon,
|
||||
bii = lat,
|
||||
name=item['col2'],
|
||||
error_radius = error_radius*koeff,
|
||||
snr = sign,
|
||||
counterpart_name = item['col6'],
|
||||
flux = float(item['col10']),
|
||||
flux_lo = float(item['col11']),
|
||||
flux_hi = float(item['col12']),
|
||||
redshift = redshift,
|
||||
lum = lum,
|
||||
class_id = int(item['col21']),
|
||||
ref_id = int(item['col1']),
|
||||
otype = item['col22'])
|
||||
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % filename)
|
||||
pass
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initiates data dase'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
load_heasarc_table('/data/Swift/BAT_105m_catalog_07jul2019.txt')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
121
heasarc/management/commands/00_heasarc_xmm_sl2_clean.py
Normal file
121
heasarc/management/commands/00_heasarc_xmm_sl2_clean.py
Normal file
@@ -0,0 +1,121 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcXMMSL2, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
|
||||
|
||||
tables = HeasarcXMMSL2.objects.all()
|
||||
tables.delete()
|
||||
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
for item in data:
|
||||
class_id=9999
|
||||
if item['class'] != '':
|
||||
class_id = int(item['class'])
|
||||
try:
|
||||
object_class = HeasarcObjectClass.objects.get(class_id=class_id)
|
||||
except:
|
||||
print("HeasarcObjectClass not found for class_id=", class_id)
|
||||
object_class=None
|
||||
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
|
||||
""" Skip if source with the same name exists """
|
||||
try:
|
||||
src=HeasarcXMMSL2.objects.get(name__exact=item['xmmslew_name'])
|
||||
#print("*** Skip {}".format(item['xmmslew_name']))
|
||||
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
#print("Create {}".format(item['xmmslew_name']))
|
||||
|
||||
obj = HeasarcXMMSL2.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
error_radius=float(item['radec_error'])*1.42,
|
||||
name="{}".format(item['xmmslew_name']),
|
||||
class_id=class_id,object_class=object_class,
|
||||
flux_b8=item['flux_b8'],
|
||||
flux_b7=item['flux_b7'],
|
||||
obsid=item['obsid'],
|
||||
ver_inext = item['ver_inext'],
|
||||
ver_halo = item['ver_halo'],
|
||||
ver_hibgnd = item['ver_hibgnd'],
|
||||
ver_nredg = item['ver_nredg'],
|
||||
ver_psusp = item['ver_psusp'],
|
||||
ver_false = item['ver_false'],
|
||||
flag_comment = item['flag_comment'],
|
||||
sourcenum=item['sourcenum'])
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_xmmslewcln.tdat.gz')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
110
heasarc/management/commands/00_heasarc_xmmsl2.py
Normal file
110
heasarc/management/commands/00_heasarc_xmmsl2.py
Normal file
@@ -0,0 +1,110 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from datetime import date
|
||||
from heasarc.models import INPUT_DATA_DIR
|
||||
import datetime, math
|
||||
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, HeasarcXMMSL2, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
tables = HeasarcXMMSL2.objects.all()
|
||||
tables.delete()
|
||||
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
|
||||
for item in data:
|
||||
class_id=9999
|
||||
if item['class'] != '':
|
||||
class_id = int(item['class'])
|
||||
try:
|
||||
object_class = HeasarcObjectClass.objects.get(class_id=class_id)
|
||||
except:
|
||||
print("HeasarcObjectClass not found for class_id=", class_id)
|
||||
object_class=None
|
||||
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
|
||||
""" Skip if source with the same name exists """
|
||||
try:
|
||||
src=HeasarcXMMSL2.objects.get(name__exact=item['xmmslew_name'])
|
||||
continue
|
||||
except:
|
||||
pass
|
||||
P=0.98
|
||||
koeff=math.sqrt(-2*math.log(1-P))
|
||||
obj = HeasarcXMMSL2.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
error_radius=float(item['radec_error'])*koeff,
|
||||
name="{}".format(item['xmmslew_name']),
|
||||
class_id=class_id,object_class=object_class,
|
||||
flux_b8=item['flux_b8'],
|
||||
flux_b7=item['flux_b7'],
|
||||
obsid=item['obsid'],
|
||||
sourcenum=item['sourcenum'])
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_xmmslewful.tdat.gz')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
150
heasarc/management/commands/00_heasarc_xmmssc.py
Normal file
150
heasarc/management/commands/00_heasarc_xmmssc.py
Normal file
@@ -0,0 +1,150 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcXMMSSC, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=keywords['table_author']
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
# convert data frame to pandas
|
||||
# df = data.to_pandas()
|
||||
# sql = 'DROP TABLE IF EXISTS '+table_name+';'
|
||||
# result = engine.execute(sql)
|
||||
# Insert whole DataFrame into MySQL
|
||||
# df.to_sql(table_name, con = engine, if_exists = 'append', chunksize = 200000)
|
||||
|
||||
tables = HeasarcXMMSSC.objects.all()
|
||||
tables.delete()
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
obj = HeasarcXMMSSC.objects.create(healpix=healpix,
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
error_radius=item['error_radius'],
|
||||
name=item['name'],
|
||||
detid=item['detid'],
|
||||
srcid=item['srcid'],
|
||||
time = item['time'],
|
||||
end_time = item['end_time'],
|
||||
ep_8_flux = item['ep_8_flux'],
|
||||
ep_8_flux_error = item['ep_8_flux_error'],
|
||||
pn_8_flux = item['pn_8_flux'],
|
||||
pn_8_flux_error = item['pn_8_flux_error'],
|
||||
m1_8_flux = item['m1_8_flux'],
|
||||
m1_8_flux_error = item['m1_8_flux_error'],
|
||||
m2_8_flux = item['m2_8_flux'],
|
||||
m2_8_flux_error = item['m2_8_flux_error'],
|
||||
ep_1_flux = item['ep_1_flux'],
|
||||
ep_1_flux_error = item['ep_1_flux_error'],
|
||||
ep_2_flux = item['ep_2_flux'],
|
||||
ep_2_flux_error = item['ep_2_flux_error'],
|
||||
ep_3_flux = item['ep_3_flux'],
|
||||
ep_3_flux_error = item['ep_3_flux_error'],
|
||||
sum_flag = item['sum_flag'],
|
||||
sc_extent = item['sc_extent'],
|
||||
sc_ext_ml = item['sc_ext_ml'])
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
# create sqlalchemy engine
|
||||
# engine = create_engine("mysql+pymysql://{user}:{pw}@localhost/{db}"
|
||||
# .format(user="heauser",
|
||||
# pw="srg2019@L2_heasarc",
|
||||
# db="heasarc_db"))
|
||||
|
||||
# engine = create_engine("postgresql://{user}:{pw}@localhost/{db}"
|
||||
# .format(user="heauser",
|
||||
# pw="srg2019@L2_heasarc",
|
||||
# db="heasarc_db"))
|
||||
|
||||
|
||||
|
||||
load_heasarc_table('heasarc_xmmssc.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
144
heasarc/management/commands/00_heasarc_xray_master.py
Normal file
144
heasarc/management/commands/00_heasarc_xray_master.py
Normal file
@@ -0,0 +1,144 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcXrayMaster, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=keywords['table_author']
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
# convert data frame to pandas
|
||||
# df = data.to_pandas()
|
||||
# sql = 'DROP TABLE IF EXISTS '+table_name+';'
|
||||
# result = engine.execute(sql)
|
||||
# Insert whole DataFrame into MySQL
|
||||
# df.to_sql(table_name, con = engine, if_exists = 'append', chunksize = 200000)
|
||||
|
||||
tables = HeasarcXrayMaster.objects.all()
|
||||
tables.delete()
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
class_id=9999
|
||||
if item['class'] != '':
|
||||
class_id = int(item['class'])
|
||||
try:
|
||||
object_class = HeasarcObjectClass.objects.get(class_id=class_id)
|
||||
except:
|
||||
print("HeasarcObjectClass not found for class_id=", class_id)
|
||||
object_class=None
|
||||
|
||||
crd = SkyCoord(item['ra'], item['dec'], frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
|
||||
obj = HeasarcXrayMaster.objects.create(healpix=healpix,
|
||||
ra=item['ra'],
|
||||
dec=item['dec'],
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
error_radius=item['error_radius'],
|
||||
name=item['name'],
|
||||
database_table=item['database_table'],
|
||||
count_rate=item['count_rate'],
|
||||
count_rate_error=item['count_rate_error'],
|
||||
flux=item['flux'],
|
||||
exposure=item['exposure'],
|
||||
class_id=class_id,
|
||||
object_class=object_class,
|
||||
observatory=item['observatory'])
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
# create sqlalchemy engine
|
||||
# engine = create_engine("mysql+pymysql://{user}:{pw}@localhost/{db}"
|
||||
# .format(user="heauser",
|
||||
# pw="srg2019@L2_heasarc",
|
||||
# db="heasarc_db"))
|
||||
|
||||
# engine = create_engine("postgresql://{user}:{pw}@localhost/{db}"
|
||||
# .format(user="heauser",
|
||||
# pw="srg2019@L2_heasarc",
|
||||
# db="heasarc_db"))
|
||||
|
||||
|
||||
|
||||
load_heasarc_table('heasarc_xray.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXrayMaster.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
131
heasarc/management/commands/00_heasarc_xteasscat.py
Normal file
131
heasarc/management/commands/00_heasarc_xteasscat.py
Normal file
@@ -0,0 +1,131 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcXTEASSCAT, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat',encoding='latin1')
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table_author = (keywords['table_author'][:36]) if len(keywords['table_author']) > 36 else keywords['table_author']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=table_author
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
print("*** Delete all XTEASSCAT objects ***")
|
||||
tables = HeasarcXTEASSCAT.objects.all()
|
||||
tables.delete()
|
||||
|
||||
print("*** Create new XTEASSCAT objects ***")
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
hp_plate = HEALPix(nside=NSIDE_PLATES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
if not (ma.is_masked(item['ra']) or ma.is_masked(item['dec'])):
|
||||
ra = float(item['ra'])
|
||||
dec = float(item['dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
healpix_plate = hp_plate.skycoord_to_healpix(crd)
|
||||
obj = HeasarcXTEASSCAT.objects.create(healpix=healpix,
|
||||
healpix_plate=healpix_plate,
|
||||
ra=ra,
|
||||
dec=dec,
|
||||
lii=item['lii'],
|
||||
bii=item['bii'],
|
||||
name=item['name'],
|
||||
error_radius=float(item['error_radius'])*60,
|
||||
redshift = item['redshift'],
|
||||
rate1 = item['count_rate_1'],
|
||||
rate1_error = item['count_rate_1_error'],
|
||||
rate2 = item['count_rate_2'],
|
||||
rate2_error = item['count_rate_2_error'],
|
||||
alt_names= item['alt_names'],
|
||||
broad_type = item['broad_type'],
|
||||
detailed_type = item['detailed_type'],
|
||||
class_id = int(item['class']))
|
||||
|
||||
obj.save()
|
||||
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_xteasscat.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
33
heasarc/management/commands/00_heasarcbase_match.py
Normal file
33
heasarc/management/commands/00_heasarcbase_match.py
Normal file
@@ -0,0 +1,33 @@
|
||||
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'))
|
||||
|
64
heasarc/management/commands/01_heasarc_rass2rxs_update.py
Normal file
64
heasarc/management/commands/01_heasarc_rass2rxs_update.py
Normal file
@@ -0,0 +1,64 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcRASS2RXS, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from monthplan.models import NSIDE_PLATES
|
||||
|
||||
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 math
|
||||
|
||||
def update_heasarc_table():
|
||||
|
||||
srcs = HeasarcRASS2RXS.objects.all()
|
||||
"""
|
||||
for src in srcs:
|
||||
dx=src.x_pixel_error
|
||||
dy=src.y_pixel_error
|
||||
error_radius=math.sqrt(dx*dx+dy*dy)*45*1.42
|
||||
print("{} {}".format(error_radius,src.error_radius))
|
||||
"""
|
||||
|
||||
objs = []
|
||||
pixsize=45 # arcseconds
|
||||
for src in srcs:
|
||||
dx=src.x_pixel_error
|
||||
dy=src.y_pixel_error
|
||||
#src.error_radius = math.sqrt(dx*dx+dy*dy)*pixsize*1.42
|
||||
|
||||
P=0.98
|
||||
src.error_radius = max(dx,dy)*pixsize*math.sqrt(-2*math.log(1-P))
|
||||
|
||||
objs.append(src)
|
||||
HeasarcRASS2RXS.objects.bulk_update(objs, ['error_radius'], batch_size=1000)
|
||||
"""
|
||||
The X image coordinate of the source from the local sliding cell detection on an X-ray image of 512 by 512 pixels
|
||||
with 45 arcsecond square pixels.
|
||||
|
||||
The 1-sigma error in the X image coordinate of the source.
|
||||
|
||||
R(P)_2D = Sigma_1D * sqrt (-2 * ln(1-P))
|
||||
|
||||
"""
|
||||
class Command(BaseCommand):
|
||||
help = 'Initiates data dase'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
update_heasarc_table()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
116
heasarc/management/commands/heasarc_load_tdat.py
Normal file
116
heasarc/management/commands/heasarc_load_tdat.py
Normal file
@@ -0,0 +1,116 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn
|
||||
|
||||
def load_heasarc_table(filename, engine):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat',encoding='latin1')
|
||||
return
|
||||
|
||||
keywords = data.meta['keywords']
|
||||
for key, value in keywords.items():
|
||||
print(key, '->', value)
|
||||
|
||||
try:
|
||||
table=HeasarcTable.objects.get(name__exact=keywords['table_name'])
|
||||
table.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
table_name=keywords['table_name']
|
||||
table = HeasarcTable(name=keywords['table_name'])
|
||||
table.description=keywords['table_description'].replace('\"', '')
|
||||
table.document_url=keywords['table_document_url']
|
||||
if 'default_search_radius' in keywords:
|
||||
table.search_radius=int(keywords['default_search_radius'])
|
||||
if 'frequency_regime' in keywords:
|
||||
table.frequency_regime=keywords['frequency_regime']
|
||||
table.observatory_name=keywords['observatory_name']
|
||||
table.security=keywords['table_security']
|
||||
if 'table_author' in keywords:
|
||||
table.author=keywords['table_author']
|
||||
if 'catalog_bibcode' in keywords:
|
||||
table.bibcode=keywords['catalog_bibcode']
|
||||
if 'declination' in keywords:
|
||||
table.declination=keywords['declination'].replace('@', '')
|
||||
if 'right_ascension' in keywords:
|
||||
table.right_ascension=keywords['right_ascension'].replace('@', '')
|
||||
table.observatory_name = keywords['observatory_name']
|
||||
if 'parameter_defaults' in keywords:
|
||||
table.parameter_defaults = keywords['parameter_defaults']
|
||||
table.save()
|
||||
|
||||
cols = data.meta['cols']
|
||||
for key, value in cols.items():
|
||||
column = TableColumn(table=table)
|
||||
column.name=key
|
||||
column.tdat_type=value['type']
|
||||
column.description=value['description']
|
||||
column.save()
|
||||
print(key, '->', value)
|
||||
|
||||
# convert data frame to pandas
|
||||
df = data.to_pandas()
|
||||
sql = 'DROP TABLE IF EXISTS '+table_name+';'
|
||||
result = engine.execute(sql)
|
||||
|
||||
# Insert whole DataFrame into MySQL
|
||||
df.to_sql(table_name, con = engine, if_exists = 'append', chunksize = 200000)
|
||||
print('--> Successfully loaded "%s"' % table_name)
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
# create sqlalchemy engine
|
||||
# engine = create_engine("mysql+pymysql://{user}:{pw}@localhost/{db}"
|
||||
# .format(user="heauser",
|
||||
# pw="srg2019@L2_heasarc",
|
||||
# db="heasarc_db"))
|
||||
|
||||
engine = create_engine("postgresql://{user}:{pw}@localhost/{db}"
|
||||
.format(user="heauser",
|
||||
pw="srg2019@L2_heasarc",
|
||||
db="heasarc_db"))
|
||||
|
||||
|
||||
|
||||
#load_heasarc_table('heasarc_rass2rxs.tdat.gz', engine)
|
||||
#load_heasarc_table('/heasarc/heasarc_messier.tdat', engine)
|
||||
#load_heasarc_table('heasarc_iraspscz.tdat.gz', engine)
|
||||
#load_heasarc_table('/heasarc/heasarc_ngc2000.tdat', engine)
|
||||
#load_heasarc_table('heasarc_ascamaster.tdat.gz', engine)
|
||||
#load_heasarc_table('/heasarc/heasarc_batsepulsr.tdat', engine)
|
||||
#load_heasarc_table('/heasarc/heasarc_egrcat.tdat', engine)
|
||||
#load_heasarc_table('/heasarc/heasarc_egret3.tdat', engine)
|
||||
load_heasarc_table('heasarc_chanmaster.tdat.gz', engine) # failed
|
||||
#load_heasarc_table('/heasarc/heasarc_fermilpsc.tdat.gz', engine)
|
||||
#load_heasarc_table('/heasarc/heasarc_twomassrsc.tdat.gz', engine)
|
||||
#load_heasarc_table('/heasarc/heasarc_abellzcat.tdat.gz', engine)
|
||||
#load_heasarc_table('/heasarc/heasarc_qorgcat.tdat.gz', engine)
|
||||
#load_heasarc_table('heasarc_allwiseagn.tdat.gz', engine)
|
||||
#load_heasarc_table('heasarc_glxsdssqs2.tdat.gz', engine)
|
||||
#load_heasarc_table('heasarc_intibisag2.tdat.gz', engine)
|
||||
#load_heasarc_table('heasarc_rosnepagn.tdat.gz', engine)
|
||||
#load_heasarc_table('heasarc_tevcat.tdat.gz', engine)
|
||||
#load_heasarc_table('heasarc_intibisgal.tdat.gz', engine)
|
||||
#load_heasarc_table('heasarc_xray.tdat.gz', engine) # Don't runm here, use 01_heasarc_xray_master
|
||||
#load_heasarc_table('heasarc_xmmssc.tdat.gz', engine)
|
||||
#load_heasarc_table('heasarc_class.tdat.gz', engine) # Don't run here, use 00_heasarc_object_class
|
||||
#self.stdout.write(self.style.SUCCESS('Done'))
|
44
heasarc/management/commands/heasarc_match_gaia.py
Normal file
44
heasarc/management/commands/heasarc_match_gaia.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
import time
|
||||
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcBase
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
from astrobasis.models import GAIADR3
|
||||
from heasarc.models import Heasarc4XMMDR10
|
||||
from srglib.utils import find_counterparts
|
||||
|
||||
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
|
||||
|
||||
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):
|
||||
|
||||
srcs = Heasarc4XMMDR10.objects.all()#.filter(EP_1_FLUX__gt=1e-13)
|
||||
|
||||
maxdist=60.0
|
||||
minrad=5.0
|
||||
|
||||
print("Taken from HEASARC: {}".format(srcs.count()))
|
||||
start_time = time.time()
|
||||
find_counterparts(srcs, GAIADR3.objects.all(), "gaia3", maxdist=maxdist, minrad=minrad, verbose=True)
|
||||
print("--- %s seconds ---" % (time.time() - start_time))
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
41
heasarc/management/commands/heasarc_reference_paper.py
Normal file
41
heasarc/management/commands/heasarc_reference_paper.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from nasa.models import Category
|
||||
from nasa.models import Ads
|
||||
|
||||
from heasarc.models import HeasarcCSC
|
||||
from heasarc.models import Heasarc4XMMDR12
|
||||
from heasarc.models import HeasarcXMMSSC
|
||||
from heasarc.models import HeasarcRASS2RXS
|
||||
from heasarc.models import HeasarcXTEASSCAT
|
||||
from heasarc.models import Heasarc2SXPS
|
||||
from heasarc.models import Heasarc4XMMDR9
|
||||
from heasarc.models import Heasarc4XMMDR10
|
||||
|
||||
def reference_paper(bibcode,survey):
|
||||
category_open = Category.objects.get(slug="open")
|
||||
#print(category_open)
|
||||
|
||||
ads = Ads(bibcode=bibcode)
|
||||
ads.save()
|
||||
ads.category.add(category_open)
|
||||
|
||||
srcs = survey.objects.all()
|
||||
print ("Selected {} total from {}".format(srcs.count(), survey))
|
||||
srcs.update(ads=ads)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initiates data dase'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
#reference_paper("2010ApJS..189...37E", HeasarcCSC)
|
||||
#reference_paper("2020A&A...641A.136W",Heasarc4XMMDR12)
|
||||
reference_paper("2020A&A...641A.136W",HeasarcXMMSSC)
|
||||
reference_paper("2016A&A...588A.103B",HeasarcRASS2RXS)
|
||||
reference_paper("2004A&A...418..927R",HeasarcXTEASSCAT)
|
||||
reference_paper("2020ApJS..247...54E",Heasarc2SXPS)
|
||||
reference_paper("2020A&A...641A.137T",Heasarc4XMMDR9)
|
||||
reference_paper("2020A&A...641A.136W",Heasarc4XMMDR10)
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
||||
|
60
heasarc/management/commands/print_rass2rxs.py
Normal file
60
heasarc/management/commands/print_rass2rxs.py
Normal file
@@ -0,0 +1,60 @@
|
||||
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 heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcRASS2RXS, HeasarcObjectClass
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
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
|
||||
|
||||
def load_heasarc_table(filename):
|
||||
tdatfile=INPUT_DATA_DIR+'/dump/'+filename
|
||||
data = astropy.table.Table.read(tdatfile, format='ascii.tdat',encoding='latin1')
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
for item in data:
|
||||
|
||||
healpix = 0
|
||||
ra = 0.0
|
||||
dec = 0.0
|
||||
if not (ma.is_masked(item['ra']) or ma.is_masked(item['dec'])):
|
||||
ra = float(item['ra'])
|
||||
dec = float(item['dec'])
|
||||
crd = SkyCoord(ra, dec, frame=FK5(), unit="deg")
|
||||
healpix = hp.skycoord_to_healpix(crd)
|
||||
print("fk5;circle({}, {},0.01)".format(ra,dec))
|
||||
pass
|
||||
|
||||
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):
|
||||
|
||||
load_heasarc_table('heasarc_rass2rxs.tdat.gz')
|
||||
return
|
||||
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
# update healpix only
|
||||
srcs = HeasarcXMMSSC.objects.all()
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame=FK5(), unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.save()
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
33
heasarc/management/commands/testme.py
Normal file
33
heasarc/management/commands/testme.py
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
|
||||
from heasarc.tdat import tDat
|
||||
from heasarc.models import HeasarcTable, TableColumn, HeasarcXrayMaster, HeasarcObjectClass
|
||||
|
||||
|
||||
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):
|
||||
|
||||
class_count=9999
|
||||
try:
|
||||
object_class = HeasarcObjectClass.objects.get(class_id=class_count)
|
||||
except:
|
||||
print("HeasarcObjectClass not found for class_id=", class_count)
|
||||
|
||||
print(object_class.class_name)
|
||||
|
||||
self.stdout.write(self.style.SUCCESS('Done'))
|
336
heasarc/migrations/0001_initial.py
Normal file
336
heasarc/migrations/0001_initial.py
Normal file
@@ -0,0 +1,336 @@
|
||||
# Generated by Django 2.2.6 on 2020-01-21 10:18
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcBase',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('healpix', models.BigIntegerField(db_index=True, default=0)),
|
||||
('ra', models.FloatField(default=0.0)),
|
||||
('dec', models.FloatField(default=0.0)),
|
||||
('lii', models.FloatField(default=0.0)),
|
||||
('bii', models.FloatField(default=0.0)),
|
||||
('error_radius', models.FloatField(default=0.0)),
|
||||
('name', models.CharField(blank=True, default='', max_length=50)),
|
||||
('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_heasarc.heasarcbase_set+', to='contenttypes.ContentType')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HeasarcTable',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(blank=True, default='', max_length=36, unique=True)),
|
||||
('description', models.CharField(blank=True, default='', max_length=120)),
|
||||
('document_url', models.URLField(blank=True, default='', max_length=120)),
|
||||
('search_radius', models.IntegerField(default=0)),
|
||||
('frequency_regime', models.CharField(blank=True, default='', max_length=36)),
|
||||
('observatory_name', models.CharField(blank=True, default='', max_length=36)),
|
||||
('security', models.CharField(blank=True, default='', max_length=36)),
|
||||
('parameter_defaults', models.CharField(blank=True, default='', max_length=1000)),
|
||||
('declination', models.CharField(blank=True, default='', max_length=36)),
|
||||
('right_ascension', models.CharField(blank=True, default='', max_length=36)),
|
||||
('author', models.CharField(blank=True, default='', max_length=36)),
|
||||
('bibcode', models.CharField(blank=True, default='', max_length=36)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Heasarc2SXPS',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('Exposure', models.FloatField(default=0.0)),
|
||||
('LastObsDate', models.DateTimeField(blank=True, null=True)),
|
||||
('FirstObsDate', models.DateTimeField(blank=True, null=True)),
|
||||
('FirstDetDate', models.DateTimeField(blank=True, null=True)),
|
||||
('LastDetDate', models.DateTimeField(blank=True, null=True)),
|
||||
('BestDetectionID', models.IntegerField(default=0)),
|
||||
('DetFlag', models.IntegerField(default=0)),
|
||||
('Rate_band0', models.FloatField(default=0.0)),
|
||||
('Rate_band0_pos', models.FloatField(default=0.0)),
|
||||
('Rate_band0_neg', models.FloatField(default=0.0)),
|
||||
('Rate_band1', models.FloatField(default=0.0)),
|
||||
('Rate_band1_pos', models.FloatField(default=0.0)),
|
||||
('Rate_band1_neg', models.FloatField(default=0.0)),
|
||||
('Rate_band2', models.FloatField(default=0.0)),
|
||||
('Rate_band2_pos', models.FloatField(default=0.0)),
|
||||
('Rate_band2_neg', models.FloatField(default=0.0)),
|
||||
('Rate_band3', models.FloatField(default=0.0)),
|
||||
('Rate_band3_pos', models.FloatField(default=0.0)),
|
||||
('Rate_band3_neg', models.FloatField(default=0.0)),
|
||||
('PeakRate_band0_pos', models.FloatField(default=0.0)),
|
||||
('PeakRate_band0_neg', models.FloatField(default=0.0)),
|
||||
('PeakRate_band1', models.FloatField(default=0.0)),
|
||||
('PeakRate_band1_pos', models.FloatField(default=0.0)),
|
||||
('PeakRate_band1_neg', models.FloatField(default=0.0)),
|
||||
('PeakRate_band2', models.FloatField(default=0.0)),
|
||||
('PeakRate_band2_pos', models.FloatField(default=0.0)),
|
||||
('PeakRate_band2_neg', models.FloatField(default=0.0)),
|
||||
('PeakRate_band3', models.FloatField(default=0.0)),
|
||||
('PeakRate_band3_pos', models.FloatField(default=0.0)),
|
||||
('PeakRate_band3_neg', models.FloatField(default=0.0)),
|
||||
('PowFlux', models.FloatField(default=0.0)),
|
||||
('PowFlux_pos', models.FloatField(default=0.0)),
|
||||
('PowFlux_neg', models.FloatField(default=0.0)),
|
||||
('APECFlux', models.FloatField(default=0.0)),
|
||||
('APECFlux_pos', models.FloatField(default=0.0)),
|
||||
('APECFlux_neg', models.FloatField(default=0.0)),
|
||||
('PowPeakFlux', models.FloatField(default=0.0)),
|
||||
('PowPeakFlux_pos', models.FloatField(default=0.0)),
|
||||
('PowPeakFlux_neg', models.FloatField(default=0.0)),
|
||||
('FittedPowNH', models.FloatField(default=0.0)),
|
||||
('FittedPowRedChi', models.FloatField(default=0.0)),
|
||||
('FittedAPECNH', models.FloatField(default=0.0)),
|
||||
('FittedAPECRedChi', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Heasarc4XMMDR9',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('SRCID', models.BigIntegerField(default=0)),
|
||||
('POSERR', models.FloatField(default=0.0)),
|
||||
('DET_ML', models.FloatField(default=0.0)),
|
||||
('EP_1_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_1_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_2_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_2_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_3_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_3_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_4_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_4_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_5_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_5_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_8_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_8_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_9_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_9_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('HR1', models.FloatField(default=0.0)),
|
||||
('HR1_ERR', models.FloatField(default=0.0)),
|
||||
('HR2', models.FloatField(default=0.0)),
|
||||
('HR2_ERR', models.FloatField(default=0.0)),
|
||||
('HR3', models.FloatField(default=0.0)),
|
||||
('HR3_ERR', models.FloatField(default=0.0)),
|
||||
('HR4', models.FloatField(default=0.0)),
|
||||
('HR4_ERR', models.FloatField(default=0.0)),
|
||||
('EXTENT', models.FloatField(default=0.0)),
|
||||
('EXT_ERR', models.FloatField(default=0.0)),
|
||||
('EXT_ML', models.FloatField(default=0.0)),
|
||||
('CHI2PROB', models.FloatField(default=0.0)),
|
||||
('FVAR', models.FloatField(default=0.0)),
|
||||
('FVARERR', models.FloatField(default=0.0)),
|
||||
('VAR_FLAG', models.IntegerField(default=0)),
|
||||
('SUM_FLAG', models.IntegerField(default=0)),
|
||||
('EP_8_FMIN', models.FloatField(default=0.0)),
|
||||
('EP_8_FMIN_ERR', models.FloatField(default=0.0)),
|
||||
('EP_8_FMAX', models.FloatField(default=0.0)),
|
||||
('EP_8_FMAX_ERR', models.FloatField(default=0.0)),
|
||||
('MJD_FIRST', models.IntegerField(default=0)),
|
||||
('MJD_LAST', models.IntegerField(default=0)),
|
||||
('N_DETECTIONS', models.IntegerField(default=0)),
|
||||
('CONFUSED', models.CharField(blank=True, default='', max_length=1)),
|
||||
('WEBPAGE_URL', models.CharField(blank=True, default='', max_length=100)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HeasarcALLWISEAGN',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('w1w2_color', models.FloatField(default=0.0)),
|
||||
('w2w3_color', models.FloatField(default=0.0)),
|
||||
('w1_mag', models.FloatField(default=0.0)),
|
||||
('gmag', models.FloatField(default=0.0)),
|
||||
('redshift', models.FloatField(default=0.0)),
|
||||
('redshift_flag', models.CharField(blank=True, default='', max_length=1)),
|
||||
('lqac2_name', models.CharField(blank=True, default='', max_length=17)),
|
||||
('dr12q_name', models.CharField(blank=True, default='', max_length=24)),
|
||||
('milliquas_name', models.CharField(blank=True, default='', max_length=25)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HeasarcCSC',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('significance', models.FloatField(default=0.0)),
|
||||
('b_flux_ap', models.FloatField(default=0.0)),
|
||||
('b_flux_ap_hi', models.FloatField(default=0.0)),
|
||||
('b_flux_ap_lo', models.FloatField(default=0.0)),
|
||||
('m_flux_ap', models.FloatField(default=0.0)),
|
||||
('m_flux_ap_hi', models.FloatField(default=0.0)),
|
||||
('m_flux_ap_lo', models.FloatField(default=0.0)),
|
||||
('conf_flag', models.CharField(blank=True, default='', max_length=1)),
|
||||
('extent_flag', models.CharField(blank=True, default='', max_length=1)),
|
||||
('error_ellipse_r0', models.FloatField(default=0.0)),
|
||||
('error_ellipse_r1', models.FloatField(default=0.0)),
|
||||
('error_ellipse_angle', models.FloatField(default=0.0)),
|
||||
('m_photflux_ap', models.FloatField(default=0.0)),
|
||||
('m_photflux_ap_hi', models.FloatField(default=0.0)),
|
||||
('m_photflux_ap_lo', models.FloatField(default=0.0)),
|
||||
('s_photflux_ap', models.FloatField(default=0.0)),
|
||||
('s_photflux_ap_hi', models.FloatField(default=0.0)),
|
||||
('s_photflux_ap_lo', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HeasarcRASS2RXS',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('count_rate', models.FloatField(default=0.0)),
|
||||
('count_rate_error', models.FloatField(default=0.0)),
|
||||
('exposure', models.FloatField(default=0.0)),
|
||||
('source_extent', models.FloatField(default=0.0)),
|
||||
('source_extent_prob', models.FloatField(default=0.0)),
|
||||
('source_quality_flag', models.IntegerField(default=0)),
|
||||
('hardness_ratio_1', models.FloatField(default=0.0)),
|
||||
('hardness_ratio_2', models.FloatField(default=0.0)),
|
||||
('plaw_flux', models.FloatField(default=0.0)),
|
||||
('plaw_chi2_reduced', models.FloatField(default=0.0)),
|
||||
('plaw_nh', models.FloatField(default=0.0)),
|
||||
('mekal_flux', models.FloatField(default=0.0)),
|
||||
('mekal_chi2_reduced', models.FloatField(default=0.0)),
|
||||
('mekal_nh', models.FloatField(default=0.0)),
|
||||
('bb_flux', models.FloatField(default=0.0)),
|
||||
('bb_chi2_reduced', models.FloatField(default=0.0)),
|
||||
('bb_nh', models.FloatField(default=0.0)),
|
||||
('x_pixel_error', models.FloatField(default=0.0)),
|
||||
('y_pixel_error', models.FloatField(default=0.0)),
|
||||
('time', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HeasarcXMMSSC',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('detid', models.CharField(blank=True, default='', max_length=15)),
|
||||
('srcid', models.CharField(blank=True, default='', max_length=15)),
|
||||
('time', models.FloatField(default=0.0)),
|
||||
('end_time', models.FloatField(default=0.0)),
|
||||
('ep_8_flux', models.FloatField(default=0.0)),
|
||||
('ep_8_flux_error', models.FloatField(default=0.0)),
|
||||
('pn_8_flux', models.FloatField(default=0.0)),
|
||||
('pn_8_flux_error', models.FloatField(default=0.0)),
|
||||
('m1_8_flux', models.FloatField(default=0.0)),
|
||||
('m1_8_flux_error', models.FloatField(default=0.0)),
|
||||
('m2_8_flux', models.FloatField(default=0.0)),
|
||||
('m2_8_flux_error', models.FloatField(default=0.0)),
|
||||
('ep_1_flux', models.FloatField(default=0.0)),
|
||||
('ep_1_flux_error', models.FloatField(default=0.0)),
|
||||
('ep_2_flux', models.FloatField(default=0.0)),
|
||||
('ep_2_flux_error', models.FloatField(default=0.0)),
|
||||
('ep_3_flux', models.FloatField(default=0.0)),
|
||||
('ep_3_flux_error', models.FloatField(default=0.0)),
|
||||
('sum_flag', models.IntegerField(default=0)),
|
||||
('sc_extent', models.FloatField(default=0.0)),
|
||||
('sc_ext_ml', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TableColumn',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(blank=True, default='', max_length=36)),
|
||||
('tdat_type', models.CharField(blank=True, default='', max_length=200)),
|
||||
('description', models.CharField(blank=True, default='', max_length=120)),
|
||||
('table', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='heasarc.HeasarcTable')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HeasarcObjectClass',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('class_name', models.CharField(blank=True, default='', max_length=120)),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
('table', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='heasarc.HeasarcTable')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HeasarcXrayMaster',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('database_table', models.CharField(blank=True, default='', max_length=120)),
|
||||
('count_rate', models.FloatField(default=0.0)),
|
||||
('count_rate_error', models.FloatField(default=0.0)),
|
||||
('flux', models.FloatField(default=0.0)),
|
||||
('exposure', models.FloatField(default=0.0)),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
('observatory', models.CharField(blank=True, default='', max_length=50)),
|
||||
('object_class', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='heasarc.HeasarcObjectClass')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='HeasarcCHANMASTER',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('obsid', models.CharField(blank=True, default='00000', max_length=5)),
|
||||
('status', models.CharField(blank=True, default='', max_length=20)),
|
||||
('time', models.FloatField(default=0.0)),
|
||||
('detector', models.CharField(blank=True, default='', max_length=6)),
|
||||
('grating', models.CharField(blank=True, default='', max_length=6)),
|
||||
('exposure', models.FloatField(default=0.0)),
|
||||
('obstype', models.CharField(blank=True, default='', max_length=3)),
|
||||
('pi', models.CharField(blank=True, default='', max_length=40)),
|
||||
('cycle', models.IntegerField(default=0)),
|
||||
('proposal', models.CharField(blank=True, default='', max_length=8)),
|
||||
('public_date', models.IntegerField(default=0)),
|
||||
('sequence_number', models.CharField(blank=True, default='000000', max_length=6)),
|
||||
('data_mode', models.CharField(blank=True, default='', max_length=15)),
|
||||
('category', models.CharField(blank=True, default='', max_length=50)),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
('object_class', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='heasarc.HeasarcObjectClass')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0002_heasarcbase_erosita_flux.py
Normal file
18
heasarc/migrations/0002_heasarcbase_erosita_flux.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-01-24 10:13
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='erosita_flux',
|
||||
field=models.FloatField(default=0.0),
|
||||
),
|
||||
]
|
21
heasarc/migrations/0003_rosatexpmap.py
Normal file
21
heasarc/migrations/0003_rosatexpmap.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 2.2.6 on 2020-01-29 13:38
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0002_heasarcbase_erosita_flux'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='RosatExpMap',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('healpix', models.BigIntegerField(db_index=True, default=0)),
|
||||
('exposure', models.FloatField(default=0.0)),
|
||||
],
|
||||
),
|
||||
]
|
23
heasarc/migrations/0004_auto_20200130_1239.py
Normal file
23
heasarc/migrations/0004_auto_20200130_1239.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 2.2.6 on 2020-01-30 09:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0003_rosatexpmap'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarccsc',
|
||||
name='s_flux_ap',
|
||||
field=models.FloatField(default=0.0),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarccsc',
|
||||
name='s_flux_ap_hi',
|
||||
field=models.FloatField(default=0.0),
|
||||
),
|
||||
]
|
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-01-30 15:08
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0004_auto_20200130_1239'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcrass2rxs',
|
||||
name='detection_likelihood',
|
||||
field=models.FloatField(default=0.0),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0006_heasarcbase_healpix_plate.py
Normal file
18
heasarc/migrations/0006_heasarcbase_healpix_plate.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-12 09:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0005_heasarcrass2rxs_detection_likelihood'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='healpix_plate',
|
||||
field=models.PositiveIntegerField(db_index=True, default=0),
|
||||
),
|
||||
]
|
29
heasarc/migrations/0007_heasarcintegral9.py
Normal file
29
heasarc/migrations/0007_heasarcintegral9.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-12 10:00
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0006_heasarcbase_healpix_plate'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcIntegral9',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('source_type', models.CharField(blank=True, default='', max_length=15)),
|
||||
('flux', models.FloatField(default=0.0)),
|
||||
('flux_error', models.FloatField(default=0.0)),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
19
heasarc/migrations/0008_heasarcintegral9_object_class.py
Normal file
19
heasarc/migrations/0008_heasarcintegral9_object_class.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-12 10:08
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0007_heasarcintegral9'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcintegral9',
|
||||
name='object_class',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='heasarc.HeasarcObjectClass'),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0009_auto_20200212_1850.py
Normal file
18
heasarc/migrations/0009_auto_20200212_1850.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-12 15:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0008_heasarcintegral9_object_class'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='heasarcbase',
|
||||
name='healpix_plate',
|
||||
field=models.IntegerField(db_index=True, default=0),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0010_auto_20200212_1851.py
Normal file
18
heasarc/migrations/0010_auto_20200212_1851.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-12 15:51
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0009_auto_20200212_1850'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='heasarcbase',
|
||||
name='healpix_plate',
|
||||
field=models.PositiveIntegerField(db_index=True, default=0),
|
||||
),
|
||||
]
|
17
heasarc/migrations/0011_remove_heasarcbase_healpix_plate.py
Normal file
17
heasarc/migrations/0011_remove_heasarcbase_healpix_plate.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-12 15:52
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0010_auto_20200212_1851'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='heasarcbase',
|
||||
name='healpix_plate',
|
||||
),
|
||||
]
|
18
heasarc/migrations/0012_heasarcbase_healpix_plate.py
Normal file
18
heasarc/migrations/0012_heasarcbase_healpix_plate.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-12 15:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0011_remove_heasarcbase_healpix_plate'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='healpix_plate',
|
||||
field=models.IntegerField(db_index=True, default=0),
|
||||
),
|
||||
]
|
27
heasarc/migrations/0013_heasarcintrefcat.py
Normal file
27
heasarc/migrations/0013_heasarcintrefcat.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-13 16:22
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0012_heasarcbase_healpix_plate'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcIntRefCat',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
('object_class', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='heasarc.HeasarcObjectClass')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
30
heasarc/migrations/0014_greensnr.py
Normal file
30
heasarc/migrations/0014_greensnr.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-14 10:28
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0013_heasarcintrefcat'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='GreenSNR',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('healpix_plate', models.IntegerField(db_index=True, default=0)),
|
||||
('ra', models.FloatField(default=0.0)),
|
||||
('dec', models.FloatField(default=0.0)),
|
||||
('lii', models.FloatField(default=0.0)),
|
||||
('bii', models.FloatField(default=0.0)),
|
||||
('MajDiam', models.FloatField(default=0.0)),
|
||||
('MinDiam', models.FloatField(default=0.0)),
|
||||
('snrtype', models.CharField(blank=True, default='', max_length=2)),
|
||||
('SpIndex', models.FloatField(default=0.0)),
|
||||
('uSpIndex', models.CharField(blank=True, default='', max_length=2)),
|
||||
('Names', models.CharField(blank=True, default='', max_length=26)),
|
||||
],
|
||||
),
|
||||
]
|
18
heasarc/migrations/0015_greensnr_name.py
Normal file
18
heasarc/migrations/0015_greensnr_name.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-02-14 10:41
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0014_greensnr'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='greensnr',
|
||||
name='name',
|
||||
field=models.CharField(blank=True, default='', max_length=11),
|
||||
),
|
||||
]
|
34
heasarc/migrations/0016_heasarcswiftbat105m.py
Normal file
34
heasarc/migrations/0016_heasarcswiftbat105m.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Generated by Django 2.2.6 on 2020-03-06 08:41
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0015_greensnr_name'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcSwiftBAT105m',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('snr', models.FloatField(default=0.0)),
|
||||
('counterpart_name', models.CharField(blank=True, default='', max_length=30)),
|
||||
('flux', models.FloatField(default=0.0)),
|
||||
('flux_lo', models.FloatField(default=0.0)),
|
||||
('flux_hi', models.FloatField(default=0.0)),
|
||||
('redshift', models.FloatField(default=0.0)),
|
||||
('lum', models.FloatField(default=0.0)),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
('otype', models.CharField(blank=True, default='', max_length=25)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0017_heasarcswiftbat105m_ref_id.py
Normal file
18
heasarc/migrations/0017_heasarcswiftbat105m_ref_id.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-03-06 08:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0016_heasarcswiftbat105m'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcswiftbat105m',
|
||||
name='ref_id',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
34
heasarc/migrations/0018_heasarcxteasscat.py
Normal file
34
heasarc/migrations/0018_heasarcxteasscat.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Generated by Django 2.2.6 on 2020-03-18 12:10
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0017_heasarcswiftbat105m_ref_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcXTEASSCAT',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('rate1', models.FloatField(default=0.0)),
|
||||
('rate1_error', models.FloatField(default=0.0)),
|
||||
('rate2', models.FloatField(default=0.0)),
|
||||
('rate2_error', models.FloatField(default=0.0)),
|
||||
('alt_names', models.CharField(blank=True, default='', max_length=43)),
|
||||
('broad_type', models.CharField(blank=True, default='', max_length=5)),
|
||||
('detailed_type', models.CharField(blank=True, default='', max_length=6)),
|
||||
('redshift', models.FloatField(default=0.0)),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
34
heasarc/migrations/0019_heasarcmaxigschgl.py
Normal file
34
heasarc/migrations/0019_heasarcmaxigschgl.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Generated by Django 2.2.6 on 2020-03-25 11:05
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0018_heasarcxteasscat'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcMAXIGSCHGL',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('hardness_ratio', models.FloatField(default=0.0)),
|
||||
('hardness_ratio_error', models.FloatField(default=0.0)),
|
||||
('hb_flux', models.FloatField(default=0.0)),
|
||||
('hb_flux_error', models.FloatField(default=0.0)),
|
||||
('hb_significance', models.FloatField(default=0.0)),
|
||||
('ctrpart_name', models.CharField(blank=True, default='', max_length=28)),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
('redshift', models.FloatField(default=0.0)),
|
||||
('object_class', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='heasarc.HeasarcObjectClass')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0020_rosatexpmap_detlimflux.py
Normal file
18
heasarc/migrations/0020_rosatexpmap_detlimflux.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.6 on 2020-05-21 12:51
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0019_heasarcmaxigschgl'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='rosatexpmap',
|
||||
name='detlimflux',
|
||||
field=models.FloatField(default=0.0),
|
||||
),
|
||||
]
|
21
heasarc/migrations/0021_heasarcsimpleclass.py
Normal file
21
heasarc/migrations/0021_heasarcsimpleclass.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 2.2.6 on 2020-06-19 19:04
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0020_rosatexpmap_detlimflux'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcSimpleClass',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('class_name', models.CharField(blank=True, default='', max_length=120)),
|
||||
('class_id', models.IntegerField(default=0)),
|
||||
],
|
||||
),
|
||||
]
|
27
heasarc/migrations/0022_heasarcxmmsl2.py
Normal file
27
heasarc/migrations/0022_heasarcxmmsl2.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 3.0.8 on 2020-07-09 13:44
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0021_heasarcsimpleclass'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcXMMSL2',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('flux_b8', models.FloatField(default=0.0)),
|
||||
('flux_b7', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
24
heasarc/migrations/0023_auto_20200709_1655.py
Normal file
24
heasarc/migrations/0023_auto_20200709_1655.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Generated by Django 3.0.8 on 2020-07-09 13:55
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0022_heasarcxmmsl2'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='class_id',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='object_class',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='heasarc.HeasarcObjectClass'),
|
||||
),
|
||||
]
|
27
heasarc/migrations/0024_heasarc3maxi.py
Normal file
27
heasarc/migrations/0024_heasarc3maxi.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 3.0.8 on 2020-07-11 09:04
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0023_auto_20200709_1655'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Heasarc3MAXI',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('sign', models.FloatField(default=0.0)),
|
||||
('flux', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0025_rosatexpmap_nh.py
Normal file
18
heasarc/migrations/0025_rosatexpmap_nh.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.0.8 on 2020-11-02 09:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0024_heasarc3maxi'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='rosatexpmap',
|
||||
name='nH',
|
||||
field=models.FloatField(default=0.0),
|
||||
),
|
||||
]
|
27
heasarc/migrations/0026_heasarcintegral2020.py
Normal file
27
heasarc/migrations/0026_heasarcintegral2020.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 3.0.8 on 2020-11-10 14:35
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0025_rosatexpmap_nh'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcIntegral2020',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('flux', models.FloatField(default=0.0)),
|
||||
('flux_error', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0027_heasarcintegral2020_sign.py
Normal file
18
heasarc/migrations/0027_heasarcintegral2020_sign.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.0.8 on 2020-11-10 14:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0026_heasarcintegral2020'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcintegral2020',
|
||||
name='sign',
|
||||
field=models.FloatField(default=0.0),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0028_heasarcintegral2020_ref_id.py
Normal file
18
heasarc/migrations/0028_heasarcintegral2020_ref_id.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.0.8 on 2020-11-10 14:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0027_heasarcintegral2020_sign'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcintegral2020',
|
||||
name='ref_id',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
19
heasarc/migrations/0029_heasarc4xmmdr9_gaia.py
Normal file
19
heasarc/migrations/0029_heasarc4xmmdr9_gaia.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 3.0.8 on 2021-02-11 15:38
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0045_auto_20200804_1707'),
|
||||
('heasarc', '0028_heasarcintegral2020_ref_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarc4xmmdr9',
|
||||
name='gaia',
|
||||
field=models.ManyToManyField(to='astrobasis.GAIADR2'),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0030_auto_20210211_1848.py
Normal file
18
heasarc/migrations/0030_auto_20210211_1848.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.0.8 on 2021-02-11 15:48
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0029_heasarc4xmmdr9_gaia'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='heasarc4xmmdr9',
|
||||
old_name='POSERR',
|
||||
new_name='radec_error',
|
||||
),
|
||||
]
|
67
heasarc/migrations/0031_heasarc4xmmdr10.py
Normal file
67
heasarc/migrations/0031_heasarc4xmmdr10.py
Normal file
@@ -0,0 +1,67 @@
|
||||
# Generated by Django 3.0.8 on 2021-02-12 09:55
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0030_auto_20210211_1848'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Heasarc4XMMDR10',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('SRCID', models.BigIntegerField(default=0)),
|
||||
('radec_error', models.FloatField(default=0.0)),
|
||||
('DET_ML', models.FloatField(default=0.0)),
|
||||
('EP_1_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_1_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_2_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_2_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_3_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_3_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_4_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_4_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_5_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_5_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_8_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_8_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_9_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_9_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('HR1', models.FloatField(default=0.0)),
|
||||
('HR1_ERR', models.FloatField(default=0.0)),
|
||||
('HR2', models.FloatField(default=0.0)),
|
||||
('HR2_ERR', models.FloatField(default=0.0)),
|
||||
('HR3', models.FloatField(default=0.0)),
|
||||
('HR3_ERR', models.FloatField(default=0.0)),
|
||||
('HR4', models.FloatField(default=0.0)),
|
||||
('HR4_ERR', models.FloatField(default=0.0)),
|
||||
('EXTENT', models.FloatField(default=0.0)),
|
||||
('EXT_ERR', models.FloatField(default=0.0)),
|
||||
('EXT_ML', models.FloatField(default=0.0)),
|
||||
('CHI2PROB', models.FloatField(default=0.0)),
|
||||
('FVAR', models.FloatField(default=0.0)),
|
||||
('FVARERR', models.FloatField(default=0.0)),
|
||||
('VAR_FLAG', models.IntegerField(default=0)),
|
||||
('SUM_FLAG', models.IntegerField(default=0)),
|
||||
('EP_8_FMIN', models.FloatField(default=0.0)),
|
||||
('EP_8_FMIN_ERR', models.FloatField(default=0.0)),
|
||||
('EP_8_FMAX', models.FloatField(default=0.0)),
|
||||
('EP_8_FMAX_ERR', models.FloatField(default=0.0)),
|
||||
('MJD_FIRST', models.IntegerField(default=0)),
|
||||
('MJD_LAST', models.IntegerField(default=0)),
|
||||
('N_DETECTIONS', models.IntegerField(default=0)),
|
||||
('CONFUSED', models.CharField(blank=True, default='', max_length=1)),
|
||||
('WEBPAGE_URL', models.CharField(blank=True, default='', max_length=100)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
19
heasarc/migrations/0032_heasarc4xmmdr10_gaia.py
Normal file
19
heasarc/migrations/0032_heasarc4xmmdr10_gaia.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 3.0.8 on 2021-04-05 12:22
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0053_remove_gaiadr3_ref_epoch'),
|
||||
('heasarc', '0031_heasarc4xmmdr10'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarc4xmmdr10',
|
||||
name='gaia',
|
||||
field=models.ManyToManyField(to='astrobasis.GAIADR3'),
|
||||
),
|
||||
]
|
27
heasarc/migrations/0033_heasarcmaxi7yr.py
Normal file
27
heasarc/migrations/0033_heasarcmaxi7yr.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 3.0.8 on 2021-06-30 11:16
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0032_heasarc4xmmdr10_gaia'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcMAXI7YR',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('sign', models.FloatField(default=0.0)),
|
||||
('flux', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
27
heasarc/migrations/0034_heasarc4fgl.py
Normal file
27
heasarc/migrations/0034_heasarc4fgl.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 3.0.8 on 2021-07-01 14:24
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0033_heasarcmaxi7yr'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Heasarc4FGL',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.HeasarcBase')),
|
||||
('sign', models.FloatField(default=0.0)),
|
||||
('flux', models.FloatField(default=0.0)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
23
heasarc/migrations/0035_auto_20210821_1032.py
Normal file
23
heasarc/migrations/0035_auto_20210821_1032.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 3.0.8 on 2021-08-21 07:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0034_heasarc4fgl'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='obsid',
|
||||
field=models.CharField(blank=True, default='', max_length=10),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='sourcenum',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
48
heasarc/migrations/0036_auto_20210826_1325.py
Normal file
48
heasarc/migrations/0036_auto_20210826_1325.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# Generated by Django 3.0.8 on 2021-08-26 10:25
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0035_auto_20210821_1032'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='flag_comment',
|
||||
field=models.CharField(blank=True, default='', max_length=40),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='ver_false',
|
||||
field=models.CharField(blank=True, default='', max_length=1),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='ver_halo',
|
||||
field=models.CharField(blank=True, default='', max_length=1),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='ver_hibgnd',
|
||||
field=models.CharField(blank=True, default='', max_length=1),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='ver_inext',
|
||||
field=models.CharField(blank=True, default='', max_length=1),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='ver_nredg',
|
||||
field=models.CharField(blank=True, default='', max_length=1),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcxmmsl2',
|
||||
name='ver_psusp',
|
||||
field=models.CharField(blank=True, default='', max_length=1),
|
||||
),
|
||||
]
|
48
heasarc/migrations/0037_auto_20211229_1259.py
Normal file
48
heasarc/migrations/0037_auto_20211229_1259.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# Generated by Django 3.2.10 on 2021-12-29 09:59
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0036_auto_20210826_1325'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='greensnr',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='heasarcbase',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='heasarcobjectclass',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='heasarcsimpleclass',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='heasarctable',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='rosatexpmap',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='tablecolumn',
|
||||
name='id',
|
||||
field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
|
||||
),
|
||||
]
|
17
heasarc/migrations/0038_remove_heasarc4xmmdr9_gaia.py
Normal file
17
heasarc/migrations/0038_remove_heasarc4xmmdr9_gaia.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 3.2.10 on 2022-01-12 09:06
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0037_auto_20211229_1259'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='heasarc4xmmdr9',
|
||||
name='gaia',
|
||||
),
|
||||
]
|
17
heasarc/migrations/0039_remove_heasarc4xmmdr10_gaia.py
Normal file
17
heasarc/migrations/0039_remove_heasarc4xmmdr10_gaia.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 3.2.12 on 2022-03-05 14:45
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0038_remove_heasarc4xmmdr9_gaia'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='heasarc4xmmdr10',
|
||||
name='gaia',
|
||||
),
|
||||
]
|
25
heasarc/migrations/0040_auto_20220305_1747.py
Normal file
25
heasarc/migrations/0040_auto_20220305_1747.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.2.12 on 2022-03-05 14:47
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0055_auto_20211229_1259'),
|
||||
('heasarc', '0039_remove_heasarc4xmmdr10_gaia'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='gaia3',
|
||||
field=models.ManyToManyField(to='astrobasis.GAIADR3'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='gaia3_primary',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='heasarcbase_primary', to='astrobasis.gaiadr3'),
|
||||
),
|
||||
]
|
25
heasarc/migrations/0041_auto_20220317_1603.py
Normal file
25
heasarc/migrations/0041_auto_20220317_1603.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.2.12 on 2022-03-17 13:03
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0059_auto_20220315_1125'),
|
||||
('heasarc', '0040_auto_20220305_1747'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='glimpse',
|
||||
field=models.ManyToManyField(to='astrobasis.GLIMPSE'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='glimpse_primary',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='heasarcbase_primary', to='astrobasis.glimpse'),
|
||||
),
|
||||
]
|
17
heasarc/migrations/0042_alter_heasarcbase_options.py
Normal file
17
heasarc/migrations/0042_alter_heasarcbase_options.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 3.2.12 on 2022-03-23 14:41
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0041_auto_20220317_1603'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='heasarcbase',
|
||||
options={'ordering': ['-id']},
|
||||
),
|
||||
]
|
21
heasarc/migrations/0043_auto_20220329_2223.py
Normal file
21
heasarc/migrations/0043_auto_20220329_2223.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 3.2.12 on 2022-03-29 19:23
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0042_alter_heasarcbase_options'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='heasarcbase',
|
||||
name='glimpse',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='heasarcbase',
|
||||
name='glimpse_primary',
|
||||
),
|
||||
]
|
25
heasarc/migrations/0044_auto_20220330_1308.py
Normal file
25
heasarc/migrations/0044_auto_20220330_1308.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.2.12 on 2022-03-30 10:08
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0064_auto_20220325_1752'),
|
||||
('heasarc', '0043_auto_20220329_2223'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='vlass',
|
||||
field=models.ManyToManyField(to='astrobasis.VLASS'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='vlass_primary',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='heasarcbase_primary', to='astrobasis.vlass'),
|
||||
),
|
||||
]
|
25
heasarc/migrations/0045_auto_20220404_1109.py
Normal file
25
heasarc/migrations/0045_auto_20220404_1109.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.2.12 on 2022-04-04 08:09
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0066_alter_twomass_name'),
|
||||
('heasarc', '0044_auto_20220330_1308'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='glimpse',
|
||||
field=models.ManyToManyField(to='astrobasis.GLIMPSE'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='glimpse_primary',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='heasarcbase_primary', to='astrobasis.glimpse'),
|
||||
),
|
||||
]
|
28
heasarc/migrations/0046_heasarcusercat.py
Normal file
28
heasarc/migrations/0046_heasarcusercat.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 3.2.12 on 2022-04-13 14:44
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0045_auto_20220404_1109'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='HeasarcUserCat',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.heasarcbase')),
|
||||
('bibcode', models.CharField(blank=True, default='', max_length=36)),
|
||||
('notes', models.TextField(blank=True, max_length=2000, null=True, verbose_name='notes')),
|
||||
('autoname', models.BooleanField(default=False, null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0047_alter_heasarcusercat_autoname.py
Normal file
18
heasarc/migrations/0047_alter_heasarcusercat_autoname.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.12 on 2022-04-14 08:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0046_heasarcusercat'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='heasarcusercat',
|
||||
name='autoname',
|
||||
field=models.BooleanField(default=False, help_text='Generate IAU name of the component in the form NAME JHHMMSS.s+DDMMSS, <br>where NAME is taken from the corresponding field above.'),
|
||||
),
|
||||
]
|
18
heasarc/migrations/0048_alter_heasarcusercat_autoname.py
Normal file
18
heasarc/migrations/0048_alter_heasarcusercat_autoname.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.13 on 2022-04-15 08:15
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0047_alter_heasarcusercat_autoname'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='heasarcusercat',
|
||||
name='autoname',
|
||||
field=models.BooleanField(default=False, help_text='Generate IAU name of the component in the form <b>NAME JHHMMSS.s+DDMMSS</b>, <br>where NAME is taken from the corresponding field above.'),
|
||||
),
|
||||
]
|
25
heasarc/migrations/0049_auto_20220421_1450.py
Normal file
25
heasarc/migrations/0049_auto_20220421_1450.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.2.13 on 2022-04-21 11:50
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0070_alter_twomass_options'),
|
||||
('heasarc', '0048_alter_heasarcusercat_autoname'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='twomass',
|
||||
field=models.ManyToManyField(to='astrobasis.TwoMASS'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='twomass_primary',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='heasarcbase_primary', to='astrobasis.twomass'),
|
||||
),
|
||||
]
|
25
heasarc/migrations/0050_auto_20220428_1809.py
Normal file
25
heasarc/migrations/0050_auto_20220428_1809.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.2.13 on 2022-04-28 15:09
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0070_alter_twomass_options'),
|
||||
('heasarc', '0049_auto_20220421_1450'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='allwise',
|
||||
field=models.ManyToManyField(to='astrobasis.AllWise'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='allwise_primary',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='heasarcbase_primary', to='astrobasis.allwise'),
|
||||
),
|
||||
]
|
19
heasarc/migrations/0051_heasarcbase_usercat.py
Normal file
19
heasarc/migrations/0051_heasarcbase_usercat.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 3.2.13 on 2022-06-10 15:29
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('astrobasis', '0073_astrobasisusercat'),
|
||||
('heasarc', '0050_auto_20220428_1809'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='usercat',
|
||||
field=models.ManyToManyField(to='astrobasis.AstroBasisUserCat'),
|
||||
),
|
||||
]
|
20
heasarc/migrations/0052_heasarcbase_ads.py
Normal file
20
heasarc/migrations/0052_heasarcbase_ads.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Generated by Django 3.2.13 on 2022-11-16 14:23
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('nasa', '0010_auto_20220624_1839'),
|
||||
('heasarc', '0051_heasarcbase_usercat'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='heasarcbase',
|
||||
name='ads',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='heasarcbase_primary', to='nasa.ads'),
|
||||
),
|
||||
]
|
67
heasarc/migrations/0053_heasarc4xmmdr12.py
Normal file
67
heasarc/migrations/0053_heasarc4xmmdr12.py
Normal file
@@ -0,0 +1,67 @@
|
||||
# Generated by Django 3.2.13 on 2022-11-21 14:54
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('heasarc', '0052_heasarcbase_ads'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Heasarc4XMMDR12',
|
||||
fields=[
|
||||
('heasarcbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='heasarc.heasarcbase')),
|
||||
('SRCID', models.BigIntegerField(default=0)),
|
||||
('radec_error', models.FloatField(default=0.0)),
|
||||
('DET_ML', models.FloatField(default=0.0)),
|
||||
('EP_1_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_1_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_2_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_2_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_3_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_3_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_4_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_4_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_5_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_5_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_8_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_8_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('EP_9_FLUX', models.FloatField(default=0.0)),
|
||||
('EP_9_FLUX_ERR', models.FloatField(default=0.0)),
|
||||
('HR1', models.FloatField(default=0.0)),
|
||||
('HR1_ERR', models.FloatField(default=0.0)),
|
||||
('HR2', models.FloatField(default=0.0)),
|
||||
('HR2_ERR', models.FloatField(default=0.0)),
|
||||
('HR3', models.FloatField(default=0.0)),
|
||||
('HR3_ERR', models.FloatField(default=0.0)),
|
||||
('HR4', models.FloatField(default=0.0)),
|
||||
('HR4_ERR', models.FloatField(default=0.0)),
|
||||
('EXTENT', models.FloatField(default=0.0)),
|
||||
('EXT_ERR', models.FloatField(default=0.0)),
|
||||
('EXT_ML', models.FloatField(default=0.0)),
|
||||
('CHI2PROB', models.FloatField(default=0.0)),
|
||||
('FVAR', models.FloatField(default=0.0)),
|
||||
('FVARERR', models.FloatField(default=0.0)),
|
||||
('VAR_FLAG', models.IntegerField(default=0)),
|
||||
('SUM_FLAG', models.IntegerField(default=0)),
|
||||
('EP_8_FMIN', models.FloatField(default=0.0)),
|
||||
('EP_8_FMIN_ERR', models.FloatField(default=0.0)),
|
||||
('EP_8_FMAX', models.FloatField(default=0.0)),
|
||||
('EP_8_FMAX_ERR', models.FloatField(default=0.0)),
|
||||
('MJD_FIRST', models.IntegerField(default=0)),
|
||||
('MJD_LAST', models.IntegerField(default=0)),
|
||||
('N_DETECTIONS', models.IntegerField(default=0)),
|
||||
('CONFUSED', models.CharField(blank=True, default='', max_length=1)),
|
||||
('WEBPAGE_URL', models.CharField(blank=True, default='', max_length=100)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
'base_manager_name': 'objects',
|
||||
},
|
||||
bases=('heasarc.heasarcbase',),
|
||||
),
|
||||
]
|
0
heasarc/migrations/__init__.py
Normal file
0
heasarc/migrations/__init__.py
Normal file
888
heasarc/models.py
Normal file
888
heasarc/models.py
Normal file
@@ -0,0 +1,888 @@
|
||||
""" Describes HEASARC catalogs
|
||||
|
||||
HEASARC classes describe all X-ray catalogs used for cross-match, including these not imported from HEASARC itself.
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
from django import forms
|
||||
import urllib.parse
|
||||
|
||||
from polymorphic.models import PolymorphicModel
|
||||
|
||||
from nasa.models import Ads
|
||||
|
||||
#from astrobasis.models import GAIADR2
|
||||
from astrobasis.models import GAIADR3
|
||||
from astrobasis.models import GLIMPSE
|
||||
from astrobasis.models import VLASS
|
||||
from astrobasis.models import TwoMASS
|
||||
from astrobasis.models import AllWise
|
||||
from astrobasis.models import AstroBasisUserCat
|
||||
|
||||
# Create your models here.
|
||||
|
||||
INPUT_DATA_DIR = '/export/heasarc'
|
||||
|
||||
#
|
||||
# HeasarcTable and TableColumn describe HEASARC tables in separate (non-Django) database "heasarc_db"
|
||||
#
|
||||
|
||||
class HeasarcTable(models.Model):
|
||||
"""HeasarcTable contains HEASARC table description
|
||||
|
||||
Together with :class:`TableColumn`, HeasarcTable describes HEASARC table. The catalog itself is not placed here, instead, HEASARC source catalogs are stored in child classes of :class:`HeasarcBase` parent class.
|
||||
"""
|
||||
name = models.CharField(max_length=36,blank=True, unique=True, default='')
|
||||
""" Table name """
|
||||
description = models.CharField(max_length=120,blank=True, default='')
|
||||
""" Table description """
|
||||
document_url = models.URLField(max_length=120,blank=True, default='')
|
||||
""" External link to HEASARC table description """
|
||||
search_radius = models.IntegerField(default=0)
|
||||
""" Default search radius for this HEASARC catalog """
|
||||
frequency_regime = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Wavelengthy domain (radio, x-ray, gamma, ...) """
|
||||
observatory_name = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Observatory name """
|
||||
security = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Access parameters """
|
||||
parameter_defaults = models.CharField(max_length=1000,blank=True, default='')
|
||||
""" The list of default parameters """
|
||||
declination = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Declination """
|
||||
right_ascension = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Right Ascension """
|
||||
author = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Author of catalog """
|
||||
bibcode = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Bibcode of the catalog (if available) """
|
||||
def __str__(self):
|
||||
return "%s" % (self.name)
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/table" % (self.pk)
|
||||
|
||||
class TableColumn(models.Model):
|
||||
""" Describes columns of HEASARC Table
|
||||
|
||||
Each column description is linked to the corresponding :class:`HeasarcTable` class.
|
||||
"""
|
||||
table = models.ForeignKey(HeasarcTable, on_delete=models.CASCADE)
|
||||
""" Related :class:`HeasarcTable` class """
|
||||
name = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Name of the column """
|
||||
tdat_type = models.CharField(max_length=200,blank=True, default='')
|
||||
""" Format of the column stored in TDAT file.
|
||||
|
||||
This field is not actually used, python automatilally assigns type."""
|
||||
description = models.CharField(max_length=120,blank=True, default='')
|
||||
""" Description of the column """
|
||||
def __str__(self):
|
||||
return "%s: %s" % (self.table.name, self.name)
|
||||
|
||||
class HeasarcObjectClass(models.Model):
|
||||
""" Describes astrophysical type of the X-ray source used in HEASARC """
|
||||
table = models.ForeignKey(HeasarcTable, on_delete=models.CASCADE)
|
||||
""" Link to the corresponding :class:`HeasarcTable` class """
|
||||
class_name = models.CharField(max_length=120,blank=True, default='')
|
||||
""" Classification Name """
|
||||
class_id = models.IntegerField(default=0)
|
||||
""" Classification ID """
|
||||
ordering = ['-class_id',]
|
||||
""" default sorting """
|
||||
def __str__(self):
|
||||
return "%d: %s" % (self.class_id, self.class_name)
|
||||
|
||||
class HeasarcSimpleClass(models.Model):
|
||||
class_name = models.CharField(max_length=120,blank=True, default='')
|
||||
""" Classification Name """
|
||||
class_id = models.IntegerField(default=0)
|
||||
""" Classification ID """
|
||||
ordering = ['-class_id',]
|
||||
""" default sorting """
|
||||
def __str__(self):
|
||||
return self.class_name
|
||||
def get_artsurvey_count(self, survey):
|
||||
return self.artsurveysource_set.filter(survey=survey).count()
|
||||
def get_artsurvey_count_all(self):
|
||||
return self.artsurveysource_set.count()
|
||||
#
|
||||
# Use PolymorphicModel for HEASARC tables in Django:
|
||||
#
|
||||
|
||||
NSIDE_SOURCES=2048
|
||||
ORDER='nested'
|
||||
|
||||
class HeasarcBase(PolymorphicModel):
|
||||
""" Parennt class for all HEASARC catalogs
|
||||
|
||||
This class contains all fields that common for all HEASARC catalogs,
|
||||
like RA, Dec and source name.
|
||||
"""
|
||||
#table = models.ForeignKey(HeasarcTable, null=True, on_delete=models.SET_NULL)
|
||||
healpix = models.BigIntegerField(db_index=True, default=0)
|
||||
healpix_plate = models.IntegerField(db_index=True, default=0)
|
||||
ra = models.FloatField(default=0.0)
|
||||
""" Right Ascension of the Source """
|
||||
dec = models.FloatField(default=0.0)
|
||||
""" Declination of the Source """
|
||||
lii = models.FloatField(default=0.0)
|
||||
""" Galactic Longitude """
|
||||
bii = models.FloatField(default=0.0)
|
||||
""" Galactic Latitude """
|
||||
error_radius = models.FloatField(default=0.0)
|
||||
""" Positional Uncertainty (arcsec) """
|
||||
erosita_flux = models.FloatField(default=0.0)
|
||||
""" Expected eRosita flux in 0.5-2 keV """
|
||||
name = models.CharField(max_length=50,blank=True, default='')
|
||||
""" Source name """
|
||||
gaia3 = models.ManyToManyField(GAIADR3)
|
||||
gaia3_primary = models.ForeignKey(GAIADR3, null=True, blank=True, related_name='heasarcbase_primary', on_delete=models.SET_NULL)
|
||||
|
||||
allwise = models.ManyToManyField(AllWise)
|
||||
allwise_primary = models.ForeignKey(AllWise, null=True, blank=True, related_name='heasarcbase_primary', on_delete=models.SET_NULL)
|
||||
|
||||
glimpse = models.ManyToManyField(GLIMPSE)
|
||||
glimpse_primary = models.ForeignKey(GLIMPSE, null=True, blank=True, related_name='heasarcbase_primary', on_delete=models.SET_NULL)
|
||||
|
||||
vlass = models.ManyToManyField(VLASS)
|
||||
vlass_primary = models.ForeignKey(VLASS, null=True, blank=True, related_name='heasarcbase_primary', on_delete=models.SET_NULL)
|
||||
|
||||
twomass = models.ManyToManyField(TwoMASS)
|
||||
twomass_primary = models.ForeignKey(TwoMASS, null=True, blank=True, related_name='heasarcbase_primary', on_delete=models.SET_NULL)
|
||||
|
||||
usercat = models.ManyToManyField(AstroBasisUserCat)
|
||||
|
||||
ads = models.ForeignKey(Ads, null=True, blank=True, related_name='heasarcbase_primary', on_delete=models.SET_NULL)
|
||||
|
||||
class Meta:
|
||||
ordering = ['-id']
|
||||
|
||||
def description(self):
|
||||
return self.__class__.__name__
|
||||
def get_base_url(self):
|
||||
return "/heasarc/%i/" % (self.pk)
|
||||
|
||||
def get_ads_url(self):
|
||||
return "https://ui.adsabs.harvard.edu/search/q=object%3A%22{}%22&sort=date%20desc%2C%20bibcode%20desc&p_=0".format(urllib.parse.quote_plus(self.name))
|
||||
|
||||
def get_new_astrobasis_url(self):
|
||||
return "/astrobasis/%i/source" % (self.pk)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class HeasarcXrayMaster(HeasarcBase):
|
||||
""" Base X-ray Master Table
|
||||
|
||||
The XRAY database table contains selected parameters from
|
||||
almost all HEASARC X-ray catalogs that have source positions
|
||||
located to better than a few arcminutes.
|
||||
"""
|
||||
|
||||
database_table = models.CharField(max_length=120, blank=True, default='')
|
||||
""" Database Table This Entry Comes From """
|
||||
count_rate = models.FloatField(default=0.0)
|
||||
""" Count Rate (counts/sec) """
|
||||
count_rate_error = models.FloatField(default=0.0)
|
||||
""" Error in Count Rate """
|
||||
flux = models.FloatField(default=0.0)
|
||||
""" Flux (erg/cm^2/s) """
|
||||
exposure = models.FloatField(default=0.0)
|
||||
""" Exposure Time (seconds) """
|
||||
class_id = models.IntegerField(default=0)
|
||||
""" Browse Object Classification """
|
||||
object_class = models.ForeignKey(HeasarcObjectClass, on_delete=models.SET_NULL, null=True)
|
||||
""" Related object in HeasarcObjectClass """
|
||||
observatory = models.CharField(max_length=50,blank=True, default='')
|
||||
""" Observatory or Mission Name That Originated the Database Table """
|
||||
def __str__(self):
|
||||
return "%s: %s" % (self.database_table, self.observatory)
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/xray" % (self.pk)
|
||||
|
||||
class HeasarcSwiftBAT105m(HeasarcBase):
|
||||
""" Swift BAT 105-Month Hard X-ray Survey
|
||||
|
||||
https://swift.gsfc.nasa.gov/results/bs105mon/
|
||||
|
||||
BAT_NAME| RA| DEC| SNR| COUNTERPART_NAME|
|
||||
OTHER_NAME| CTPT_RA|CTPT_DEC| FLUX| FLUX_LO| FLUX_HI|
|
||||
CONTA|GAMM|GAMM|GAMM| CHI_SQ_R|REDSHIF| LUM|ASSOC_STREN|
|
||||
CL2| TYPE
|
||||
|
||||
"""
|
||||
snr = models.FloatField(default=0.0)
|
||||
counterpart_name = models.CharField(max_length=30, blank=True, default='')
|
||||
flux = models.FloatField(default=0.0)
|
||||
flux_lo = models.FloatField(default=0.0)
|
||||
flux_hi = models.FloatField(default=0.0)
|
||||
redshift = models.FloatField(default=0.0)
|
||||
lum = models.FloatField(default=0.0)
|
||||
class_id = models.IntegerField(default=0)
|
||||
ref_id = models.IntegerField(default=0)
|
||||
otype = models.CharField(max_length=25, blank=True, default='')
|
||||
def get_nasa_url(self):
|
||||
return "https://swift.gsfc.nasa.gov/results/bs105mon/%i" % (self.ref_id)
|
||||
|
||||
class HeasarcXMMSL2(HeasarcBase):
|
||||
flux_b8 = models.FloatField(default=0.0)
|
||||
flux_b7 = models.FloatField(default=0.0)
|
||||
class_id = models.IntegerField(default=0)
|
||||
sourcenum = models.IntegerField(default=0)
|
||||
obsid = models.CharField(max_length=10, blank=True, default='')
|
||||
object_class = models.ForeignKey(HeasarcObjectClass, on_delete=models.SET_NULL, null=True)
|
||||
ver_inext = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag Indicates Detection within Extended Source and Is Probably Spurious """
|
||||
ver_halo = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag Indicates Detection within Halo of Very Bright Source, Probably Spurious """
|
||||
ver_hibgnd = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag Indicates Detection within High-Background Region and Is Probably Spurious """
|
||||
ver_nredg = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag Indicates Detection in Consecutive Images, Likely Inaccurate Position """
|
||||
ver_psusp = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag Indicates Source Position Likely Inaccurate, Poor Attitude Reconstruction """
|
||||
ver_false = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag Indicates Problems Not Included in the Other Flags, e.g. Zero Exposure """
|
||||
flag_comment = models.CharField(max_length=40, blank=True, default='')
|
||||
""" Comment Which Explains Why a Particular Source Flag Has Been Set to True"""
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/xmmsl2" % (self.pk)
|
||||
|
||||
class HeasarcIntegral9(HeasarcBase):
|
||||
""" INTEGRAL 9-year catalog """
|
||||
|
||||
source_type = models.CharField(max_length=15, blank=True, default='')
|
||||
flux = models.FloatField(default=0.0)
|
||||
flux_error = models.FloatField(default=0.0)
|
||||
class_id = models.IntegerField(default=0)
|
||||
object_class = models.ForeignKey(HeasarcObjectClass, on_delete=models.SET_NULL, null=True)
|
||||
|
||||
class HeasarcIntegral2020(HeasarcBase):
|
||||
""" INTEGRAL 2020 catalog """
|
||||
flux = models.FloatField(default=0.0)
|
||||
flux_error = models.FloatField(default=0.0)
|
||||
sign = models.FloatField(default=0.0)
|
||||
ref_id = models.IntegerField(default=0)
|
||||
|
||||
|
||||
class HeasarcIntRefCat(HeasarcBase):
|
||||
""" INTEGRAL ISDC catalog """
|
||||
|
||||
class_id = models.IntegerField(default=0)
|
||||
object_class = models.ForeignKey(HeasarcObjectClass, on_delete=models.SET_NULL, null=True)
|
||||
|
||||
"""
|
||||
parameter_defaults detid srcid name ra dec time ep_8_flux ep_8_flux_error pn_8_flux pn_8_flux_error m1_8_flux m1_8_flux_error m2_8_flux m2_8_flux_error
|
||||
"""
|
||||
class HeasarcXMMSSC(HeasarcBase):
|
||||
""" Sub-class of :class:`HeasarcBase` which describes XMM catalog """
|
||||
detid = models.CharField(max_length=15, blank=True, default='')
|
||||
""" Unique Catalog Entry (and Detection) Identifier """
|
||||
srcid = models.CharField(max_length=15, blank=True, default='')
|
||||
""" Unique Source Identifier """
|
||||
time = models.FloatField(default=0.0)
|
||||
""" Start Time of Observation (MJD) """
|
||||
end_time = models.FloatField(default=0.0)
|
||||
""" End Time of Observation (MJD) """
|
||||
ep_8_flux = models.FloatField(default=0.0)
|
||||
""" EPIC Total Band Flux (erg/cm^2/s) """
|
||||
ep_8_flux_error = models.FloatField(default=0.0)
|
||||
""" Uncertainty in EPIC Total Band Flux (erg/cm^2/s) """
|
||||
pn_8_flux = models.FloatField(default=0.0)
|
||||
""" PN Total Band Flux (erg/cm^2/s) """
|
||||
pn_8_flux_error = models.FloatField(default=0.0)
|
||||
""" Uncertainty in PN Total Band Flux (erg/cm^2/s) """
|
||||
m1_8_flux = models.FloatField(default=0.0)
|
||||
""" M1 Total Band Flux (erg/cm^2/s) """
|
||||
m1_8_flux_error = models.FloatField(default=0.0)
|
||||
""" Uncertainty in M1 Total Band Flux (erg/cm^2/s) """
|
||||
m2_8_flux = models.FloatField(default=0.0)
|
||||
""" M2 Total Band Flux (erg/cm^2/s) """
|
||||
m2_8_flux_error = models.FloatField(default=0.0)
|
||||
""" Uncertainty in M2 Total Band Flux (erg/cm^2/s) """
|
||||
ep_1_flux = models.FloatField(default=0.0)
|
||||
""" EPIC Band 1 Flux (erg/cm^2/s) """
|
||||
ep_1_flux_error = models.FloatField(default=0.0)
|
||||
""" Uncertainty in EPIC Band 1 Flux (erg/cm^2/s) """
|
||||
ep_2_flux = models.FloatField(default=0.0)
|
||||
""" EPIC Band 2 Flux (erg/cm^2/s) """
|
||||
ep_2_flux_error = models.FloatField(default=0.0)
|
||||
""" Uncertainty in EPIC Band 2 Flux (erg/cm^2/s) """
|
||||
ep_3_flux = models.FloatField(default=0.0)
|
||||
""" EPIC Band 3 Flux (erg/cm^2/s) """
|
||||
ep_3_flux_error = models.FloatField(default=0.0)
|
||||
""" Uncertainty in EPIC Band 3 Flux (erg/cm^2/s) """
|
||||
sum_flag = models.IntegerField(default=0)
|
||||
""" Summary Flag of the Source: 0= good, 1=warning, 2=possibly spurious """
|
||||
sc_extent= models.FloatField(default=0.0)
|
||||
""" Mean Source Equivalent Total Band Extent Radius (arcsec) """
|
||||
sc_ext_ml= models.FloatField(default=0.0)
|
||||
""" Mean Source Equivalent Total Band Detection Likelihood of the Extended Source """
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/xmmssc" % (self.pk)
|
||||
def get_xmmssc_srcid_url(self):
|
||||
return "http://xmm-catalog.irap.omp.eu/source/%s" % (self.srcid)
|
||||
def get_strasbourg_srcid_url(self):
|
||||
return "http://xcatdb.unistra.fr/3xmmdr8/?mode=catalog&srcid=%s" % (self.srcid)
|
||||
def get_xmmssc_detid_url(self):
|
||||
return "http://xmm-catalog.irap.omp.eu/detection/%s" % (self.detid)
|
||||
|
||||
class HeasarcCHANMASTER(HeasarcBase):
|
||||
""" Sub-class of :class:`HeasarcBase` which describes Chandra Master catalog """
|
||||
obsid = models.CharField(max_length=5, blank=True, default='00000')
|
||||
""" Observation Identifier """
|
||||
status = models.CharField(max_length=20, blank=True, default='')
|
||||
""" Status of Observation """
|
||||
time = models.FloatField(default=0.0)
|
||||
""" Start Time of Observation (UTC) """
|
||||
detector = models.CharField(max_length=6, blank=True, default='')
|
||||
""" Detector """
|
||||
grating = models.CharField(max_length=6, blank=True, default='')
|
||||
""" Grating Setting """
|
||||
exposure = models.FloatField(default=0.0)
|
||||
""" Actual Exposure Time If Observed, Otherwise the Approved Exposure (s) """
|
||||
obstype = models.CharField(max_length=3, blank=True, default='')
|
||||
""" Type of Observation (GO,GTO,CAL,TOO,DDT) """
|
||||
pi = models.CharField(max_length=40, blank=True, default='')
|
||||
""" PI of Observation """
|
||||
cycle = models.IntegerField(default=0)
|
||||
""" AO Number (0=calibration phase) """
|
||||
proposal = models.CharField(max_length=8, blank=True, default='')
|
||||
""" Proposal Number """
|
||||
public_date = models.IntegerField(default=0)
|
||||
""" Public Date """
|
||||
sequence_number = models.CharField(max_length=6, blank=True, default='000000')
|
||||
""" Sequence Number """
|
||||
data_mode = models.CharField(max_length=15, blank=True, default='')
|
||||
""" Operational Mode of the Detector """
|
||||
category = models.CharField(max_length=50, blank=True, default='')
|
||||
""" Subject Category """
|
||||
class_id = models.IntegerField(default=0)
|
||||
""" Browse Object Classification """
|
||||
object_class = models.ForeignKey(HeasarcObjectClass, on_delete=models.SET_NULL, null=True)
|
||||
""" Related object in HeasarcObjectClass """
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/chanmaster" % (self.pk)
|
||||
|
||||
"""
|
||||
parameter_defaults = name ra dec significance b_flux_ap b_flux_ap_hi b_flux_ap_lo m_flux_ap m_flux_ap_hi m_flux_ap_lo
|
||||
"""
|
||||
class HeasarcCSC(HeasarcBase):
|
||||
""" Chandra Source Catalog, v2.0
|
||||
|
||||
Sub-class of :class:`HeasarcBase`
|
||||
"""
|
||||
significance = models.FloatField(default=0.0)
|
||||
""" Highest Source Signal-to-Noise Ratio Across All Stacked Obs. and Energy Bands """
|
||||
b_flux_ap = models.FloatField(default=0.0)
|
||||
""" Net Energy Flux from Source Region Aperture, Bayesian Analysis; ACIS Broad Band (0.5-7.0 keV) """
|
||||
b_flux_ap_hi = models.FloatField(default=0.0)
|
||||
""" Upper limit """
|
||||
b_flux_ap_lo = models.FloatField(default=0.0)
|
||||
""" Lower limit """
|
||||
m_flux_ap = models.FloatField(default=0.0)
|
||||
""" Net Energy Flux from Source Region Aperture, Bayesian Analysis; ACIS Medium (1.2-2.0 keV) """
|
||||
m_flux_ap_hi = models.FloatField(default=0.0)
|
||||
""" Upper limit """
|
||||
m_flux_ap_lo = models.FloatField(default=0.0)
|
||||
""" Lower limit """
|
||||
conf_flag = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag Indicates Source Regions Overlap (Confused Source)
|
||||
|
||||
This is set to 'T' if the source is extended or the deconvolved
|
||||
source extent is inconsistent with a point source at the 90%
|
||||
confidence level in one or more observations and energy bands.
|
||||
"""
|
||||
extent_flag = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag Indicates Source Extent Inconsistent with Point Source (90% Confidence) """
|
||||
error_ellipse_r0 = models.FloatField(default=0.0)
|
||||
""" Major Radius of the 95% Confidence Level Position Error Ellipse """
|
||||
error_ellipse_r1 = models.FloatField(default=0.0)
|
||||
""" Minor Radius of the 95% Confidence Level Position Error Ellipse """
|
||||
error_ellipse_angle = models.FloatField(default=0.0)
|
||||
""" Position Angle of the Major Axis of the 95% Confidence Level Error Ellipse """
|
||||
|
||||
m_photflux_ap = models.FloatField(default=0.0)
|
||||
""" Net Photon Flux from Source Region Aperture, Bayesian Analysis; ACIS Medium Band """
|
||||
m_photflux_ap_hi = models.FloatField(default=0.0)
|
||||
m_photflux_ap_lo = models.FloatField(default=0.0)
|
||||
|
||||
s_photflux_ap = models.FloatField(default=0.0)
|
||||
""" Net Photon Flux from Source Region Aperture, Bayesian Analysis; ACIS Soft Band """
|
||||
s_photflux_ap_hi = models.FloatField(default=0.0)
|
||||
s_photflux_ap_lo = models.FloatField(default=0.0)
|
||||
|
||||
""" additional: """
|
||||
s_flux_ap = models.FloatField(default=0.0)
|
||||
s_flux_ap_hi = models.FloatField(default=0.0)
|
||||
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/csc" % (self.pk)
|
||||
"""
|
||||
parameter_defaults = name ra dec count_rate count_rate_error exposure source_extent source_extent_prob source_quality_flag hardness_ratio_1 hardness_ratio_2
|
||||
"""
|
||||
class HeasarcRASS2RXS(HeasarcBase):
|
||||
""" Second ROSAT Source Catalog. Sub-class of :class:`HeasarcBase` """
|
||||
count_rate = models.FloatField(default=0.0)
|
||||
""" Source Count Rate """
|
||||
count_rate_error = models.FloatField(default=0.0)
|
||||
""" Error in Source Count Rate """
|
||||
exposure = models.FloatField(default=0.0)
|
||||
""" Source Exposure Time """
|
||||
source_extent = models.FloatField(default=0.0)
|
||||
""" Source Extent """
|
||||
source_extent_prob = models.FloatField(default=0.0)
|
||||
""" Probability of the Source Extent """
|
||||
source_quality_flag = models.IntegerField(default=0)
|
||||
""" Source Quality Flag (0=Good) """
|
||||
hardness_ratio_1 = models.FloatField(default=0.0)
|
||||
""" Hardness Ratio 1 """
|
||||
hardness_ratio_2= models.FloatField(default=0.0)
|
||||
""" Hardness Ratio 2 """
|
||||
|
||||
plaw_flux = models.FloatField(default=0.0)
|
||||
""" Power-law flux """
|
||||
plaw_chi2_reduced = models.FloatField(default=0.0)
|
||||
""" Power-law chi2 statistics """
|
||||
plaw_nh = models.FloatField(default=0.0)
|
||||
""" Absorption column density for power-law fit """
|
||||
detection_likelihood = models.FloatField(default=0.0)
|
||||
""" Detection Likelihood """
|
||||
|
||||
mekal_flux = models.FloatField(default=0.0)
|
||||
""" Mekal flux """
|
||||
mekal_chi2_reduced = models.FloatField(default=0.0)
|
||||
""" Chi2 statistics """
|
||||
mekal_nh = models.FloatField(default=0.0)
|
||||
""" Absorption column density """
|
||||
bb_flux = models.FloatField(default=0.0)
|
||||
""" Black-body flux """
|
||||
bb_chi2_reduced = models.FloatField(default=0.0)
|
||||
""" Chi2 statistics """
|
||||
bb_nh = models.FloatField(default=0.0)
|
||||
""" Absorption column density """
|
||||
x_pixel_error = models.FloatField(default=0.0)
|
||||
""" 1-Sigma Error in X Image Coordinate """
|
||||
y_pixel_error = models.FloatField(default=0.0)
|
||||
""" 1-Sigma Error in Y Image Coordinate """
|
||||
time = models.FloatField(default=0.0)
|
||||
""" Start Time of Exposure When Source Is within FOV and Detector on """
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/rass2rxs" % (self.pk)
|
||||
|
||||
class HeasarcMAXIGSCHGL(HeasarcBase):
|
||||
hardness_ratio = models.FloatField(default=0.0)
|
||||
hardness_ratio_error = models.FloatField(default=0.0)
|
||||
hb_flux = models.FloatField(default=0.0)
|
||||
hb_flux_error = models.FloatField(default=0.0)
|
||||
hb_significance = models.FloatField(default=0.0)
|
||||
ctrpart_name = models.CharField(max_length=28, blank=True, default='')
|
||||
class_id = models.IntegerField(default=0)
|
||||
object_class = models.ForeignKey(HeasarcObjectClass, on_delete=models.SET_NULL, null=True)
|
||||
redshift = models.FloatField(default=0.0)
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/maxi_gsc" % (self.pk)
|
||||
|
||||
class Heasarc3MAXI(HeasarcBase):
|
||||
"""
|
||||
http://cdsarc.u-strasbg.fr/viz-bin/Cat?J/ApJS/238/32
|
||||
|
||||
['Seq', '3MAXI', 'RAdeg', 'DEdeg', 'ePos', 's4-10keV', 'F4-10keV', 'e_F4-10keV', 's3-4keV', 'F3-4keV', 'l_F3-4keV', 'e_F3-4keV', 's10-20keV', 'F10-20keV', 'l_F10-20keV', 'e_F10-20keV', 'F3-10keV', 'e_F3-10keV', 'HR1', 'e_HR1', 'HR2', 'e_HR2', 'HR3', 'e_HR3', 'TSVar', 'XVA', 'e_XVA']
|
||||
"""
|
||||
sign = models.FloatField(default=0.0)
|
||||
""" s4-10keV """
|
||||
flux = models.FloatField(default=0.0)
|
||||
""" F4-10keV """
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/3maxi" % (self.pk)
|
||||
|
||||
class HeasarcMAXI7YR(HeasarcBase):
|
||||
"""
|
||||
The combined catalog, see: https://heasarc.gsfc.nasa.gov/W3Browse/maxi/maxigsc7yr.html
|
||||
"""
|
||||
sign = models.FloatField(default=0.0)
|
||||
""" s4-10keV """
|
||||
flux = models.FloatField(default=0.0)
|
||||
""" F4-10keV """
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/maxi7yr" % (self.pk)
|
||||
|
||||
class Heasarc4FGL(HeasarcBase):
|
||||
"""
|
||||
Fermi LAT 10-Year Point Source Catalog (4FGL-DR2)
|
||||
https://heasarc.gsfc.nasa.gov/W3Browse/fermi/fermilpsc.html
|
||||
"""
|
||||
sign = models.FloatField(default=0.0)
|
||||
""" s4-10keV """
|
||||
flux = models.FloatField(default=0.0)
|
||||
""" F4-10keV """
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/maxi7yr" % (self.pk)
|
||||
|
||||
|
||||
class HeasarcXTEASSCAT(HeasarcBase):
|
||||
rate1 = models.FloatField(default=0.0)
|
||||
""" The source count rate in the 3 - 8 keV energy band, in counts/s/PCU (Proportional Counter Unit). """
|
||||
rate1_error = models.FloatField(default=0.0)
|
||||
""" The 1-sigma statistical uncertainty in the source count rate in the 3 - 8 keV energy band, in counts/s/PCU. """
|
||||
|
||||
rate2 = models.FloatField(default=0.0)
|
||||
""" The source count rate in the 8 - 20 keV energy band, in counts/s/PCU (Proportional Counter Unit). """
|
||||
rate2_error = models.FloatField(default=0.0)
|
||||
""" The 1-sigma statistical uncertainty in the source count rate in the 8 - 20 keV energy band, in counts/s/PCU. """
|
||||
|
||||
alt_names= models.CharField(max_length=43, blank=True, default='')
|
||||
""" A common name of the astrophysical object with which the XSS source is identified. There may be several entries per XSS source. The identification procedure is described in Section 3.1 of the published paper. """
|
||||
broad_type = models.CharField(max_length=5, blank=True, default='')
|
||||
detailed_type = models.CharField(max_length=6, blank=True, default='')
|
||||
redshift = models.FloatField(default=0.0)
|
||||
class_id = models.IntegerField(default=0)
|
||||
""" Browse Object Classification """
|
||||
""" The redshift of the object (if known) for extragalactic sources. """
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/xteasscat" % (self.pk)
|
||||
|
||||
class HeasarcALLWISEAGN(HeasarcBase):
|
||||
w1w2_color = models.FloatField(default=0.0)
|
||||
""" AllWISE W1-W2 Color """
|
||||
w2w3_color = models.FloatField(default=0.0)
|
||||
""" AllWISE W2-W3 Color """
|
||||
w1_mag = models.FloatField(default=0.0)
|
||||
""" AllWISE W1 Magnitude """
|
||||
gmag = models.FloatField(default=0.0)
|
||||
""" Compiled g-Band Magnitude (SDSS Bandpass) """
|
||||
redshift = models.FloatField(default=0.0)
|
||||
""" Compiled Redshift """
|
||||
redshift_flag = models.CharField(max_length=1, blank=True, default='')
|
||||
""" Flag [sp] Indicates Type of Redshift: s=Spectroscopic; p=Photometric """
|
||||
lqac2_name = models.CharField(max_length=17, blank=True, default='')
|
||||
""" LQAC2 Source Identifier """
|
||||
dr12q_name = models.CharField(max_length=24, blank=True, default='')
|
||||
""" DR12Q Source Identifier """
|
||||
milliquas_name= models.CharField(max_length=25, blank=True, default='')
|
||||
""" MILLIQUAS Source Identifier """
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/allwiseagn" % (self.pk)
|
||||
|
||||
class Heasarc2SXPS(HeasarcBase):
|
||||
""" Swift-XRT Catalog """
|
||||
Exposure = models.FloatField(default=0.0)
|
||||
LastObsDate = models.DateTimeField(blank=True,null=True)
|
||||
FirstObsDate = models.DateTimeField(blank=True,null=True)
|
||||
FirstDetDate = models.DateTimeField(blank=True,null=True)
|
||||
LastDetDate = models.DateTimeField(blank=True,null=True)
|
||||
BestDetectionID = models.IntegerField(default=0)
|
||||
DetFlag = models.IntegerField(default=0)
|
||||
Rate_band0 = models.FloatField(default=0.0)
|
||||
Rate_band0_pos = models.FloatField(default=0.0)
|
||||
Rate_band0_neg = models.FloatField(default=0.0)
|
||||
Rate_band1 = models.FloatField(default=0.0)
|
||||
Rate_band1_pos = models.FloatField(default=0.0)
|
||||
Rate_band1_neg = models.FloatField(default=0.0)
|
||||
Rate_band2 = models.FloatField(default=0.0)
|
||||
Rate_band2_pos = models.FloatField(default=0.0)
|
||||
Rate_band2_neg = models.FloatField(default=0.0)
|
||||
Rate_band3 = models.FloatField(default=0.0)
|
||||
Rate_band3_pos = models.FloatField(default=0.0)
|
||||
Rate_band3_neg = models.FloatField(default=0.0)
|
||||
PeakRate_band0_pos = models.FloatField(default=0.0)
|
||||
PeakRate_band0_neg = models.FloatField(default=0.0)
|
||||
PeakRate_band1 = models.FloatField(default=0.0)
|
||||
PeakRate_band1_pos = models.FloatField(default=0.0)
|
||||
PeakRate_band1_neg = models.FloatField(default=0.0)
|
||||
PeakRate_band2 = models.FloatField(default=0.0)
|
||||
PeakRate_band2_pos = models.FloatField(default=0.0)
|
||||
PeakRate_band2_neg = models.FloatField(default=0.0)
|
||||
PeakRate_band3 = models.FloatField(default=0.0)
|
||||
PeakRate_band3_pos = models.FloatField(default=0.0)
|
||||
PeakRate_band3_neg = models.FloatField(default=0.0)
|
||||
PowFlux = models.FloatField(default=0.0)
|
||||
PowFlux_pos= models.FloatField(default=0.0)
|
||||
PowFlux_neg= models.FloatField(default=0.0)
|
||||
APECFlux= models.FloatField(default=0.0)
|
||||
APECFlux_pos= models.FloatField(default=0.0)
|
||||
APECFlux_neg= models.FloatField(default=0.0)
|
||||
PowPeakFlux=models.FloatField(default=0.0)
|
||||
PowPeakFlux_pos=models.FloatField(default=0.0)
|
||||
PowPeakFlux_neg=models.FloatField(default=0.0)
|
||||
FittedPowNH=models.FloatField(default=0.0)
|
||||
FittedPowRedChi=models.FloatField(default=0.0)
|
||||
FittedAPECNH=models.FloatField(default=0.0)
|
||||
FittedAPECRedChi =models.FloatField(default=0.0)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/2sxps" % (self.pk)
|
||||
|
||||
class Heasarc4XMMDR9(HeasarcBase):
|
||||
""" 4XMM DR9 Catalog (Currently 550124 in total) """
|
||||
#gaia = models.ManyToManyField(GAIADR2)
|
||||
SRCID = models.BigIntegerField(default=0)
|
||||
#POSERR = models.FloatField(default=0.0)
|
||||
radec_error = models.FloatField(default=0.0)
|
||||
""" Positional arcsec """
|
||||
DET_ML = models.FloatField(default=0.0)
|
||||
EP_1_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_1_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_2_FLUX= models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_2_FLUX_ERR=models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_3_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_3_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_4_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_4_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_5_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_5_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_9_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_9_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
HR1 = models.FloatField(default=0.0)
|
||||
HR1_ERR = models.FloatField(default=0.0)
|
||||
HR2 = models.FloatField(default=0.0)
|
||||
HR2_ERR = models.FloatField(default=0.0)
|
||||
HR3 = models.FloatField(default=0.0)
|
||||
HR3_ERR = models.FloatField(default=0.0)
|
||||
HR4 = models.FloatField(default=0.0)
|
||||
HR4_ERR = models.FloatField(default=0.0)
|
||||
EXTENT = models.FloatField(default=0.0)
|
||||
""" arcsec """
|
||||
EXT_ERR = models.FloatField(default=0.0)
|
||||
""" arcsec """
|
||||
EXT_ML = models.FloatField(default=0.0)
|
||||
CHI2PROB = models.FloatField(default=0.0)
|
||||
FVAR = models.FloatField(default=0.0)
|
||||
FVARERR = models.FloatField(default=0.0)
|
||||
VAR_FLAG = models.IntegerField(default=0)
|
||||
SUM_FLAG = models.IntegerField(default=0)
|
||||
EP_8_FMIN = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMIN_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMAX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMAX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
MJD_FIRST = models.IntegerField(default=0)
|
||||
MJD_LAST = models.IntegerField(default=0)
|
||||
N_DETECTIONS = models.IntegerField(default=0)
|
||||
CONFUSED = models.CharField(max_length=1,blank=True, default='')
|
||||
WEBPAGE_URL = models.CharField(max_length=100,blank=True, default='')
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/4xmm" % (self.pk)
|
||||
|
||||
class Heasarc4XMMDR10(HeasarcBase):
|
||||
""" 4XMM DR10 Catalog (Currently XXX in total) """
|
||||
"""
|
||||
gaia = models.ManyToManyField(GAIADR3)
|
||||
see scripts/match_gaia_xmm.py for experiments
|
||||
"""
|
||||
SRCID = models.BigIntegerField(default=0)
|
||||
#POSERR = models.FloatField(default=0.0)
|
||||
radec_error = models.FloatField(default=0.0)
|
||||
""" Positional arcsec """
|
||||
DET_ML = models.FloatField(default=0.0)
|
||||
EP_1_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_1_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_2_FLUX= models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_2_FLUX_ERR=models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_3_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_3_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_4_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_4_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_5_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_5_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_9_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_9_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
HR1 = models.FloatField(default=0.0)
|
||||
HR1_ERR = models.FloatField(default=0.0)
|
||||
HR2 = models.FloatField(default=0.0)
|
||||
HR2_ERR = models.FloatField(default=0.0)
|
||||
HR3 = models.FloatField(default=0.0)
|
||||
HR3_ERR = models.FloatField(default=0.0)
|
||||
HR4 = models.FloatField(default=0.0)
|
||||
HR4_ERR = models.FloatField(default=0.0)
|
||||
EXTENT = models.FloatField(default=0.0)
|
||||
""" arcsec """
|
||||
EXT_ERR = models.FloatField(default=0.0)
|
||||
""" arcsec """
|
||||
EXT_ML = models.FloatField(default=0.0)
|
||||
CHI2PROB = models.FloatField(default=0.0)
|
||||
FVAR = models.FloatField(default=0.0)
|
||||
FVARERR = models.FloatField(default=0.0)
|
||||
VAR_FLAG = models.IntegerField(default=0)
|
||||
SUM_FLAG = models.IntegerField(default=0)
|
||||
EP_8_FMIN = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMIN_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMAX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMAX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
MJD_FIRST = models.IntegerField(default=0)
|
||||
MJD_LAST = models.IntegerField(default=0)
|
||||
N_DETECTIONS = models.IntegerField(default=0)
|
||||
CONFUSED = models.CharField(max_length=1,blank=True, default='')
|
||||
WEBPAGE_URL = models.CharField(max_length=100,blank=True, default='')
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/4xmmdr10" % (self.pk)
|
||||
|
||||
class Heasarc4XMMDR12(HeasarcBase):
|
||||
""" 4XMM DR12 Catalog """
|
||||
"""
|
||||
gaia = models.ManyToManyField(GAIADR3)
|
||||
see scripts/match_gaia_xmm.py for experiments
|
||||
"""
|
||||
SRCID = models.BigIntegerField(default=0)
|
||||
#POSERR = models.FloatField(default=0.0)
|
||||
radec_error = models.FloatField(default=0.0)
|
||||
""" Positional arcsec """
|
||||
DET_ML = models.FloatField(default=0.0)
|
||||
EP_1_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_1_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_2_FLUX= models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_2_FLUX_ERR=models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_3_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_3_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_4_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_4_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_5_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_5_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_9_FLUX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_9_FLUX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
HR1 = models.FloatField(default=0.0)
|
||||
HR1_ERR = models.FloatField(default=0.0)
|
||||
HR2 = models.FloatField(default=0.0)
|
||||
HR2_ERR = models.FloatField(default=0.0)
|
||||
HR3 = models.FloatField(default=0.0)
|
||||
HR3_ERR = models.FloatField(default=0.0)
|
||||
HR4 = models.FloatField(default=0.0)
|
||||
HR4_ERR = models.FloatField(default=0.0)
|
||||
EXTENT = models.FloatField(default=0.0)
|
||||
""" arcsec """
|
||||
EXT_ERR = models.FloatField(default=0.0)
|
||||
""" arcsec """
|
||||
EXT_ML = models.FloatField(default=0.0)
|
||||
CHI2PROB = models.FloatField(default=0.0)
|
||||
FVAR = models.FloatField(default=0.0)
|
||||
FVARERR = models.FloatField(default=0.0)
|
||||
VAR_FLAG = models.IntegerField(default=0)
|
||||
SUM_FLAG = models.IntegerField(default=0)
|
||||
EP_8_FMIN = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMIN_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMAX = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
EP_8_FMAX_ERR = models.FloatField(default=0.0)
|
||||
""" [erg/cm**2/s] """
|
||||
MJD_FIRST = models.IntegerField(default=0)
|
||||
MJD_LAST = models.IntegerField(default=0)
|
||||
N_DETECTIONS = models.IntegerField(default=0)
|
||||
CONFUSED = models.CharField(max_length=1,blank=True, default='')
|
||||
WEBPAGE_URL = models.CharField(max_length=100,blank=True, default='')
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/heasarc/%i/4xmmdr12" % (self.pk)
|
||||
|
||||
class RosatExpMap(models.Model):
|
||||
""" ROSAT exposure map """
|
||||
healpix = models.BigIntegerField(db_index=True, default=0)
|
||||
""" HEALPIX source index """
|
||||
exposure = models.FloatField(default=0.0)
|
||||
""" Exposure (s) """
|
||||
detlimflux = models.FloatField(default=0.0)
|
||||
""" nH """
|
||||
nH = models.FloatField(default=0.0)
|
||||
|
||||
class GreenSNR(models.Model):
|
||||
""" ROSAT exposure map """
|
||||
healpix_plate = models.IntegerField(db_index=True, default=0)
|
||||
ra = models.FloatField(default=0.0)
|
||||
""" Right Ascension of the Source """
|
||||
dec = models.FloatField(default=0.0)
|
||||
""" Declination of the Source """
|
||||
lii = models.FloatField(default=0.0)
|
||||
""" Galactic Longitude """
|
||||
bii = models.FloatField(default=0.0)
|
||||
""" Galactic Latitude """
|
||||
MajDiam = models.FloatField(default=0.0)
|
||||
MinDiam = models.FloatField(default=0.0)
|
||||
name = models.CharField(max_length=11,blank=True, default='')
|
||||
snrtype = models.CharField(max_length=2,blank=True, default='')
|
||||
SpIndex = models.FloatField(default=0.0)
|
||||
uSpIndex = models.CharField(max_length=2,blank=True, default='')
|
||||
Names = models.CharField(max_length=26,blank=True, default='')
|
||||
|
||||
class HeasarcUserCat(HeasarcBase):
|
||||
""" User custom catalog """
|
||||
bibcode = models.CharField(max_length=36,blank=True, default='')
|
||||
""" Bibcode of the catalog (if available) """
|
||||
notes = models.TextField("notes",max_length=2000, null=True, blank=True)
|
||||
autoname = models.BooleanField(default=False, null=False, help_text="Generate IAU name of the component in the form <b>NAME JHHMMSS.s+DDMMSS</b>, <br>where NAME is taken from the corresponding field above.")
|
||||
def get_update_url(self):
|
||||
return "/heasarc/%i/update" % (self.pk)
|
||||
def get_delete_url(self):
|
||||
return "/heasarc/%i/delete" % (self.pk)
|
||||
def get_nasa_url(self):
|
||||
if(self.bibcode):
|
||||
return "https://ui.adsabs.harvard.edu/abs/{}/abstract".format(self.bibcode)
|
||||
else:
|
||||
return None
|
||||
|
||||
class HeasarcUserCatForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = HeasarcUserCat
|
||||
fields = ('name','autoname','ra', 'dec', 'error_radius','bibcode','notes')
|
||||
#widgets = {
|
||||
# 'bibcode': forms.TextInput(attrs={'style': 'width: 620px;'}),
|
||||
#}
|
165
heasarc/tdat.py
Normal file
165
heasarc/tdat.py
Normal file
@@ -0,0 +1,165 @@
|
||||
# Licensed under a 3-clause BSD style license - see LICENSE.rst
|
||||
"""HEASARC TDAT simple reader.
|
||||
|
||||
tDat.py:
|
||||
HEASARC TDAT read functionality for simple character
|
||||
delimited files with various options for column header definition.
|
||||
|
||||
:Copyright: Space Research Institute (IKI), Moscow, Russia (2019)
|
||||
:Author: Roman Krivonos (krivonos@cosmos.ru)
|
||||
"""
|
||||
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
import astropy
|
||||
from astropy.io import ascii
|
||||
from collections import OrderedDict
|
||||
|
||||
class tDatHeader(ascii.BaseHeader):
|
||||
"""
|
||||
TDAT Header Reader
|
||||
|
||||
Set a few defaults for common ascii table formats
|
||||
(start at line 0, comments begin with ``#`` and possibly white space)
|
||||
"""
|
||||
#start_line = 0
|
||||
#comment = r'\s*#'
|
||||
comment = r'^\s*#.*' # Lines that start with "# " are comments
|
||||
|
||||
def __init__(self):
|
||||
ascii.BaseHeader.__init__(self)
|
||||
|
||||
def process_lines(self, lines):
|
||||
in_header = False
|
||||
re_comment = re.compile(self.comment)
|
||||
for line in lines:
|
||||
match = re_comment.match(line)
|
||||
if match:
|
||||
continue
|
||||
if line == "<DATA>":
|
||||
in_header = False
|
||||
return
|
||||
elif in_header:
|
||||
yield line
|
||||
elif line == "<HEADER>":
|
||||
in_header = True
|
||||
|
||||
def get_cols(self, lines):
|
||||
columns = []
|
||||
#re_name_def = re.compile(r'^\s*field\[([\w0-9\_]+)\]\s*=\s*([\w*\:\_\-\.]+)\s*\/\/ (.*)$') # E.g. 'field[name] ...'
|
||||
re_name_def = re.compile(r'^field\[([\w0-9\_]+)\]\s*=\s*([\s*\w*\/\:\_\-\.\[\]\;\(\)\^]+)\s*\/\/ (.*)$') # E.g. 'field[name] ...'
|
||||
self.names = []
|
||||
for line in self.process_lines(lines):
|
||||
match = re_name_def.search(line)
|
||||
if match:
|
||||
#print('cols',line)
|
||||
columns.append({
|
||||
"name": match.group(1),
|
||||
"type": match.group(2),
|
||||
"description": match.group(3)
|
||||
})
|
||||
self.names.append(match.group(1))
|
||||
else:
|
||||
pass
|
||||
|
||||
self._set_cols_from_names()
|
||||
|
||||
def update_meta(self, lines, meta):
|
||||
"""
|
||||
Extract table-level keywords for tDat table.
|
||||
"""
|
||||
table_meta = meta['table']
|
||||
table_meta['comments'] = []
|
||||
table_meta['keywords'] = OrderedDict()
|
||||
table_meta['cols'] = OrderedDict()
|
||||
|
||||
keywords = table_meta['keywords']
|
||||
cols = table_meta['cols']
|
||||
|
||||
#cols['tstart'] = {'value': 1, 'units': 'keV'}
|
||||
#cols['tstop'] = {'value': 2, 'units': 'keV'}
|
||||
|
||||
keywords['key1'] = 'time'
|
||||
keywords['key2'] = 'tim3'
|
||||
|
||||
val=1
|
||||
table_meta['comments'].append(val)
|
||||
val=2
|
||||
table_meta['comments'].append(val)
|
||||
val=3
|
||||
table_meta['comments'].append(val)
|
||||
|
||||
re_name_def = re.compile(r'^field\[([\w0-9\_]+)\]\s*=\s*([\s*\w*\/\:\_\-\.\[\]\;\(\)\^]+)\s*\/\/ (.*)$') # E.g. 'field[name] ...'
|
||||
re_table_def = re.compile(r'^([\w0-9\_]+)\s*=\s*(.*)$') # E.g. 'field[name] ...'
|
||||
|
||||
for line in self.process_lines(lines):
|
||||
match = re_name_def.search(line)
|
||||
if match:
|
||||
#print('update_meta: ',line)
|
||||
cols[match.group(1).strip()] = {"type": match.group(2).strip(), "description": match.group(3).strip()}
|
||||
else:
|
||||
match = re_table_def.search(line)
|
||||
if match:
|
||||
keywords[match.group(1).strip()]=match.group(2).strip()
|
||||
print('>>',match.group(1), match.group(2))
|
||||
pass
|
||||
|
||||
class tDatSplitter(ascii.DefaultSplitter):
|
||||
"""Split lines on tab and do not remove whitespace"""
|
||||
delimiter = '|'
|
||||
process_line = None
|
||||
|
||||
class tDatData(ascii.BaseData):
|
||||
"""
|
||||
Basic table Data Reader
|
||||
|
||||
Set a few defaults for common ascii table formats
|
||||
(start at line 1, comments begin with ``#`` and possibly white space)
|
||||
"""
|
||||
#start_line = 1
|
||||
comment = r'\s*#'
|
||||
splitter_class = tDatSplitter
|
||||
|
||||
def process_lines(self, lines):
|
||||
in_data = False
|
||||
for line in lines:
|
||||
if line == "<END>":
|
||||
return
|
||||
elif line == "<DATA>":
|
||||
in_data = True
|
||||
elif in_data:
|
||||
yield line[:-1]
|
||||
|
||||
|
||||
|
||||
class tDat(ascii.BaseReader):
|
||||
r"""Character-delimited table with a single header line at the top.
|
||||
|
||||
Lines beginning with a comment character (default='#') as the first
|
||||
non-whitespace character are comments.
|
||||
|
||||
Example table::
|
||||
|
||||
# Column definition is the first uncommented line
|
||||
# Default delimiter is the space character.
|
||||
apples oranges pears
|
||||
|
||||
# Data starts after the header column definition, blank lines ignored
|
||||
1 2 3
|
||||
4 5 6
|
||||
"""
|
||||
_format_name = 'tdat'
|
||||
_description = 'Basic table with custom delimiters'
|
||||
_io_registry_format_aliases = ['heasarctdat']
|
||||
|
||||
header_class = tDatHeader
|
||||
data_class = tDatData
|
||||
|
||||
def read(self, table):
|
||||
output = ascii.BaseReader.read(self, table)
|
||||
self.table = output
|
||||
self.cols = self.header.cols
|
||||
return self.table
|
||||
|
0
heasarc/templatetags/__init__.py
Normal file
0
heasarc/templatetags/__init__.py
Normal file
62
heasarc/templatetags/heasarc_templates.py
Normal file
62
heasarc/templatetags/heasarc_templates.py
Normal file
@@ -0,0 +1,62 @@
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter(name='has_group')
|
||||
def has_group(user, group_name):
|
||||
return user.groups.filter(name=group_name).exists()
|
||||
|
||||
@register.filter
|
||||
def next(some_list, current_index):
|
||||
"""
|
||||
Returns the next element of the list using the current index if it exists.
|
||||
Otherwise returns an empty string.
|
||||
"""
|
||||
try:
|
||||
return some_list[int(current_index) + 1] # access the next element
|
||||
except:
|
||||
return '' # return empty string in case of exception
|
||||
|
||||
@register.filter
|
||||
def previous(some_list, current_index):
|
||||
"""
|
||||
Returns the previous element of the list using the current index if it exists.
|
||||
Otherwise returns an empty string.
|
||||
"""
|
||||
try:
|
||||
return some_list[int(current_index) - 1] # access the previous element
|
||||
except:
|
||||
return '' # return empty string in case of exception
|
||||
|
||||
@register.filter
|
||||
def remove_heasarc(value):
|
||||
return value.replace("Heasarc","")
|
||||
|
||||
@register.filter
|
||||
def remove_ikie(value):
|
||||
return value.replace("IKIe","")
|
||||
|
||||
@register.filter
|
||||
def remove_ikia(value):
|
||||
return value.replace("IKIa","")
|
||||
|
||||
@register.simple_tag
|
||||
def call_artsurvey_types_count(obj, *args):
|
||||
method = getattr(obj, 'get_artsurvey_count')
|
||||
return method(*args)
|
||||
|
||||
@register.filter
|
||||
def subtract(value, arg):
|
||||
return value - arg
|
||||
|
||||
"""
|
||||
Full example:
|
||||
|
||||
@register.simple_tag
|
||||
def call_method(obj, method_name, *args):
|
||||
method = getattr(obj, method_name)
|
||||
return method(*args)
|
||||
And then in your template:
|
||||
|
||||
{% call_method obj_customer 'get_something' obj_business %}
|
||||
"""
|
3
heasarc/tests.py
Normal file
3
heasarc/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
34
heasarc/urls.py
Normal file
34
heasarc/urls.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.index, name='heasarc index'),
|
||||
path('<int:pk_id>/update/<int:source_id>', views.update_heasarc_usercat, name='update usercat'),
|
||||
path('<int:pk_id>/delete/<int:source_id>', views.delete_heasarc_usercat, name='delete usercat'),
|
||||
path('<int:pk_id>/xray', views.show_heasarc_xray, name='show xray'),
|
||||
path('<int:pk_id>/xmmssc', views.show_heasarc_xmmssc, name='show xmmssc'),
|
||||
path('<int:pk_id>/xmmsl2', views.show_heasarc_xmmsl2, name='show xmmsl2'),
|
||||
path('<int:pk_id>/4xmmdr12', views.show_heasarc_4xmmdr12, name='show 4xmmdr12'),
|
||||
path('<int:pk_id>/4xmm', views.show_heasarc_4xmm, name='show 4xmm'),
|
||||
path('<int:pk_id>/csc', views.show_heasarc_csc, name='show csc'),
|
||||
path('<int:pk_id>/rass2rxs', views.show_heasarc_rass2rxs, name='show rass2rxs'),
|
||||
path('<int:pk_id>/maxi_gsc', views.show_heasarc_maxi_gsc, name='show maxi gsc'),
|
||||
path('<int:pk_id>/3maxi', views.show_heasarc_3maxi, name='show 3maxi'),
|
||||
path('<int:pk_id>/chanmaster', views.show_heasarc_chanmaster, name='show chanmaster'),
|
||||
path('<int:pk_id>/allwiseagn', views.show_heasarc_allwiseagn, name='show allwiseagn'),
|
||||
path('<int:pk_id>/2sxps', views.show_heasarc_2sxps, name='show 2sxps'),
|
||||
path('types', views.show_object_classes, name='heasarc object types'),
|
||||
path('<int:table_id>/table', views.show_table, name='show table'),
|
||||
path('<int:source_id>/gaia/<int:gaia_id>/', views.set_gaia, name='set GAIA'),
|
||||
path('<int:source_id>/gaia/clean/', views.clean_gaia, name='clean GAIA'),
|
||||
path('<int:source_id>/vlass/<int:vlass_id>/', views.set_vlass, name='set VLASS'),
|
||||
path('<int:source_id>/vlass/clean/', views.clean_vlass, name='clean VLASS'),
|
||||
path('<int:source_id>/glimpse/<int:glimpse_id>/', views.set_glimpse, name='set GLIMPSE'),
|
||||
path('<int:source_id>/glimpse/clean/', views.clean_glimpse, name='clean GLIMPSE'),
|
||||
path('<int:source_id>/allwise/<int:allwise_id>/', views.set_allwise, name='set AllWise'),
|
||||
path('<int:source_id>/allwise/clean/', views.clean_allwise, name='clean AllWise'),
|
||||
path('<int:source_id>/twomass/<int:twomass_id>/', views.set_twomass, name='set 2MASS'),
|
||||
path('<int:source_id>/twomass/clean/', views.clean_twomass, name='clean 2MASS'),
|
||||
path('<int:source_id>/', views.show_heasarc_base, name='show heasarc base'),
|
||||
]
|
86
heasarc/utils.py
Normal file
86
heasarc/utils.py
Normal file
@@ -0,0 +1,86 @@
|
||||
from django.core.paginator import Paginator
|
||||
import time
|
||||
|
||||
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
|
||||
|
||||
from heasarc.models import HeasarcBase
|
||||
from heasarc.models import NSIDE_SOURCES, ORDER
|
||||
|
||||
from astrobasis.models import VLASS
|
||||
from astrobasis.models import GLIMPSE
|
||||
from astrobasis.models import GAIADR3
|
||||
from astrobasis.models import AllWise
|
||||
from astrobasis.models import TwoMASS
|
||||
|
||||
def match_src(hp,src,counterpatscat, counterpartname,minrad=5,maxdist=30):
|
||||
|
||||
# testing for selected source
|
||||
#src = HeasarcBase.objects.get(pk=15314383)
|
||||
#print(src.name)
|
||||
|
||||
crd = SkyCoord(src.ra, src.dec, frame="fk5", unit="deg")
|
||||
heal = hp.cone_search_skycoord(crd, radius=maxdist*u.arcsecond)
|
||||
|
||||
try:
|
||||
cntp_cone = counterpatscat.filter(healpix__in=heal)
|
||||
#print("Selected in cone {} within {}".format(cntp_cone.count(),maxdist*u.arcsecond))
|
||||
except:
|
||||
return
|
||||
|
||||
cntp_list=[]
|
||||
for cntp in cntp_cone:
|
||||
cntp_crd = SkyCoord(cntp.ra, cntp.dec, frame="fk5", unit="deg")
|
||||
cntp_sep=crd.separation(cntp_crd).arcsecond
|
||||
if(cntp_sep <= minrad):
|
||||
#print("{} {}".format(cntp.name,cntp_sep))
|
||||
cntp_list.append(cntp)
|
||||
|
||||
getattr(src, counterpartname).clear()
|
||||
if(cntp_list):
|
||||
getattr(src, counterpartname).add(*cntp_list)
|
||||
|
||||
def heasarcbase_match(counterpatscat, counterpartname, perpage=10000, minrad=5,maxdist=30, survey=HeasarcBase):
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
srcs = survey.objects.all().filter(error_radius__lte=minrad)#.order_by("-id")
|
||||
print("Selected {} from {} objects with error_radius <= {} arcsec".format(srcs.count(), survey, minrad))
|
||||
print("Perform cone search for {} within {} srcsec".format(counterpartname,maxdist))
|
||||
|
||||
pages = Paginator(srcs, perpage)
|
||||
pages_count = pages.count
|
||||
pages_num = pages.num_pages
|
||||
pages_range = pages.page_range
|
||||
|
||||
for i in pages_range:
|
||||
page = pages.page(i)
|
||||
start_time0 = time.time()
|
||||
for src in page.object_list:
|
||||
match_src(hp, src, counterpatscat, counterpartname, minrad=minrad, maxdist=maxdist)
|
||||
elapsed = time.time() - start_time0
|
||||
estimated = (elapsed*(pages_num-i))/60/60
|
||||
print("{} match for {}: Page {}/{} for {:.2f} sec, est. {:.2f} hours".format(survey,
|
||||
counterpartname,i,
|
||||
pages_num,
|
||||
elapsed,
|
||||
estimated))
|
||||
def healpix_usercat(src):
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
crd = SkyCoord(src.ra, src.dec, frame="fk5", unit="deg")
|
||||
src.healpix = hp.skycoord_to_healpix(crd)
|
||||
src.lii=crd.galactic.l.value
|
||||
src.bii=crd.galactic.b.value
|
||||
src.save()
|
||||
|
||||
def match_usercat(src, counterpatscat, counterpartname, minrad=5,maxdist=30):
|
||||
hp = HEALPix(nside=NSIDE_SOURCES, order=ORDER, frame=FK5())
|
||||
match_src(hp, src, counterpatscat, counterpartname, minrad=minrad, maxdist=maxdist)
|
||||
|
||||
def match_usercat_all(src, minrad=5,maxdist=30):
|
||||
match_usercat(src, VLASS.objects.all(),"vlass", minrad=minrad,maxdist=maxdist)
|
||||
match_usercat(src, GLIMPSE.objects.all(),"glimpse", minrad=minrad,maxdist=maxdist)
|
||||
match_usercat(src, GAIADR3.objects.all(),"gaia3", minrad=minrad,maxdist=maxdist)
|
||||
match_usercat(src, AllWise.objects.all(),"allwise", minrad=minrad,maxdist=maxdist)
|
||||
match_usercat(src, TwoMASS.objects.all(),"twomass", minrad=minrad,maxdist=maxdist)
|
440
heasarc/views.py
Normal file
440
heasarc/views.py
Normal file
@@ -0,0 +1,440 @@
|
||||
from django.shortcuts import render
|
||||
from django.db.models import F
|
||||
from django.db.models import Q
|
||||
from django.db.models import DecimalField, Value
|
||||
from django.db.models import Max, Subquery, OuterRef, Min, Case, When, Min, Func
|
||||
from django.db.models.functions.math import Sqrt, Cos, Power, Abs
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden
|
||||
|
||||
from astropy import units as u
|
||||
from astropy.coordinates import SkyCoord
|
||||
from astropy.coordinates import ICRS, Galactic, FK5
|
||||
from astropy.coordinates import BarycentricTrueEcliptic
|
||||
from astropy.coordinates import HeliocentricTrueEcliptic
|
||||
from astropy.coordinates import GeocentricTrueEcliptic
|
||||
from astropy_healpix import HEALPix
|
||||
|
||||
from heasarc.utils import healpix_usercat
|
||||
from heasarc.utils import match_usercat_all
|
||||
|
||||
from heasarc.models import HeasarcTable
|
||||
from heasarc.models import TableColumn, HeasarcObjectClass, HeasarcBase
|
||||
from heasarc.models import HeasarcXrayMaster, HeasarcXMMSSC
|
||||
from heasarc.models import HeasarcUserCat, HeasarcUserCatForm
|
||||
from heasarc.models import HeasarcALLWISEAGN, HeasarcCHANMASTER
|
||||
from heasarc.models import HeasarcCSC, HeasarcRASS2RXS, Heasarc2SXPS
|
||||
from heasarc.models import Heasarc4XMMDR9
|
||||
from heasarc.models import Heasarc4XMMDR12
|
||||
from heasarc.models import HeasarcXMMSL2
|
||||
from heasarc.models import Heasarc3MAXI
|
||||
from heasarc.models import HeasarcMAXIGSCHGL
|
||||
|
||||
from srgcat.models import ArtCat
|
||||
|
||||
from srglib.utils import make_source_name
|
||||
|
||||
from astrobasis.models import GAIADR3
|
||||
from astrobasis.models import VLASS
|
||||
from astrobasis.models import GLIMPSE
|
||||
from astrobasis.models import AllWise
|
||||
from astrobasis.models import TwoMASS
|
||||
|
||||
from artsurvey.models import ArtSurveySource
|
||||
|
||||
# Create your views here.
|
||||
|
||||
def index(request):
|
||||
tables = HeasarcTable.objects.all()
|
||||
xmmssc = HeasarcBase.objects.instance_of(HeasarcXMMSSC)
|
||||
xray = HeasarcBase.objects.instance_of(HeasarcXrayMaster)
|
||||
chanmaster = HeasarcBase.objects.instance_of(HeasarcCHANMASTER)
|
||||
csc = HeasarcBase.objects.instance_of(HeasarcCSC)
|
||||
rass2rxs = HeasarcBase.objects.instance_of(HeasarcRASS2RXS)
|
||||
twosxps = HeasarcBase.objects.instance_of(Heasarc2SXPS)
|
||||
allwiseagn = HeasarcBase.objects.instance_of(HeasarcALLWISEAGN)
|
||||
xmmdr9 = HeasarcBase.objects.instance_of(Heasarc4XMMDR9)
|
||||
xmmssc_count = xmmssc.count()
|
||||
xmmdr9_count = xmmdr9.count()
|
||||
chanmaster_count = chanmaster.count()
|
||||
csc_count = csc.count()
|
||||
rass2rxs_count = rass2rxs.count()
|
||||
xray_count = xray.count()
|
||||
twosxps_count = twosxps.count()
|
||||
allwiseagn_count = allwiseagn.count()
|
||||
return render(request,'heasarc/index.html', {'tables': tables,
|
||||
'xmmdr9_count':xmmdr9_count,
|
||||
'xmmssc_count':xmmssc_count,
|
||||
'chanmaster_count':chanmaster_count,
|
||||
'csc_count':csc_count,'twosxps_count':twosxps_count,
|
||||
'allwiseagn_count':allwiseagn_count,
|
||||
'rass2rxs_count':rass2rxs_count,'xray_count':xray_count,})
|
||||
|
||||
def show_object_classes(request):
|
||||
classes = HeasarcObjectClass.objects.all().order_by('class_id') #.exclude(class_name='UNCLASSIFIED').distinct('class_name')
|
||||
return render(request,'heasarc/show_object_classes.html', {'classes': classes,})
|
||||
|
||||
def show_table(request, table_id):
|
||||
try:
|
||||
table=HeasarcTable.objects.get(pk=table_id)
|
||||
except:
|
||||
return HttpResponse("This table was not found")
|
||||
columns = table.tablecolumn_set.all()
|
||||
tables = HeasarcTable.objects.all()
|
||||
return render(request,'heasarc/index.html', {'tables': tables,'table':table,'columns':columns})
|
||||
|
||||
|
||||
def show_heasarc_xray(request, pk_id):
|
||||
try:
|
||||
heasarc=HeasarcXrayMaster.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This HeasarcXrayMaster was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_xray.html',
|
||||
{'heasarc':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def show_heasarc_xmmssc(request, pk_id):
|
||||
try:
|
||||
heasarc=HeasarcXMMSSC.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This HeasarcXMMSSC was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_xmmssc.html',
|
||||
{'heasarc':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def show_heasarc_4xmmdr12(request, pk_id):
|
||||
try:
|
||||
heasarc=Heasarc4XMMDR12.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("Object was not found")
|
||||
|
||||
return render(request,'heasarc/show_heasarc_4xmmdr12.html', {'heasarc':heasarc,})
|
||||
|
||||
|
||||
def show_heasarc_3maxi(request, pk_id):
|
||||
try:
|
||||
heasarc=Heasarc3MAXI.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This Heasarc3MAXI was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_3maxi.html',
|
||||
{'heasarc':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def show_heasarc_xmmsl2(request, pk_id):
|
||||
try:
|
||||
src=HeasarcXMMSL2.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This HeasarcXMMSL2 was not found")
|
||||
|
||||
crd = SkyCoord(src.ra, src.dec, frame="fk5", unit="deg")
|
||||
|
||||
gaia = src.gaia3.all()
|
||||
|
||||
gaia_ex = gaia.exclude(Q(pmra__abs__gt=F("pmra_error")*Value(4.)) | Q(pmdec__abs__gt=F("pmdec_error")*Value(4.)) | Q(parallax__abs__gt=F("parallax_error")*Value(4.)))
|
||||
gaia_ex = gaia_ex.annotate(separation=Value(0.0, output_field=DecimalField()))
|
||||
for gaiasrc in gaia_ex:
|
||||
gaia_crd=SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")
|
||||
gaiasrc.separation=crd.separation(SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")).arcsecond
|
||||
|
||||
|
||||
gaia_pm = gaia.filter(Q(pmra__abs__gt=F("pmra_error")*Value(4.)) | Q(pmdec__abs__gt=F("pmdec_error")*Value(4.)))
|
||||
gaia_pm = gaia_pm.annotate(separation=Value(0.0, output_field=DecimalField()))
|
||||
for gaiasrc in gaia_pm:
|
||||
gaia_crd=SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")
|
||||
gaiasrc.separation=crd.separation(gaia_crd).arcsecond
|
||||
|
||||
|
||||
gaia_plx = gaia.filter(Q(parallax__abs__gt=F("parallax_error")*Value(4.)))
|
||||
gaia_plx = gaia_plx.annotate(separation=Value(0.0, output_field=DecimalField()))
|
||||
|
||||
for gaiasrc in gaia_plx:
|
||||
gaia_crd=SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")
|
||||
gaiasrc.separation=crd.separation(SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")).arcsecond
|
||||
|
||||
|
||||
return render(request,'heasarc/show_heasarc_xmmsl2.html',
|
||||
{'src':src,'gaia_plx':gaia_plx,'gaia_pm':gaia_pm,'gaia_ex':gaia_ex})
|
||||
|
||||
def annotate_separation(srcs, source_crd):
|
||||
srcs = srcs.annotate(separation=Value(0.0, output_field=DecimalField()))
|
||||
for src in srcs:
|
||||
crd = SkyCoord(src.ra, src.dec, frame="fk5", unit="deg")
|
||||
src.separation=source_crd.separation(crd).arcsecond
|
||||
return srcs
|
||||
|
||||
|
||||
def show_heasarc_base(request, source_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
crd = SkyCoord(src.ra, src.dec, frame="fk5", unit="deg")
|
||||
|
||||
artsurveysources_listed = src.artsurveysource_set.all()
|
||||
artsurveysources_linked = src.artsurveysource_linked.all()
|
||||
|
||||
gaia = src.gaia3.all()
|
||||
|
||||
usercat = annotate_separation(src.usercat.all(), crd)
|
||||
vlass = annotate_separation(src.vlass.all(), crd)
|
||||
glimpse = annotate_separation(src.glimpse.all(), crd)
|
||||
twomass = annotate_separation(src.twomass.all(), crd)
|
||||
allwise = annotate_separation(src.allwise.all(), crd)
|
||||
|
||||
gaia_ex = gaia.exclude(Q(pmra__abs__gt=F("pmra_error")*Value(4.)) | Q(pmdec__abs__gt=F("pmdec_error")*Value(4.)) | Q(parallax__abs__gt=F("parallax_error")*Value(4.)))
|
||||
gaia_ex = gaia_ex.annotate(separation=Value(0.0, output_field=DecimalField()))
|
||||
for gaiasrc in gaia_ex:
|
||||
gaia_crd=SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")
|
||||
gaiasrc.separation=crd.separation(SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")).arcsecond
|
||||
|
||||
|
||||
gaia_pm = gaia.filter(Q(pmra__abs__gt=F("pmra_error")*Value(4.)) | Q(pmdec__abs__gt=F("pmdec_error")*Value(4.)))
|
||||
gaia_pm = gaia_pm.annotate(separation=Value(0.0, output_field=DecimalField()))
|
||||
for gaiasrc in gaia_pm:
|
||||
gaia_crd=SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")
|
||||
gaiasrc.separation=crd.separation(gaia_crd).arcsecond
|
||||
gaia_plx = gaia.filter(Q(parallax__abs__gt=F("parallax_error")*Value(4.)))
|
||||
gaia_plx = gaia_plx.annotate(separation=Value(0.0, output_field=DecimalField()))
|
||||
|
||||
for gaiasrc in gaia_plx:
|
||||
gaia_crd=SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")
|
||||
gaiasrc.separation=crd.separation(SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")).arcsecond
|
||||
|
||||
|
||||
return render(request,'heasarc/show_heasarc_base.html',
|
||||
{'src':src,'usercat':usercat,
|
||||
'vlass':vlass,
|
||||
'glimpse':glimpse,
|
||||
'twomass':twomass,
|
||||
'allwise':allwise,
|
||||
'artsurveysources_listed':artsurveysources_listed,
|
||||
'artsurveysources_linked':artsurveysources_linked,
|
||||
'gaia_plx':gaia_plx,'gaia_pm':gaia_pm,'gaia_ex':gaia_ex})
|
||||
|
||||
|
||||
|
||||
|
||||
def show_heasarc_4xmm(request, pk_id):
|
||||
try:
|
||||
heasarc=Heasarc4XMMDR9.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This Heasarc4XMMDR9 was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_4xmm.html',
|
||||
{'src':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
|
||||
def show_heasarc_chanmaster(request, pk_id):
|
||||
try:
|
||||
heasarc=HeasarcCHANMASTER.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This HeasarcCHANMASTER was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_chanmaster.html',
|
||||
{'heasarc':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def show_heasarc_csc(request, pk_id):
|
||||
try:
|
||||
heasarc=HeasarcCSC.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This HeasarcCSC was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
|
||||
gaia = heasarc.gaia3.all()
|
||||
|
||||
gaia_plx = gaia.filter(Q(parallax__abs__gt=F("parallax_error")*Value(4.)))
|
||||
gaia_plx = gaia_plx.annotate(separation=Value(0.0, output_field=DecimalField()))
|
||||
gaia_plx = gaia_plx.annotate(erosita_separation=Value(0.0, output_field=DecimalField()))
|
||||
for gaiasrc in gaia_plx:
|
||||
gaia_crd=SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")
|
||||
gaiasrc.separation=c.separation(SkyCoord(gaiasrc.ra, gaiasrc.dec, frame="fk5", unit="deg")).arcsecond
|
||||
if not erosita is None:
|
||||
gaiasrc.erosita_separation=erosita_crd.separation(gaia_crd).arcsecond
|
||||
|
||||
return render(request,'heasarc/show_heasarc_csc.html',
|
||||
{'heasarc':heasarc,
|
||||
'gaia_plx':gaia_plx,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def show_heasarc_rass2rxs(request, pk_id):
|
||||
try:
|
||||
heasarc=HeasarcRASS2RXS.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This HeasarcRASS2RXS was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_rass2rxs.html',
|
||||
{'heasarc':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def show_heasarc_maxi_gsc(request, pk_id):
|
||||
try:
|
||||
heasarc=HeasarcMAXIGSCHGL.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This HeasarcRASS2RXS was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_maxi_gsc.html',
|
||||
{'heasarc':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def show_heasarc_allwiseagn(request, pk_id):
|
||||
try:
|
||||
heasarc=HeasarcALLWISEAGN.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This HeasarcALLWISEAGN was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_allwiseagn.html',
|
||||
{'heasarc':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def show_heasarc_2sxps(request, pk_id):
|
||||
try:
|
||||
heasarc=Heasarc2SXPS.objects.get(pk=pk_id)
|
||||
except:
|
||||
return HttpResponse("This Heasarc2SXPS was not found")
|
||||
erotrans_set = heasarc.erotranssource_set.all()
|
||||
erosurvey_set = heasarc.erosurveysource_set.all()
|
||||
artcat_set = heasarc.artsource_set.all()
|
||||
return render(request,'heasarc/show_heasarc_2sxps.html',
|
||||
{'heasarc':heasarc,
|
||||
'artcat_set':artcat_set,
|
||||
'erosurvey_set':erosurvey_set,
|
||||
'erotrans_set':erotrans_set,})
|
||||
|
||||
def set_gaia(request,source_id,gaia_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.gaia3_primary = get_object_or_404(GAIADR3, pk=gaia_id)
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
def clean_gaia(request,source_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.gaia3_primary=None
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
def set_vlass(request,source_id,vlass_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.vlass_primary = get_object_or_404(VLASS, pk=vlass_id)
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
def clean_vlass(request,source_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.vlass_primary=None
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
def set_glimpse(request,source_id,glimpse_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.glimpse_primary = get_object_or_404(GLIMPSE, pk=glimpse_id)
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
def clean_glimpse(request,source_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.glimpse_primary=None
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
|
||||
def set_twomass(request,source_id,twomass_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.twomass_primary = get_object_or_404(TwoMASS, pk=twomass_id)
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
def clean_twomass(request,source_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.twomass_primary=None
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
def set_allwise(request,source_id,allwise_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.allwise_primary = get_object_or_404(AllWise, pk=allwise_id)
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
def clean_allwise(request,source_id):
|
||||
src = get_object_or_404(HeasarcBase, pk=source_id)
|
||||
src.allwise_primary=None
|
||||
src.save()
|
||||
return HttpResponseRedirect(src.get_base_url())
|
||||
|
||||
|
||||
|
||||
def update_heasarc_usercat(request,pk_id,source_id):
|
||||
src = get_object_or_404(ArtSurveySource, pk=source_id)
|
||||
obj = get_object_or_404(HeasarcUserCat, pk=pk_id)
|
||||
srcs = obj.artsurveysource_set.all()
|
||||
srcs_linked = obj.artsurveysource_linked.all()
|
||||
|
||||
if request.method == 'POST': # If the form has been submitted...
|
||||
form = HeasarcUserCatForm(request.POST,instance=obj) # A form bound to the POST data
|
||||
if form.is_valid(): # All validation rules pass
|
||||
new_form=form.save(commit=False)
|
||||
ra=float(form.cleaned_data['ra'])
|
||||
dec=float(form.cleaned_data['dec'])
|
||||
name = form.cleaned_data['name'] if (form.cleaned_data['name']) else 'NONAME'
|
||||
autoname=form.cleaned_data['autoname']
|
||||
if(autoname):
|
||||
new_form.name=make_source_name(name,ra,dec)
|
||||
new_form.save()
|
||||
healpix_usercat(new_form)
|
||||
match_usercat_all(new_form)
|
||||
|
||||
#category = form.cleaned_data['category']
|
||||
#new_form.category=category
|
||||
#new_form.save()
|
||||
return HttpResponseRedirect(src.get_absolute_url())
|
||||
else:
|
||||
return render(request,'artsurvey/usercat.html', {'form':form,'src':src,'srcs':srcs,'srcs_linked':srcs_linked,})
|
||||
|
||||
else:
|
||||
form = HeasarcUserCatForm(instance=obj)
|
||||
return render(request,'artsurvey/usercat.html', {'form':form,'obj':obj,'src':src,'srcs':srcs,'srcs_linked':srcs_linked,})
|
||||
|
||||
|
||||
def delete_heasarc_usercat(request,pk_id,source_id):
|
||||
src = get_object_or_404(ArtSurveySource, pk=source_id)
|
||||
obj = get_object_or_404(HeasarcUserCat, pk=pk_id)
|
||||
obj.delete()
|
||||
return HttpResponseRedirect(src.get_absolute_url())
|
Reference in New Issue
Block a user