Commit 060f3bab authored by jonas's avatar jonas
Browse files

input as jsons, flat 6 and 4 fix

parent cd7a5f7c
......@@ -18,3 +18,4 @@ _RTE.npz
run.py
P-MILOS/*
utils.py
file_names.txt
import json
science_april = ['solo_L0_phi-hrt-ilam_20200420T141752_V202004221450C_0024160030000.fits',
'solo_L0_phi-hrt-ilam_20200420T142022_V202004221451C_0024160031000.fits',
'solo_L0_phi-hrt-ilam_20200420T142252_V202004221452C_0024160032000.fits',
'solo_L0_phi-hrt-ilam_20200420T142522_V202004221457C_0024160033000.fits',
'solo_L0_phi-hrt-ilam_20200420T142752_V202004221511C_0024160034000.fits',
'solo_L0_phi-hrt-ilam_20200420T143023_V202004221517C_0024160035000.fits',
'solo_L0_phi-hrt-ilam_20200420T143253_V202004221518C_0024160036000.fits',
'solo_L0_phi-hrt-ilam_20200420T143523_V202004221522C_0024160037000.fits',
'solo_L0_phi-hrt-ilam_20200420T143753_V202004231605C_0024160038000.fits',
'solo_L0_phi-hrt-ilam_20200420T144023_V202004231605C_0024160039000.fits']
flatfield_fits_filename = '/data/slam/home/sinjan/fits_files/april_avgd_2020_flat.fits' #solo_L0_phi-hrt-flat_0667134081_V202103221851C_0162201100.fits'
darkfield_fits_filename = '../fits_files/solo_L0_phi-fdt-ilam_20200228T155100_V202002281636_0022210004_000.fits'
science_april = ['/data/slam/home/sinjan/fits_files/' + i for i in science_april]
input_dict = {
'data_f': science_april,
'flat_f' : flatfield_fits_filename,
'dark_f' : darkfield_fits_filename
}
json.dump(input_dict, open(f"./input_jsons/april_2020.txt", "w"))
\ No newline at end of file
......@@ -547,7 +547,7 @@ def phihrt_pipe(data_f, dark_f = '', flat_f = '', scale_data = True, bit_flat =
tmp = np.mean(flat,axis=-2) #avg over pol states for the wavelength
data /= tmp[start_row:start_row + data_size[0],start_col:start_col + data_size[1], np.newaxis, np.newaxis]
data /= tmp[start_row:start_row + data_size[0],start_col:start_col + data_size[1], np.newaxis, :, np.newaxis]
elif flat_states == 24:
......@@ -562,7 +562,7 @@ def phihrt_pipe(data_f, dark_f = '', flat_f = '', scale_data = True, bit_flat =
tmp = np.mean(flat,axis=-1) #avg over wavelength
data /= tmp[start_row:start_row + data_size[0],start_col:start_col + data_size[1], np.newaxis, np.newaxis]
data /= tmp[start_row:start_row + data_size[0],start_col:start_col + data_size[1], :, np.newaxis, np.newaxis]
printc('--------------------------------------------------------------',bcolors.OKGREEN)
printc(f"------------- Flat Field correction time: {np.round(time.time() - start_time,3)} seconds ",bcolors.OKGREEN)
......
{"data_f": ["/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T141752_V202004221450C_0024160030000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T142022_V202004221451C_0024160031000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T142252_V202004221452C_0024160032000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T142522_V202004221457C_0024160033000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T142752_V202004221511C_0024160034000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T143023_V202004221517C_0024160035000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T143253_V202004221518C_0024160036000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T143523_V202004221522C_0024160037000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T143753_V202004231605C_0024160038000.fits", "/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T144023_V202004231605C_0024160039000.fits"], "flat_f": "/data/slam/home/sinjan/fits_files/april_avgd_2020_flat.fits", "dark_f": "../fits_files/solo_L0_phi-fdt-ilam_20200228T155100_V202002281636_0022210004_000.fits"}
\ No newline at end of file
from hrt_pipe import phihrt_pipe
import numpy as np
import json
sciencedata_fits_filenames = ['solo_L0_phi-hrt-ilam_20201117T170209_V202106300922C_0051170001.fits']#['solo_L0_phi-hrt-ilam_20200420T142022_V202004221451C_0024160031000.fits']#,'solo_L0_phi-hrt-ilam_20200420T142252_V202004221452C_0024160032000.fits','solo_L0_phi-hrt-ilam_20200420T142522_V202004221457C_0024160033000.fits','solo_L0_phi-hrt-ilam_20200420T142752_V202004221511C_0024160034000.fits','solo_L0_phi-hrt-ilam_20200420T143023_V202004221517C_0024160035000.fits', 'solo_L0_phi-hrt-ilam_20200420T143253_V202004221518C_0024160036000.fits','solo_L0_phi-hrt-ilam_20200420T143523_V202004221522C_0024160037000.fits', 'solo_L0_phi-hrt-ilam_20200420T143753_V202004231605C_0024160038000.fits','solo_L0_phi-hrt-ilam_20200420T144023_V202004231605C_0024160039000.fits']#'/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T141752_V202004221450C_0024160030000.fits'#solo_L1_phi-hrt-ilam_20201117T170209_V202107090920C_0051170001.fits'#solo_L1_phi-hrt-ilam_20201117T170209_V202107060746C_0051170001.fits'#['solo_L1_phi-hrt-ilam_20200528T171109_V202106111600C_0045140102.fits']
#sciencedata_fits_filenames = ['solo_L0_phi-hrt-ilam_20201117T170209_V202106300922C_0051170001.fits']##'/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-ilam_20200420T141752_V202004221450C_0024160030000.fits'#solo_L1_phi-hrt-ilam_20201117T170209_V202107090920C_0051170001.fits'#solo_L1_phi-hrt-ilam_20201117T170209_V202107060746C_0051170001.fits'#['solo_L1_phi-hrt-ilam_20200528T171109_V202106111600C_0045140102.fits']
# ['solo_L0_phi-hrt-ilam_20210421T120003_V202106080929C_0144210101.fits', 'solo_L0_phi-hrt-ilam_20210424T120003_V202106141014C_0144240101.fits',
# 'solo_L0_phi-hrt-ilam_20210425T120002_V202106141020C_0144250101.fits', 'solo_L0_phi-hrt-ilam_20210426T120002_V202106162118C_0144260101.fits',
# 'solo_L0_phi-hrt-ilam_20210427T120002_V202106162052C_0144270101.fits', 'solo_L0_phi-hrt-ilam_20210427T120002_V202106171444C_0144270101.fits',
# 'solo_L0_phi-hrt-ilam_20210427T120002_V202106171517C_0144270101.fits'] ##['solo_L1_phi-hrt-ilam_20210223T170002_V202106111612C_0142230201.fits']
#['solo_L0_phi-hrt-ilam_0667414748_V202103221851C_0142230201.fits']#['solo_L0_phi-hrt-ilam_0667414905_V202103221851C_0142230602.fits', 'solo_L0_phi-hrt-ilam_0667415054_V202103221851C_0142230603.fits', 'solo_L0_phi-hrt-ilam_0667415205_V202103221851C_0142230604.fits', 'solo_L0_phi-hrt-ilam_0667415354_V202103221851C_0142230605.fits', 'solo_L0_phi-hrt-ilam_0667415505_V202103221851C_0142230606.fits', 'solo_L0_phi-hrt-ilam_0667415654_V202103221851C_0142230607.fits', 'solo_L0_phi-hrt-ilam_0667415805_V202103221851C_0142230608.fits']#['../fits_files/solo_L0_phi-hrt-ilam_0667414748_V202103221851C_0142230201.fits']
#sciencedata_fits_filenames = ['solo_L0_phi-hrt-ilam_0667414748_V202103221851C_0142230201.fits']
#sciencedata_fits_filenames = ['solo_L0_phi-hrt-ilam_0667414905_V202103221851C_0142230602.fits', 'solo_L0_phi-hrt-ilam_0667415054_V202103221851C_0142230603.fits', 'solo_L0_phi-hrt-ilam_0667415205_V202103221851C_0142230604.fits', 'solo_L0_phi-hrt-ilam_0667415354_V202103221851C_0142230605.fits', 'solo_L0_phi-hrt-ilam_0667415505_V202103221851C_0142230606.fits', 'solo_L0_phi-hrt-ilam_0667415654_V202103221851C_0142230607.fits', 'solo_L0_phi-hrt-ilam_0667415805_V202103221851C_0142230608.fits']
# #['solo_L0_phi-hrt-ilam_0667414748_V202103221851C_0142230201.fits']#['solo_L0_phi-hrt-ilam_0667414905_V202103221851C_0142230602.fits', 'solo_L0_phi-hrt-ilam_0667415054_V202103221851C_0142230603.fits', 'solo_L0_phi-hrt-ilam_0667415205_V202103221851C_0142230604.fits', 'solo_L0_phi-hrt-ilam_0667415354_V202103221851C_0142230605.fits', 'solo_L0_phi-hrt-ilam_0667415505_V202103221851C_0142230606.fits', 'solo_L0_phi-hrt-ilam_0667415654_V202103221851C_0142230607.fits', 'solo_L0_phi-hrt-ilam_0667415805_V202103221851C_0142230608.fits']#['../fits_files/solo_L0_phi-hrt-ilam_0667414748_V202103221851C_0142230201.fits']
# sciencedata_fits_filenames = ['solo_L0_phi-hrt-ilam_0667414905_V202103221851C_0142230602.fits']#['solo_L0_phi-hrt-ilam_0667414748_V202103221851C_0142230201.fits']
# #sciencedata_fits_filenames = ['solo_L0_phi-hrt-ilam_0667414905_V202103221851C_0142230602.fits', 'solo_L0_phi-hrt-ilam_0667415054_V202103221851C_0142230603.fits', 'solo_L0_phi-hrt-ilam_0667415205_V202103221851C_0142230604.fits', 'solo_L0_phi-hrt-ilam_0667415354_V202103221851C_0142230605.fits', 'solo_L0_phi-hrt-ilam_0667415505_V202103221851C_0142230606.fits', 'solo_L0_phi-hrt-ilam_0667415654_V202103221851C_0142230607.fits', 'solo_L0_phi-hrt-ilam_0667415805_V202103221851C_0142230608.fits']
flatfield_fits_filename = '/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-flat_0667134081_V202103221851C_0162201100.fits'#solo_L0_phi-hrt-ilam_20200417T174529_V202004241516C_0024150020000.fits'#solo_L0_phi-hrt-flat_0667134081_V202103221851C_0162201100.fits' #solo_L0_phi-hrt-ilam_20200417T174529_V202004241516C_0024150020000.fits'#solo_L1_phi-hrt-ilam_20200417T174538_V202106111549C_0024150020.fits'#solo_L0_phi-hrt-flat_0667134081_V202103221851C_0162201100.fits'
darkfield_fits_filename = '../fits_files/solo_L0_phi-fdt-ilam_20200228T155100_V202002281636_0022210004_000.fits'
# science_april = ['solo_L0_phi-hrt-ilam_20200420T142022_V202004221451C_0024160031000.fits','solo_L0_phi-hrt-ilam_20200420T142252_V202004221452C_0024160032000.fits','solo_L0_phi-hrt-ilam_20200420T142522_V202004221457C_0024160033000.fits','solo_L0_phi-hrt-ilam_20200420T142752_V202004221511C_0024160034000.fits','solo_L0_phi-hrt-ilam_20200420T143023_V202004221517C_0024160035000.fits', 'solo_L0_phi-hrt-ilam_20200420T143253_V202004221518C_0024160036000.fits','solo_L0_phi-hrt-ilam_20200420T143523_V202004221522C_0024160037000.fits', 'solo_L0_phi-hrt-ilam_20200420T143753_V202004231605C_0024160038000.fits','solo_L0_phi-hrt-ilam_20200420T144023_V202004231605C_0024160039000.fits']
sciencedata_fits_filenames = ['/data/slam/home/sinjan/fits_files/' + i for i in sciencedata_fits_filenames]
# flatfield_fits_filename = '/data/slam/home/sinjan/fits_files/solo_L0_phi-hrt-flat_0667134081_V202103221851C_0162201100.fits'#solo_L0_phi-hrt-flat_0667134081_V202103221851C_0162201100.fits'#solo_L0_phi-hrt-ilam_20200417T174529_V202004241516C_0024150020000.fits' #solo_L0_phi-hrt-ilam_20200417T174529_V202004241516C_0024150020000.fits'#solo_L1_phi-hrt-ilam_20200417T174538_V202106111549C_0024150020.fits'#solo_L0_phi-hrt-flat_0667134081_V202103221851C_0162201100.fits'
# darkfield_fits_filename = '../fits_files/solo_L0_phi-fdt-ilam_20200228T155100_V202002281636_0022210004_000.fits'
# sciencedata_fits_filenames = ['/data/slam/home/sinjan/fits_files/' + i for i in science_april]
input_json_file = './input_jsons/april_2020.txt'
input_dict = json.load(open(input_json_file))
data_f = input_dict['data_f']
flat_f = input_dict['flat_f']
dark_f = input_dict['dark_f']
prefilter_f = '../fits_files/fitted_prefilter.fits'
......@@ -29,13 +41,13 @@ prefilter_f = '../fits_files/fitted_prefilter.fits'
c_talk_params = np.zeros((2,3))
q_slope = -0.0098#0.0038
u_slope = -0.0003#-0.0077
v_slope = -0.0070#-0.0009
q_slope = -0.0141#0.0038#-0.0098#
u_slope = -0.0008#-0.0077#-0.0003#
v_slope = -0.0075#-0.0009#-0.0070#
q_int = -0.0015#-0.0056 #the offset, normalised to I_c
u_int = 0.0007#0.0031
v_int = 0.0006#-0.0002
q_int = 0.0018#-0.0056#-0.0015# #the offset, normalised to I_c
u_int = 0.0017#0.0031#0.0007#
v_int = 0.001#-0.0002#0.0006#
c_talk_params[0,0] = q_slope
c_talk_params[0,1] = u_slope
......@@ -45,12 +57,13 @@ c_talk_params[1,0] = q_int
c_talk_params[1,1] = u_int
c_talk_params[1,2] = v_int
out_names = ['nov_17_0051170001']#, '0024160032000_noflat', '0024160033000_noflat', '0024160034000_noflat', '0024160035000_noflat', '0024160036000_noflat', '0024160037000_noflat', '0024160038000_noflat', '0024160039000_noflat']
#out_names = ['nov_17_0051170001']#, '0024160032000_noflat', '0024160033000_noflat', '0024160034000_noflat', '0024160035000_noflat', '0024160036000_noflat', '0024160037000_noflat', '0024160038000_noflat', '0024160039000_noflat']
phihrt_pipe(sciencedata_fits_filenames, flat_f = flatfield_fits_filename, dark_f = darkfield_fits_filename, scale_data = True,
bit_flat = True, norm_f = True, clean_f = True, sigma = 59, flat_states = 24, norm_stokes = True, prefilter_f = None,
dark_c = True, flat_c = True, fs_c = True, demod = True, ctalk_params = c_talk_params, ItoQUV = False, out_demod_file = True,
out_demod_filename = out_names, out_dir = '/data/slam/home/sinjan/hrt_pipe_results/nov_17_2020/', rte = 'RTE',
phihrt_pipe(data_f, flat_f = flat_f, dark_f = dark_f, scale_data = False, bit_flat = True, norm_f = True,
clean_f = False, sigma = 59, flat_states = 6, norm_stokes = True, prefilter_f = None,
dark_c = True, flat_c = True, fs_c = True, demod = True, ctalk_params = c_talk_params,
ItoQUV = False, out_demod_file = True, out_demod_filename = None,
out_dir = '/data/slam/home/sinjan/hrt_pipe_results/april_2020_6f/', rte = '-',
out_rte_filename=None, p_milos = False, config_file = True)
"""
Input Parameters:
......@@ -119,6 +132,6 @@ ctalk_params: numpy arr, DEFAULT: None
rte: str, DEFAULT: False
invert using cmilos, options: 'RTE' for Milne Eddington Inversion, 'CE' for Classical Estimates, 'CE+RTE' for combined
out_rte_filename: str, DEFAULT = ''
if '', takes last 10 characters of input scan filename (assumes its a DID), change if want other name
out_rte_filename: str or list, DEFAULT = ''
if '', takes last 10 characters of input scan filename (assumes its a DID), change if want other name(s) for each scan
"""
\ No newline at end of file
Markdown is supported
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