Last active
March 16, 2023 00:44
-
-
Save mileslucas/be311f4e8257e81667eed26daa48a660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from astropy.io import fits | |
import numpy as np | |
from vampires_dpp.constants import SUBARU_LOC, PUPIL_OFFSET | |
import vampires_dpp.mueller_matrices as mm | |
def mueller_matrix_miles(filename): | |
header = fits.getheader(filename) | |
bs_ord = header["U_CAMERA"] == 1 | |
pa_theta = np.deg2rad(header["PA"]) | |
hwp_theta = np.deg2rad(header["U_HWPANG"]) | |
alt = np.deg2rad(header["ALTITUDE"]) | |
az = np.deg2rad(header["AZIMUTH"] - 180) | |
lat = SUBARU_LOC.lat.rad # 19.825504° | |
hwp_offset = alt + 0.5 * np.arctan2(np.sin(az), np.sin(alt) * np.cos(az) + np.cos(alt) * np.tan(lat)) | |
imrot_theta = np.deg2rad(header["D_IMRANG"]) | |
# QWP are oriented with fast-axis vertical on bench, facing the "wrong" way | |
qwp1_theta = np.pi/2 - np.deg2rad(header["U_QWP1"]) | |
qwp2_theta = np.pi/2 - np.deg2rad(header["U_QWP2"]) | |
flc_theta = 0 if header["U_FLCSTT"] == 1 else np.pi/4 | |
pupil_offset = np.deg2rad(PUPIL_OFFSET) # 140.4° | |
M = np.linalg.multi_dot(( | |
mm.wollaston(bs_ord), | |
mm.hwp(flc_theta), | |
mm.rotator(-pupil_offset), | |
mm.qwp(qwp2_theta), | |
mm.qwp(qwp1_theta), | |
mm.hwp(imrot_theta), | |
mm.hwp(hwp_theta + hwp_offset), | |
mm.rotator(-alt), | |
mm.mirror(), | |
mm.rotator(pa_theta) | |
)) | |
return M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment