Commit 8f051823 authored by jonas's avatar jonas
Browse files

Merge branch 'main' of https://github.com/JonasSinjan/hrt_pipeline into main

parents cbc21944 d9b9f583
......@@ -462,6 +462,8 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, flat_states
print(" ")
printc('-->>>>>>> Demodulating data ',color=bcolors.OKGREEN)
start_time = time.time()
data = demod_hrt(data, pmp_temp)
printc('--------------------------------------------------------------',bcolors.OKGREEN)
......@@ -478,6 +480,8 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, flat_states
print(" ")
printc('-->>>>>>> Normalising Stokes to Quiet Sun',color=bcolors.OKGREEN)
start_time = time.time()
for scan in range(data_shape[-1]):
I_c = np.mean(data[512:1536,512:1536,0,continuum_wavelength,scan], axis = (0,1)) #mean of central 1k x 1k of continuum stokes I
......@@ -503,12 +507,6 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, flat_states
data[np.isinf(data)] = 0
data[np.isnan(data)] = 0
#-----------------
# SAVE DATA TODO: CMILOS FORMAT AND FITS
#-----------------
if out_demod_file:
......@@ -532,12 +530,11 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, flat_states
hdu_list[0].data = data
hdu_list.writeto(out_dir + str(data_f.split('.fits')[0][-10:]) + '_reduced.fits', overwrite=True)
#-----------------
# INVERSION OF DATA WITH CMILOS
#-----------------
if rte == 'RTE' or rte == 'CE' or rte == 'CE+RTE':
print(" ")
......@@ -599,8 +596,6 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, flat_states
cmd = CMILOS_LOC+"./milos"
cmd = fix_path(cmd)
print(cmd)
if rte == 'RTE':
rte_on = subprocess.call(cmd+" 6 15 0 0 dummy_in.txt > dummy_out.txt",shell=True)
if rte == 'CE':
......@@ -610,10 +605,6 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, flat_states
print(rte_on)
printc('--------------------------------------------------------------',bcolors.OKGREEN)
printc(f"------------- CMILOS Run Time: {np.round(time.time() - start_time,3)} seconds ",bcolors.OKGREEN)
printc('--------------------------------------------------------------',bcolors.OKGREEN)
printc(' ---- >>>>> Reading results.... ',color=bcolors.OKGREEN)
del_dummy = subprocess.call("rm dummy_in.txt",shell=True)
print(del_dummy)
......@@ -660,10 +651,10 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, flat_states
hdu_list[0].data = rte_invs[9,:,:]+rte_invs[10,:,:]
hdu_list.writeto(out_dir+str(file_path.split('.fits')[0][-10:])+'_Icont_rte.fits', overwrite=True)
printc('--------------------------------------------------------------',bcolors.OKGREEN)
printc(f"------------- CMILOS RTE Run Time: {np.round(time.time() - start_time,3)} seconds ",bcolors.OKGREEN)
printc('--------------------------------------------------------------',bcolors.OKGREEN)
printc('--------------------- RTE END ----------------------------',color=bcolors.FAIL)
print(" ")
printc('--------------------------------------------------------------',color=bcolors.OKGREEN)
printc(f'------------ Reduction Complete: {np.round(time.time() - overall_time,3)} seconds',color=bcolors.OKGREEN)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment