This commit is contained in:
2024-10-31 13:56:16 +03:00
parent 09ce08e69a
commit e02db833cc
313 changed files with 126 additions and 99566 deletions

View File

@@ -30,48 +30,27 @@ enkey = sys.argv[1]
fn="detcnts.{}.fits".format(enkey)
print("Reading {}".format(datadir+fn))
#d = fits.getdata(datadir+fn)
#df=pd.DataFrame(np.array(d).byteswap().newbyteorder())
with fits.open(datadir+fn) as data:
df = pd.DataFrame(data[1].data)
print(df.columns)
# print(df.columns)
#interp_a = np.interp(50, [0,100], [0, 1])
#print(interp_a)
#sys.exit()
plotme=False
sigma=3
ntotal=0
nrev=0
bgdmodel={}
# will be populated
ignored_scw=[]
ignored_rev=[131,132,133,134,135,136,# flare
280,281,282,#flare
1057,1102,1150, # flare
1452,1459,1472, # flare
2303,2304, # flare
2549, # flare
334,1760] # ignore orbits with pecular slope over phase
ignored_rev=[131,132,133,136,
280,281,282,
1057,1102,1150,1452,1459,
2303,2304,2305,
2483,2549]
if not os.path.exists(proddir):
os.makedirs(proddir)
for rev in range(revmin,revmax):
# if not (rev==341):
# continue
df0 = df.query('CLEAN > 0.0 & REV == {} & ( abs(LAT) > {} | abs(LON) > {}) & PHASE > {} & PHASE < {}'.format(rev,bmax,lmax,phmin,phmax))
#df0 = df.query('CLEAN > 0.0 & REV == {} & abs(LAT) > {} & abs(LON) > {} & PHASE > {} & PHASE < {}'.format(rev,bmax,lmax,phmin,phmax))
nobs=len(df0)
print("*** REV {} *** {} ScWs".format(rev,df0.shape[0]))
if not(nobs):
@@ -89,7 +68,7 @@ for rev in range(revmin,revmax):
c = 0
""" run regression """
print("*** Run regression for {}".format(rev))
#print(df0['CLEAN'].values)
x = x.reshape((-1, 1))
# https://machinelearningmastery.com/robust-regression-for-machine-learning-in-python/
#model = LinearRegression()