Many changes

This commit is contained in:
2024-03-18 14:46:38 +03:00
parent 4e5f88e166
commit afe3862cda
24 changed files with 55736 additions and 236 deletions

View File

@@ -13,7 +13,7 @@
ВЫЗОВ:
esass
./01_mosaics.py
./04_mosaics.py
УПРАВЛЕНИЕ:
@@ -74,37 +74,39 @@ local_run = False
outkey="tm0"
do_init = False
do_merge = False
do_detmask = False
do_expmap = False
do_erbox1 = False # local mode
do_erbackmap1 = False #
do_erbox2 = False # map mode, with background map
do_erbackmap2 = False #
do_erbox3 = False # map mode, with background map
do_erbackmap3 = False #
do_init = True
do_merge = True
do_detmask = True
do_expmap = True
do_erbox1 = True # local mode
do_erbackmap1 = True #
do_erbox2 = True # map mode, with background map
do_erbackmap2 = True #
do_erbox3 = True # map mode, with background map
do_erbackmap3 = True #
do_ersensmap = False
do_ermldet = False
do_ermldet = True
do_fixcat = False # only for index=0
do_fixxmm = True # only for index=0
do_fixxmm = False # prepare forced photometry, only for index=0
do_apetool = False
do_catprep = False
do_catprep = True
do_filter_catalog = False
do_cross_match = False
index=0
index=3
forced=False
""" If forced=True, take input catalog from energy range en0 """
comm='-xmm' # for 4XMM-DR12 forced photometry use '-xmm'
comm='' # for 4XMM-DR12 forced photometry use '-xmm'
vign=True
vignetting = 'vign' if (vign==True) else 'novign'
attcorr=True
events=[]
expmaps=[]
bkgmaps=[]
@@ -113,7 +115,7 @@ for tmkey in keylist_tm.keys():
for datakey in keylist_tm[tmkey]:
print("--> {}".format(datakey))
""" Подготавливаем списки событий индивидуальных наблюдений """
outfile_evtool,outfile_expmap=init_events(key=datakey,
outfile_evtool,outfile_expmap=init_events(key=datakey,attcorr=attcorr,
eband_index=eband[index],
infile_dir=infile_dir,
outfile_dir=outfile_dir,
@@ -121,7 +123,7 @@ for tmkey in keylist_tm.keys():
do_obsmode=False,
do_center=False,
do_evtool=True,
do_expmap=True,
do_expmap=False,
vign=vign,
ra_cen=ra_cen, de_cen=de_cen,
emin_kev=emin_kev[index],
@@ -138,7 +140,7 @@ if(do_merge==True):
do_evtool_esass(events=events, outfile=outfile_evtool)
""" makes detmask from TM exposures """
""" makes detmask from TM exposures """
detmask="{}/{}_DetectorMask_en{}{}".format(outfile_dir,
outkey,
eband[index],
@@ -256,19 +258,20 @@ if(forced==True):
srcmap="{}_SourceMap_en{}.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{}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[0], comm, outfile_post)
if(index==0):
boxlist3="{}_MaxLikSourceList_en{}.fixed{}{}".format(os.path.join(outfile_dir,outkey), eband[0], comm, outfile_post)
if not (os.path.exists(boxlist3)):
print("{} not found. Run do_fixcat=True, index=0, forced=False".format(boxlist3))
sys.exit()
#boxlist3="{}_MaxLikSourceList_en{}.forced{}{}".format(os.path.join(outfile_dir,outkey), eband[0], comm, outfile_post)
#if(index==0):
boxlist3="{}_MaxLikSourceList_en{}.fixed{}{}".format(os.path.join(outfile_dir,outkey), eband[0], comm, outfile_post)
if not (os.path.exists(boxlist3)):
print("{} not found. Run do_fixcat=True, index=0, forced=False".format(boxlist3))
sys.exit()
add_specific_columns(boxlist3)
fitpos_flag="fitpos_flag=no"
fitext_flag="fitext_flag=no"
nmulsou = "nmulsou=1"
nmaxfit="nmaxfit=1"
""" don't allow ermpldet to split sources """
nmaxfit="nmaxfit=10"
multrad="multrad=15."
cutrad="cutrad=15."
if(index == 3 or index == 6):
""" for hard band take unvignetted background """
outfile_backmap3="{}_BackMap3_en{}.{}{}".format(os.path.join(outfile_dir,outkey), eband[index], "novign", outfile_post)
@@ -281,10 +284,12 @@ else:
fitext_flag="fitext_flag=yes"
nmulsou = "nmulsou=2"
nmaxfit="nmaxfit=4"
multrad="multrad=20."
cutrad="cutrad=20."
""" allow ermpldet to split sources (no more than two) """
cmd=["ermldet",
"mllist=%s" %(mllist),
"mllist={}".format(mllist),
"boxlist=%s" %(boxlist3),
"images=\'{}\'".format(outfile_evtool),
"expimages=\'{}\'".format(outfile_expmap),
@@ -297,8 +302,8 @@ cmd=["ermldet",
"likemin=0.",
"extlikemin=5.",
"compress_flag=N",
"cutrad=15.",
"multrad=20.",
cutrad,
multrad,
"extmin=2.0",
"extmax=35.0",
#"bkgima_flag=Y", looks outdated
@@ -337,17 +342,22 @@ if(do_ersensmap==True):
"""
if(do_ermldet==True):
test_exe('ermldet')
if(vign==False):
print('Run ermldet with vignetted exposure!')
sys.exit()
remove_file(mllist)
remove_file(srcmap)
print(cmd)
runme(cmd, local_run=local_run)
#correct_fluxerr_ermldet_forced(mllist)
print(cmd)
save_ermldet_ds9reg(mllist,scale=60*60,label='det_like')
save_ermldet_ds9reg(mllist,scale=60*60,label='id_src')
correct_fluxerr_ermldet_forced(mllist)
if(forced==True):
result = check_ermldet_forced(mllist)
""" 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):
correct_srcid_ermldet_forced(mllist)
@@ -359,32 +369,22 @@ if(do_fixcat==True):
print("ERROR: You can fix only non-forced catalog for en0.")
sys.exit()
srcs_remove=[174,
90,
299,
300,
504,
215,
401,
20,] # keep 671 as unclassified extended source
srcs_add = {'4XMM J021925.4-042647':[34.8559099,-4.4465007, 1.366], # 147
'4XMM J021922.8-042655':[34.8451832,-4.4487901, 1.958], # 147
'4XMM J021929.4-043224':[34.8728586,-4.5400022, 0.660], # 90
'4XMM J021931.2-043222':[34.8801169,-4.5395495, 2.561], # 90
'4XMM J021911.2-050550':[34.7968110,-5.0972990, 0.732], # 504
'4XMM J021919.3-050511':[34.8307176,-5.0864242,4.988], # 504
'4XMM J021911.5-050501':[34.7981099,-5.0837146,6.834], # 504
'4XMM J021658.9-044900':[34.2455964,-4.8168126,4.449], # 300
'4XMM J021659.2-044945':[34.2468704,-4.8291892,1.548], # 300
'4XMM J021812.2-045814':[34.5510753,-4.9705972,0.550], # 215
'4XMM J021812.0-045813':[34.5502698,-4.9703004,0.497], # 215
'4XMM J021912.6-052756':[34.8028459,-5.4656239,0.579], # 401
'4XMM J021705.5-042254':[34.2730294,-4.3816810,0.288], # 20
'4XMM J021705.3-042314':[34.2720952,-4.3873162,0.587], # 20
'4XMM J021827.2-045456':[34.6134256,-4.9157208,0.252],
'4XMM J021831.3-045504':[34.6306930,-4.9178676,0.242],
'4XMM J021925.4-045201':[34.8558373,-4.8671200,0.529],
srcs_remove=[341,446,346,96]
srcs_add = {'4XMM J021738.8-051257':[34.4117002, -5.2159135, 0.624],# 341
'4XMM J021733.8-051311':[34.3910215,-5.2199877,2.247],# 341
'4XMM J021929.4-051220':[34.8725460,-5.2056849,1.074],#446
'4XMM J021930.7-051225':[34.8782267,-5.2072112,0.624],# 446
'4XMM J021945.2-045331':[34.9383593,-4.8919843,1.538],#346
'4XMM J021929.4-043224':[34.8728586,-4.5400022,0.659555],#96
#'4XMM J021929.4-043224':[34.8728586,-4.5400022, 0.660],
#'4XMM J021831.8-050059':[34.6328841,-5.0163909,1.529],
#'4XMM J022131.1-050027':[35.3797879,-5.0075498,0.941],
#'4XMM J022129.5-045914':[35.3732136,-4.9874025,0.332],
#'4XMM J022026.3-050251':[35.1098619,-5.0476199,0.551],
#'4XMM J021925.4-042647':[34.8559099,-4.4465007,1.366],
#'4XMM J021910.9-045108':[34.7954311,-4.8522901,0.898],
#'4XMM J021945.2-045331':[34.9383593,-4.8919843,1.538],
#'4XMM J021733.8-051311':[34.3910215,-5.2199877,2.247],
}
fix_catalog(mllist=mllist,refimage=outfile_evtool, srcs_remove=srcs_remove, srcs_add=srcs_add)
"""
@@ -451,7 +451,7 @@ if(do_filter_catalog==True):
#filter_mllist(mllist,expcut=5000.0,dlcut=10.0,dlmin=10,dlmax=10000)
""" works the same """
filter_catprep(catprep,expcut=5000.0,dlmin=10,dlmax=10000,outkey='bright')
filter_catprep(catprep,expcut=5000.0,dlmin=6,dlmax=10,outkey='faint')
#filter_catprep(catprep,expcut=5000.0,dlmin=6,dlmax=10,outkey='faint')
if(do_cross_match==True):
crossmatch_shu2019(catprep,dlmin=10,refimage=outfile_evtool,crval=[ra_cen, de_cen],