Commit 1622734c authored by Arthur Vigan's avatar Arthur Vigan
Browse files

Save shift for mask and PSF independently

parent 8875a252
......@@ -592,7 +592,8 @@ df = np.abs(f1D[1]-f1D[0])*fudge_df
# |_____/|_____|_| |_|\____/|______/_/ \_\_| |_____|_| \_|\_____| |______/_/ \_\_| \____/|_____/ \____/|_| \_\______|_____/
#
SR = np.zeros((len(HA_vect), N_LD))
CHROMATIC_SHIFT = np.zeros((len(HA_vect), N_LD))
SHIFT_PSF = np.zeros((len(HA_vect), N_LD))
SHIFT_MASK = np.zeros((len(HA_vect), N_LD))
log.info('Computing the different exposures...')
for i in range(len(HA_vect)):
......@@ -795,7 +796,8 @@ for i in range(len(HA_vect)):
#print(shift_value*MASperPIXEL)
CHROMATIC_SHIFT[i, k] = shift_value
SHIFT_PSF[i, k] = shift_value
SHIFT_MASK[i, k] = -shift_pix_FPM
I_temp[k] = I_temp[k, :, :]*np.flipud(MASK_temp)
I_temp[k] = shift(I_temp[k, :, :], [shift_value, 0], output=None, order=1, mode='constant', cval=0.0, prefilter=True)
......@@ -823,8 +825,11 @@ for i in range(len(HA_vect)):
fits.setval(image_filename_nomask, 'APODIZER', value=APODIZER)
fits.setval(image_filename_nomask, 'FPM', value=FPM)
shift_filename = path_directory + 'CHROMATIC_SHIFT.fits'
fits.writeto(shift_filename, CHROMATIC_SHIFT)
shift_filename = path_directory + 'SHIFT_PSF.fits'
fits.writeto(shift_filename, SHIFT_PSF)
shift_filename = path_directory + 'SHIFT_MASK.fits'
fits.writeto(shift_filename, SHIFT_MASK)
SR_filename = path_directory + 'SR.fits'
fits.writeto(SR_filename, SR)
......
......@@ -454,11 +454,11 @@ if __name__ == '__main__':
ADI_time_LAST = 60*Sky_Rot/np.abs((PARANG(DEC, np.max(HA_vect)-1/60)-PARANG(DEC, np.max(HA_vect)+1/60))/(2/60))
# Pupil shift model
Pupil_shift = 1.6/100
Pupil_apodizer_differential_shift = 0.2/100
Pupil_shift = 1.6/100
Pupil_apodizer_differential_shift = 0.2/100
Pupil_shift_period = 1# %period of pupil shift in hours
Pupil_shift_vect = Pupil_shift*np.cos(2*pi*HA_vect/Pupil_shift_period)# %simple model for pupil shift ; not sure at this time how it will actually move
Pupil_shift_diff_vect = Pupil_apodizer_differential_shift*np.cos(2*pi*HA_vect/Pupil_shift_period)# %simple model for pupil shift ; not sure at this time how it will actually move
Pupil_shift_diff_vect = Pupil_apodizer_differential_shift*np.cos(2*pi*HA_vect/Pupil_shift_period)# %simple model for pupil shift ; not sure at this time how it will actually move
#Simulating the evolution of the wind direction as the rotation of the wind with the paralactic angle
......@@ -579,7 +579,7 @@ if __name__ == '__main__':
cobsc_allglass = diam_obsc_allglass / diam_allglass
entrance_pup = 38.542
D = 38.542 #37 #why not 38.542 ??? check difference
D = 38.542 # 37 #why not 38.542 ??? check difference
BigD = 38.542*1132/1024
M1pupil1132_1024 = fits.getdata(COM_DIR + 'PUPIL_1132_1024D38.542.fits')
......@@ -592,7 +592,7 @@ if __name__ == '__main__':
ORIGINAL_PUPIL = M1pupil1132_1024
M1pupil1132_1024 = M1pupil1132_1024*(1-MISSSEG)
P_M4 = EELTNLS(1024, 100, 100, 110) ### EELTNLS not written yet!!! ###
P_M4 = EELTNLS(1024, 100, 100, 110) ### EELTNLS not written yet!!! ###
P_M4 = np.pad(P_M4, [54, 54], 'constant', constant_values=(0, 0))
#P_M4, P_M4_col = MAKE_ELT(COM_DIR, 1132, 1132/1024*38.542, 0, 0)
......@@ -710,7 +710,8 @@ if __name__ == '__main__':
# |_____/|_____|_| |_|\____/|______/_/ \_\_| |_____|_| \_|\_____| |______/_/ \_\_| \____/|_____/ \____/|_| \_\______|_____/
#
SR = np.zeros((len(HA_vect), N_LD))
CHROMATIC_SHIFT = np.zeros((len(HA_vect), N_LD))
SHIFT_MASK = np.zeros((len(HA_vect), N_LD))
SHIFT_PSF = np.zeros((len(HA_vect), N_LD))
log.info('Computing the different exposures...')
for i in range(len(HA_vect)):
......@@ -831,21 +832,22 @@ if __name__ == '__main__':
#print(shift_value*MASperPIXEL)
CHROMATIC_SHIFT[i, k] = shift_value
I_temp[k] = I_temp[k]*np.flipud(MASK_temp)
I_temp[k] = shift(I_temp[k], [shift_value, 0], output=None, order=1, mode='constant', cval=0.0, prefilter=True)
image_filename = path_directory + 'PSF_HALO_ON_masked_centered_Nexp{0:04d}.fits'.format(i)
fits.writeto(image_filename, I_temp)
fits.setval(image_filename, 'ORIGIN', value='ESO-ARMAZONES')
fits.setval(image_filename, 'TELESCOP', value='ESO-ELT')
fits.setval(image_filename, 'INSTRUME', value='HARMONI')
fits.setval(image_filename, 'EXPTIME', value='{:.3f}'.format(T_exp*3600))
fits.setval(image_filename, 'AIRMASS', value='{:.3f}'.format(1/np.cos(np.pi/180*(90-ELEVATION(DEC*1.0, HA_0)))))
fits.setval(image_filename, 'PI-COI', value='NIRANJAN')
fits.setval(image_filename, 'DISPELEM', value=BAND)
fits.setval(image_filename, 'APODIZER', value=APODIZER)
fits.setval(image_filename, 'FPM', value=FPM)
SHIFT_MASK[i, k] = -shift_pix_FPM
SHIFT_PSF[i, k] = shift_value
# I_temp[k] = I_temp[k]*np.flipud(MASK_temp)
# I_temp[k] = shift(I_temp[k], [shift_value, 0], output=None, order=1, mode='constant', cval=0.0, prefilter=True)
# image_filename = path_directory + 'PSF_HALO_ON_masked_centered_Nexp{0:04d}.fits'.format(i)
# fits.writeto(image_filename, I_temp)
# fits.setval(image_filename, 'ORIGIN', value='ESO-ARMAZONES')
# fits.setval(image_filename, 'TELESCOP', value='ESO-ELT')
# fits.setval(image_filename, 'INSTRUME', value='HARMONI')
# fits.setval(image_filename, 'EXPTIME', value='{:.3f}'.format(T_exp*3600))
# fits.setval(image_filename, 'AIRMASS', value='{:.3f}'.format(1/np.cos(np.pi/180*(90-ELEVATION(DEC*1.0, HA_0)))))
# fits.setval(image_filename, 'PI-COI', value='NIRANJAN')
# fits.setval(image_filename, 'DISPELEM', value=BAND)
# fits.setval(image_filename, 'APODIZER', value=APODIZER)
# fits.setval(image_filename, 'FPM', value=FPM)
image_filename_nomask = path_directory + 'PSF_HALO_ON_notmasked_notcentered_Nexp{0:04d}.fits'.format(i)
fits.writeto(image_filename_nomask, I_temp_nomask)
......@@ -859,9 +861,12 @@ if __name__ == '__main__':
fits.setval(image_filename_nomask, 'APODIZER', value=APODIZER)
fits.setval(image_filename_nomask, 'FPM', value=FPM)
shift_filename = path_directory + 'CHROMATIC_SHIFT.fits'
fits.writeto(shift_filename, CHROMATIC_SHIFT)
shift_filename = path_directory + 'SHIFT_PSF.fits'
fits.writeto(shift_filename, SHIFT_PSF)
shift_filename = path_directory + 'SHIFT_MASK.fits'
fits.writeto(shift_filename, SHIFT_MASK)
SR_filename = path_directory + 'SR.fits'
fits.writeto(SR_filename, SR)
......
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