8 March work
This commit is contained in:
58
scripts/00_check.py
Executable file
58
scripts/00_check.py
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python
|
||||
"""Печатает информацию о наблюдениях
|
||||
|
||||
"""
|
||||
|
||||
from astropy.wcs import WCS
|
||||
from astropy.io import fits
|
||||
import sys, os, os.path, time, subprocess
|
||||
from pathlib import Path
|
||||
import numpy as np
|
||||
import glob
|
||||
from os.path import dirname
|
||||
import inspect
|
||||
import uds
|
||||
|
||||
from uds.utils import *
|
||||
from uds.config import *
|
||||
|
||||
outkey="mosa_tm0"
|
||||
|
||||
""" find UDS root dir """
|
||||
root_path=dirname(dirname(dirname(inspect.getfile(uds))))
|
||||
print("UDS root path: {}".format(root_path))
|
||||
|
||||
infile_dir=root_path+'/data/processed'
|
||||
outfile_dir=root_path+'/products'
|
||||
create_folder(outfile_dir)
|
||||
|
||||
index=5
|
||||
|
||||
events=[]
|
||||
expmaps=[]
|
||||
totexp=0.0
|
||||
for tmkey in keylist_tm.keys():
|
||||
print("TM{} in work... init events".format(tmkey))
|
||||
for datakey in keylist_tm[tmkey]:
|
||||
print("--> {}".format(datakey))
|
||||
""" Запускаем полностью в холостом режиме, нам нужно получить только названия файлов """
|
||||
outfile_evtool,outfile_expmap=init_events(key=datakey, eband_index=eband[index],
|
||||
infile_dir=infile_dir,
|
||||
outfile_dir=outfile_dir,
|
||||
do_init=False,
|
||||
do_obsmode=False,
|
||||
do_center=False,
|
||||
do_evtool=False,
|
||||
do_expmap=False,
|
||||
ra_cen=ra_cen, de_cen=de_cen,
|
||||
emin_kev=emin_kev[index],
|
||||
emax_kev=emax_kev[index])
|
||||
events.append(outfile_evtool)
|
||||
expmaps.append(outfile_expmap)
|
||||
tstart, tstop = read_tstart_tstop(infile=outfile_evtool)
|
||||
totexp=totexp+(tstop-tstart)
|
||||
print("{} {} {} {}".format(outfile_evtool,tstart,tstop,(tstop-tstart)/1000))
|
||||
|
||||
print("\n***\n*** Total exposure: {:.1f} ks\n***".format(totexp))
|
||||
|
||||
|
@@ -27,9 +27,14 @@ infile_dir=root_path+'/data/processed'
|
||||
outfile_dir=root_path+'/products'
|
||||
create_folder(outfile_dir)
|
||||
|
||||
index=4
|
||||
index=5
|
||||
|
||||
do_init = True
|
||||
do_merge = True
|
||||
do_adapt = False # requires CIAO
|
||||
|
||||
events=[]
|
||||
expmaps=[]
|
||||
for tmkey in keylist_tm.keys():
|
||||
print("TM{} in work... init events".format(tmkey))
|
||||
for datakey in keylist_tm[tmkey]:
|
||||
@@ -38,6 +43,7 @@ for tmkey in keylist_tm.keys():
|
||||
outfile_evtool,outfile_expmap=init_events(key=datakey, eband_index=eband[index],
|
||||
infile_dir=infile_dir,
|
||||
outfile_dir=outfile_dir,
|
||||
do_init=do_init,
|
||||
do_obsmode=True,
|
||||
do_center=True,
|
||||
do_evtool=True,
|
||||
@@ -46,8 +52,15 @@ for tmkey in keylist_tm.keys():
|
||||
emin_kev=emin_kev[index],
|
||||
emax_kev=emax_kev[index])
|
||||
events.append(outfile_evtool)
|
||||
|
||||
expmaps.append(outfile_expmap)
|
||||
|
||||
""" Собираем общий список событий """
|
||||
outfile_evtool="{}_EventList_en{}.fits".format(os.path.join(outfile_dir,outkey), eband[index])
|
||||
do_evtool_esass(events=events, outfile=outfile_evtool)
|
||||
|
||||
outfile_expmap="{}_ExposureMap_en{}.fits".format(os.path.join(outfile_dir,outkey), eband[index])
|
||||
if(do_merge==True):
|
||||
do_evtool_esass(events=events, outfile=outfile_evtool)
|
||||
|
||||
outfile_adapt="{}_ImageAdapt_en{}.fits".format(os.path.join(outfile_dir,outkey), eband[index])
|
||||
if(do_adapt==True):
|
||||
do_adapt_ciao(infile=outfile_evtool, outfile=outfile_adapt)
|
||||
|
||||
|
@@ -315,10 +315,10 @@ def runme(datakey):
|
||||
save_catprep_ds9reg(catprep,scale=60*60)
|
||||
|
||||
if(do_cross_match==True):
|
||||
hdulist = fits.open(detmask)
|
||||
w = WCS(hdulist[0].header)
|
||||
w.wcs.crval=wcslist[datakey]
|
||||
crossmatch_shu2019(catprep,w=w,naxis1=hdulist[0].header['NAXIS1'],naxis2=hdulist[0].header['NAXIS2'],
|
||||
#hdulist = fits.open(detmask)
|
||||
#w = WCS(hdulist[0].header)
|
||||
#w.wcs.crval=wcslist[datakey]
|
||||
crossmatch_shu2019(catprep,dlmin=10,refimage=detmask,crval=wcslist[datakey],
|
||||
catalog=root_path+"/data/Gaia_unWISE/Gaia_unWISE_UDS.fits.catalog")
|
||||
|
||||
"""
|
||||
@@ -362,13 +362,13 @@ def runme(datakey):
|
||||
wcs_update(outfile_evtool[ii],crval=wcslist[key],transformfile=xfm)
|
||||
"""
|
||||
|
||||
runme("tm7_obs_1")
|
||||
#runme("tm7_obs_1")
|
||||
|
||||
|
||||
"""
|
||||
for tmkey in keylist_tm.keys():
|
||||
print("TM{} in work... init events".format(tmkey))
|
||||
for datakey in keylist_tm[tmkey]:
|
||||
print("--> {}".format(datakey))
|
||||
runme(datakey)
|
||||
|
||||
"""
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Подготовка рабочего окружения:
|
||||
```
|
||||
source venv/bin/activate.csh
|
||||
esass
|
||||
source <MY PATH>/venv/bin/activate.csh
|
||||
source <MY PATH>/eSASS4EDR/bin/esass-init.csh
|
||||
```
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user