forked from erosita/uds
coma
This commit is contained in:
parent
233967b1fd
commit
6a960edbdc
@ -1,5 +1,6 @@
|
|||||||
# uds
|
# uds
|
||||||
|
|
||||||
|
|
||||||
Содержит код для обработки данных поля Coma.
|
Содержит код для обработки данных поля Coma.
|
||||||
|
|
||||||
# Установка
|
# Установка
|
||||||
|
@ -780,6 +780,18 @@ def crossmatch_dr12(filename,devmax=30,ext_like=0.0,outkey='dr12', catalog=None)
|
|||||||
freg.close()
|
freg.close()
|
||||||
ftex.close()
|
ftex.close()
|
||||||
|
|
||||||
|
|
||||||
|
def do_resid_map(data=None, model=None, outfile=None, expmap=None, expcut=None):
|
||||||
|
data_map, data_hdr = fits.getdata(data, ext=0, header=True)
|
||||||
|
model_map, model_hdr = fits.getdata(model, ext=0, header=True)
|
||||||
|
resid_map = data_map - model_map
|
||||||
|
if(expcut):
|
||||||
|
expo_map, expo_hdr = fits.getdata(model, ext=0, header=True)
|
||||||
|
#index = np.where(expo_map < expcut)
|
||||||
|
#data_map[index]=0.0
|
||||||
|
fits.writeto(outfile, resid_map, data_hdr, overwrite=True)
|
||||||
|
|
||||||
|
|
||||||
def do_adapt_ciao(infile=None,outfile=None,expmap=None,function='tophat',expcut=None):
|
def do_adapt_ciao(infile=None,outfile=None,expmap=None,function='tophat',expcut=None):
|
||||||
if not (infile and expmap and outfile):
|
if not (infile and expmap and outfile):
|
||||||
print("ERROR: Please provide input and output files")
|
print("ERROR: Please provide input and output files")
|
||||||
|
@ -81,7 +81,7 @@ for i in range(len(partII)-1):
|
|||||||
### Survey ###
|
### Survey ###
|
||||||
if(do_survey):
|
if(do_survey):
|
||||||
for m in tm_list:
|
for m in tm_list:
|
||||||
do_evtool_esass(evlist=el+'tm{}_survey.txt'.format(m), outfile=pr+'tm{}_survey.fits'.format(m), emin=0.2, emax=10.0, rmlock=True, rusky=True)
|
do_evtool_esass(evlist=el+'tm{}_survey.txt'.format(m), outfile=pr+'tm{}_survey.fits'.format(m), emin=0.2, emax=10.0, rmlock=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ create_folder(outfile_dir)
|
|||||||
local_run = True
|
local_run = True
|
||||||
|
|
||||||
|
|
||||||
do_init = True
|
do_init = False
|
||||||
do_merge = True
|
do_merge = False
|
||||||
do_detmask = False
|
do_detmask = False
|
||||||
do_expmap = False
|
do_expmap = False
|
||||||
do_erbox1 = False # local mode
|
do_erbox1 = False # local mode
|
||||||
@ -87,6 +87,7 @@ do_erbox3 = False # map mode, with background map
|
|||||||
do_erbackmap3 = False #
|
do_erbackmap3 = False #
|
||||||
do_ersensmap = False
|
do_ersensmap = False
|
||||||
do_ermldet = False
|
do_ermldet = False
|
||||||
|
do_resid = True # residuals of data and source map
|
||||||
do_fixcat = False # only for index=0
|
do_fixcat = False # only for index=0
|
||||||
do_fixxmm = False # prepare forced photometry, only for index=0
|
do_fixxmm = False # prepare forced photometry, only for index=0
|
||||||
do_apetool = False
|
do_apetool = False
|
||||||
@ -105,9 +106,10 @@ comm='' # for 4XMM-DR12 forced photometry use '-xmm'
|
|||||||
|
|
||||||
vign=True
|
vign=True
|
||||||
attcorr=False
|
attcorr=False
|
||||||
|
rusky=True
|
||||||
|
|
||||||
keylist = keylist_tm
|
keylist = keylist_survey
|
||||||
outkey = "mosa_all_tm0{}".format('_attcorr' if (attcorr==True) else '')
|
outkey = "mosa_survey_tm0{}".format('_attcorr' if (attcorr==True) else '')
|
||||||
|
|
||||||
"""
|
"""
|
||||||
mosa_scans_tm0 -- all scans individually (keylist_scans)
|
mosa_scans_tm0 -- all scans individually (keylist_scans)
|
||||||
@ -156,9 +158,9 @@ if(do_merge==True):
|
|||||||
f.close()
|
f.close()
|
||||||
print(outfile_evtool)
|
print(outfile_evtool)
|
||||||
do_check_events(events=events)
|
do_check_events(events=events)
|
||||||
do_evtool_esass(evlist=evlist, outfile=outfile_evtool, width=width)
|
do_evtool_esass(evlist=evlist, outfile=outfile_evtool, width=width, rusky=rusky)
|
||||||
#if(os.path.isfile(evlist)==True):
|
if(os.path.isfile(evlist)==True):
|
||||||
# os.remove(evlist)
|
os.remove(evlist)
|
||||||
|
|
||||||
|
|
||||||
""" makes detmask from TM exposures """
|
""" makes detmask from TM exposures """
|
||||||
@ -277,6 +279,7 @@ if(do_erbackmap3==True):
|
|||||||
if(forced==True):
|
if(forced==True):
|
||||||
mllist="{}_MaxLikSourceList_en{:02d}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[index], comm, outfile_post)
|
mllist="{}_MaxLikSourceList_en{:02d}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[index], comm, outfile_post)
|
||||||
srcmap="{}_SourceMap_en{:02d}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[index], comm, outfile_post)
|
srcmap="{}_SourceMap_en{:02d}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[index], comm, outfile_post)
|
||||||
|
residmap="{}_ResidMap_en{:02d}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[index], comm, outfile_post)
|
||||||
|
|
||||||
""" for en1,2,3,6 give mllist from en0 as input """
|
""" for en1,2,3,6 give mllist from en0 as input """
|
||||||
#boxlist3="{}_MaxLikSourceList_en{:02d}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[0], comm, outfile_post)
|
#boxlist3="{}_MaxLikSourceList_en{:02d}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[0], comm, outfile_post)
|
||||||
@ -300,6 +303,7 @@ if(forced==True):
|
|||||||
else:
|
else:
|
||||||
mllist="{}_MaxLikSourceList_en{:02d}{}".format(os.path.join(outfile_dir,outkey), eband[index], outfile_post)
|
mllist="{}_MaxLikSourceList_en{:02d}{}".format(os.path.join(outfile_dir,outkey), eband[index], outfile_post)
|
||||||
srcmap="{}_SourceMap_en{:02d}{}".format(os.path.join(outfile_dir,outkey), eband[index], outfile_post)
|
srcmap="{}_SourceMap_en{:02d}{}".format(os.path.join(outfile_dir,outkey), eband[index], outfile_post)
|
||||||
|
residmap="{}_ResidMap_en{:02d}{}".format(os.path.join(outfile_dir,outkey), eband[index], outfile_post)
|
||||||
boxlist3 = outfile_boxlist3
|
boxlist3 = outfile_boxlist3
|
||||||
fitpos_flag="fitpos_flag=yes"
|
fitpos_flag="fitpos_flag=yes"
|
||||||
fitext_flag="fitext_flag=yes"
|
fitext_flag="fitext_flag=yes"
|
||||||
@ -377,7 +381,10 @@ if(do_ermldet==True):
|
|||||||
# for a some reason, for an arbitrary energy band, ermldet break order of sources. Do this forced correction.
|
# for a some reason, for an arbitrary energy band, ermldet break order of sources. Do this forced correction.
|
||||||
if(result == False):
|
if(result == False):
|
||||||
correct_srcid_ermldet_forced(mllist)
|
correct_srcid_ermldet_forced(mllist)
|
||||||
|
if(do_resid==True):
|
||||||
|
do_resid_map(data=outfile_evtool, model=srcmap, outfile=residmap)
|
||||||
|
|
||||||
|
|
||||||
if(do_fixcat==True):
|
if(do_fixcat==True):
|
||||||
if not index == 0:
|
if not index == 0:
|
||||||
print("ERROR: You can fix only reference catalog for en0.")
|
print("ERROR: You can fix only reference catalog for en0.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user