Commit 23b4e290 authored by jonas's avatar jonas
Browse files

prefilter implemented

parent b254888e
......@@ -5,6 +5,7 @@ from astropy.io import fits
import subprocess
from scipy.ndimage import gaussian_filter
import time
from operator import itemgetter
from utils import *
......@@ -290,7 +291,8 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, sigma = 59,
# TODO: Could check data dimensions? As an extra fail safe before progressing?
#-----------------
print(voltagesData_arr)
#-----------------
# READ FLAT FIELDS
#-----------------
......@@ -542,20 +544,33 @@ def phihrt_pipe(data_f,dark_f,flat_f,norm_f = True, clean_f = False, sigma = 59,
prefilter = prefilter[:,652:1419,613:1380] #crop the helioseismology data
prefilter_array = np.tile(np.array(prefilter_voltages), (1,6,data_shape[-1]))
voltage_list = voltagesData[scan]
def get_v1_index1(x):
index1, v1 = min(enumerate([abs(i) for i in x]), key=itemgetter(1))
return v1, index1
vdif = np.array(voltage_list)[np.newaxis, ..., np.newaxis] - prefilter_array
for scan in range(data_shape[-1]):
def get_v1(x):
pass
#return min(abs(x),index1) #what is index1?
voltage_list = voltagesData[scan]
for wv in range(6):
v1 = np.array(map(get_v1, vdif))
v = voltage_list[wv]
v2 = np.copy(vdif)
vdif = [v - pf for pf in prefilter_voltages]
v1, index1 = get_v1_index1(vdif)
if vdif[index1] >= 0:
v2 = vdif[index1 + 1]
index2 = index1 + 1
else:
v2 = vdif[index1-1]
index2 = index1 - 1
imprefilter = (prefilter[index1,:,:]*v1 + prefilter[index2,:,:]*v2)/(v1+v2)
data[:,:,:,wv,scan] /= imprefilter
printc('--------------------------------------------------------------',bcolors.OKGREEN)
......
......@@ -8,3 +8,4 @@ os
random
subprocess
statistics
operator
\ No newline at end of file
......@@ -7,6 +7,8 @@ darkfield_fits_filename = '../fits_files/solo_L0_phi-fdt-ilam_20200228T155100_V2
sciencedata_fits_filenames = ['../fits_files/' + i for i in sciencedata_fits_filenames]
prefilter_f = '../fits_files/fitted_prefilter.fits'
c_talk_params = np.zeros((2,3))
q_slope = 0.0038
......@@ -25,5 +27,5 @@ c_talk_params[1,0] = q_int
c_talk_params[1,1] = u_int
c_talk_params[1,2] = v_int
data = phihrt_pipe(sciencedata_fits_filenames[1:], darkfield_fits_filename, flatfield_fits_filename, norm_stokes = True,
clean_f = True, ctalk_params = c_talk_params, ItoQUV = True, out_demod_file = True, out_dir = '/data/slam/home/sinjan/hrt_pipe_results/stp-136_ctalk/', rte = 'RTE')
\ No newline at end of file
data = phihrt_pipe(sciencedata_fits_filenames[1], darkfield_fits_filename, flatfield_fits_filename, norm_stokes = True, prefilter_f = prefilter_f,
clean_f = False, ctalk_params = c_talk_params, ItoQUV = False, out_demod_file = False, out_dir = '/data/slam/home/sinjan/hrt_pipe_results/stp-136_ctalk/', rte = 'False')
\ No newline at end of file
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