generated from erosita/uds
July
This commit is contained in:
@@ -91,34 +91,43 @@ with fits.open(datadir+fn) as data:
|
||||
|
||||
# BKG
|
||||
if(outkey == 'BKG'):
|
||||
df = df.query('CLEAN > 0.0 & ( abs(LAT) > {} | abs(LON) > {}) & PHASE > {} & PHASE < {}'.format(bmax,lmax,phmin,phmax))
|
||||
df = df.query('REV >= {} & REV< {} & CLEAN > 0.0 & ( abs(LAT) > {} | abs(LON) > {}) & PHASE > {} & PHASE < {}'.format(revmin,revmax,bmax,lmax,phmin,phmax))
|
||||
print("N={}".format(df.shape[0]))
|
||||
|
||||
# GAL
|
||||
if(outkey=='GAL'):
|
||||
df = df.query('CLEAN > 0.0 & abs(LAT) < {} & abs(LON) < {} & PHASE > {} & PHASE < {}'.format(bmax,lmax,phmin,phmax))
|
||||
df = df.query('REV >= {} & REV< {} & CLEAN > 0.0 & abs(LAT) < {} & abs(LON) < {} & PHASE > {} & PHASE < {}'.format(revmin,revmax,bmax,lmax,phmin,phmax))
|
||||
print("N={}".format(df.shape[0]))
|
||||
|
||||
# ALL
|
||||
if(outkey=='ALL'):
|
||||
df = df.query('CLEAN > 0.0 & PHASE > {} & PHASE < {}'.format(phmin,phmax))
|
||||
|
||||
df = df.query('REV >= {} & REV< {} & CLEAN > 0.0 & PHASE > {} & PHASE < {}'.format(revmin,revmax,phmin,phmax))
|
||||
print("N={}".format(df.shape[0]))
|
||||
|
||||
"""
|
||||
GAL 70226 ScWs, 111.7 Ms
|
||||
BKG 61214 ScWs, 114.3 Ms
|
||||
Total 131440 ScWs, 225.9 Ms
|
||||
"""
|
||||
|
||||
for i, row in df.iterrows():
|
||||
orbit=row['REV']
|
||||
obsid=row['OBSID']#.decode("UTF-8")
|
||||
|
||||
if not (orbit > revmin and orbit < revmax):
|
||||
print("Skip orbit",orbit,row['OBSID'])
|
||||
if not (orbit >= revmin and orbit < revmax):
|
||||
#print("Skip orbit",orbit,row['OBSID'])
|
||||
continue
|
||||
|
||||
if not (orbit < crab_rev_max):
|
||||
if not (orbit <= crab_rev_max):
|
||||
print("Skip orbit",orbit,obsid)
|
||||
continue
|
||||
|
||||
if (obsid in ignored_scw):
|
||||
print("Skip ScW",obsid)
|
||||
#print("Skip ScW",obsid)
|
||||
continue
|
||||
|
||||
if (orbit in ignored_rev):
|
||||
print("Skip REV",orbit)
|
||||
#print("Skip REV",orbit)
|
||||
continue
|
||||
|
||||
a = bgdmodel[orbit]['a']
|
||||
@@ -162,11 +171,13 @@ for i, row in df.iterrows():
|
||||
lon0.append(row['LON'])
|
||||
lat0.append(row['LAT'])
|
||||
|
||||
print("N={} ScWs, {:.1f} Ms".format(len(resid0),np.sum(texp0)/1e6))
|
||||
|
||||
sigma=3
|
||||
rev_min=np.min(rev0)
|
||||
rev_max=np.max(rev0)
|
||||
orbits=np.array(rev0)
|
||||
resid_arr=np.array(resid0)
|
||||
resid_arr=np.array(grxe0)
|
||||
distr_val=[]
|
||||
distr_rev=[]
|
||||
for r in range(rev_min,rev_max):
|
||||
@@ -179,8 +190,10 @@ for r in range(rev_min,rev_max):
|
||||
dval=np.array(distr_val)
|
||||
drev=np.array(distr_rev)
|
||||
|
||||
sigma=2
|
||||
n_bins=20
|
||||
(mu, sg) = norm.fit(dval)
|
||||
print(mu,sg)
|
||||
|
||||
n_bins=40
|
||||
filtered_data = sigma_clip(dval, sigma=sigma, maxiters=10, return_bounds=True)
|
||||
filtered_arr=filtered_data[0]
|
||||
filtered_min=filtered_data[1]
|
||||
@@ -206,7 +219,7 @@ if(plotme):
|
||||
#plt.axvline(sg_mean-sg_sem, color="black", linestyle="dashed")
|
||||
plt.axvline(sg_mean+sg_std, color="blue", linestyle="dashed")
|
||||
plt.axvline(sg_mean-sg_std, color="blue", linestyle="dashed")
|
||||
plt.xlabel("Resid")
|
||||
plt.xlabel("Residuals, mCrab")
|
||||
plt.show()
|
||||
|
||||
with open(proddir+fn.replace(".fits",".ignored_rev.resid.pkl"), 'wb') as fp:
|
||||
|
Reference in New Issue
Block a user