1
0
forked from erosita/uds
This commit is contained in:
Roman Krivonos 2024-12-02 11:14:30 +03:00
parent 233967b1fd
commit 6a960edbdc
4 changed files with 28 additions and 8 deletions

View File

@ -1,5 +1,6 @@
# uds
Содержит код для обработки данных поля Coma.
# Установка

View File

@ -780,6 +780,18 @@ def crossmatch_dr12(filename,devmax=30,ext_like=0.0,outkey='dr12', catalog=None)
freg.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):
if not (infile and expmap and outfile):
print("ERROR: Please provide input and output files")

View File

@ -81,7 +81,7 @@ for i in range(len(partII)-1):
### Survey ###
if(do_survey):
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)

View File

@ -75,8 +75,8 @@ create_folder(outfile_dir)
local_run = True
do_init = True
do_merge = True
do_init = False
do_merge = False
do_detmask = False
do_expmap = False
do_erbox1 = False # local mode
@ -87,6 +87,7 @@ do_erbox3 = False # map mode, with background map
do_erbackmap3 = False #
do_ersensmap = False
do_ermldet = False
do_resid = True # residuals of data and source map
do_fixcat = False # only for index=0
do_fixxmm = False # prepare forced photometry, only for index=0
do_apetool = False
@ -105,9 +106,10 @@ comm='' # for 4XMM-DR12 forced photometry use '-xmm'
vign=True
attcorr=False
rusky=True
keylist = keylist_tm
outkey = "mosa_all_tm0{}".format('_attcorr' if (attcorr==True) else '')
keylist = keylist_survey
outkey = "mosa_survey_tm0{}".format('_attcorr' if (attcorr==True) else '')
"""
mosa_scans_tm0 -- all scans individually (keylist_scans)
@ -156,9 +158,9 @@ if(do_merge==True):
f.close()
print(outfile_evtool)
do_check_events(events=events)
do_evtool_esass(evlist=evlist, outfile=outfile_evtool, width=width)
#if(os.path.isfile(evlist)==True):
# os.remove(evlist)
do_evtool_esass(evlist=evlist, outfile=outfile_evtool, width=width, rusky=rusky)
if(os.path.isfile(evlist)==True):
os.remove(evlist)
""" makes detmask from TM exposures """
@ -277,6 +279,7 @@ if(do_erbackmap3==True):
if(forced==True):
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)
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 """
#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:
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)
residmap="{}_ResidMap_en{:02d}{}".format(os.path.join(outfile_dir,outkey), eband[index], outfile_post)
boxlist3 = outfile_boxlist3
fitpos_flag="fitpos_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.
if(result == False):
correct_srcid_ermldet_forced(mllist)
if(do_resid==True):
do_resid_map(data=outfile_evtool, model=srcmap, outfile=residmap)
if(do_fixcat==True):
if not index == 0:
print("ERROR: You can fix only reference catalog for en0.")