def make_mm_mmb(): ''' A function that returns the system mueller matrix for NACO based on Max's Luhman 16 fitting ''' m_naco = NACO_mmb() #The NACO Mueller Matrix m_p = cmm.Rotator() mm_list = [m_naco, m_p] naco_mm = MuellerMat.SystemMuellerMatrix(mm_list) return naco_mm
def on_sky(values): i = np.empty(shape=[0, 1]) m_system = np.empty(shape=[0, 4]) sys_mm = MuellerMat.SystemMuellerMatrix([cmm.WollastonPrism(), cmm.HWP(), cmm.Rotator()]) # Calculate the Mueller matrices for j in range(len(values)): sys_mm.master_property_dict['HalfwaveRetarder']['theta'] = values[j][2] sys_mm.master_property_dict['Rotator']['pa'] = values[j][3] sys_mm.master_property_dict['WollastonPrism']['beam'] = 'o' row1 = sys_mm.evaluate() sys_mm.master_property_dict['WollastonPrism']['beam'] = 'e' row2 = sys_mm.evaluate() i = np.append(i, [[values[j][0]]], axis=0) m_system = np.append(m_system, [row1[0]], axis=0) i = np.append(i, [[values[j][1]]], axis=0) m_system = np.append(m_system, [row2[0]], axis=0) # Return a least-squares solution return inv(np.transpose(m_system) @ m_system) @ np.transpose(m_system) @ i
def track_plot(targets): # Initialize the start time, the targets, and the initial stokes vector time = Time("2015-09-13") step = np.arange(0, 1, 1 / 86400) stokes = [[0], [1], [0], [0]] hwp_angles = [0, 22.5] derotator = cmm.DiattenuatorRetarder() m3 = cmm.DiattenuatorRetarder() sys_mm = MuellerMat.SystemMuellerMatrix( [cmm.WollastonPrism(), derotator, cmm.HWP(), m3, cmm.Rotator()]) # Put in M3 - use astropy for altitude - diattenuating rotator - as a perfect mirror with an angle # "perfect" - no retardance and no diattenuation # Derotator - diattenuating retarder at a given parallactic angle # Check diattenuating retarder form with goldstein and witzel # Can calculate coefficients from material parameters - Fresnel reflection - index of refraction # Fresnel coefficients - how to get the r values and possibly retardance # use hour angle and dec to find the parallactic angle # find the altitude given an hour angle and a target for hwp in hwp_angles: angle_plot = [] time_plot = [] sys_mm.master_property_dict['HalfwaveRetarder']['theta'] = hwp for j in range(len(targets)): wollaston_data = [] target = FixedTarget.from_name(targets[j]) # Calculate the parallactic angles and the altitudes angles = np.degrees((keck.parallactic_angle(time + step, target)).to_value()) altitudes = (keck.altaz(time + step, target)).alt.to_value() # Calculate the Wollaston beams and parallactic angle as time passes for pa, alt in zip(angles, altitudes): sys_mm.master_property_dict['Rotator']['pa'] = pa m3.properties['theta'] = alt sys_mm.master_property_dict['WollastonPrism']['beam'] = 'o' I1 = sys_mm.evaluate() @ stokes sys_mm.master_property_dict['WollastonPrism']['beam'] = 'e' I2 = sys_mm.evaluate() @ stokes wollaston_data.append(np.asscalar(I1[0] - I2[0])) angle_plot.append(np.array([angles, wollaston_data]).T) time_plot.append( np.array([((time + step).to_datetime()), wollaston_data]).T) # Plot the angle data points for k in range(len(targets)): x, y = angle_plot[k].T plt.scatter(x, y, s=1, label=targets[k]) plt.title( 'Difference between Wollaston prism beams over parallactic angle with HWP at %.1f degrees' % hwp) plt.ylabel( 'Difference between $\mathdefault{I^+}$ and $\mathdefault{I^-}$') plt.xlabel('Parallactic angle (deg)') plt.legend(loc="upper left") plt.show() # Plot the time data points for k in range(len(targets)): x, y = time_plot[k].T plt.scatter(x, y, s=1, label=targets[k]) plt.title( 'Difference between Wollaston prism beams over time with HWP at %.1f degrees' % hwp) plt.ylabel( 'Difference between $\mathdefault{I^+}$ and $\mathdefault{I^-}$') plt.xlabel('Time (hour of day)') plt.legend(loc="upper left") ax = plt.gca() ax.xaxis_date() ax.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M')) ax.set_xlim(datetime.date(2015, 9, 13), datetime.date(2015, 9, 14)) plt.show()
from pyMuellerMat import MuellerMat import numpy as np from numpy.linalg import inv import matplotlib.pyplot as plt from scipy.optimize import curve_fit # Initialize the telescope's latitude keck = np.radians(19.8260) # Initialize the finalized system Mueller Matrix derotator = cmm.DiattenuatorRetarder() derotator.name = 'derotator' m3 = cmm.DiattenuatorRetarder() m3.name = 'm3' master_sys_mm = MuellerMat.SystemMuellerMatrix([cmm.WollastonPrism(), derotator, cmm.HWP(), m3, cmm.Rotator()]) # Initialize the standards and convert to degrees # http://www.ukirt.hawaii.edu/instruments/irpol/irpol_stds.html # HDE 279652: RA 04 14 50.2, dec +37 35 54, P = 0.61 # HDE 279658: RA 04 13 47.3, dec +37 09 32, P = 1.42 # HDE 283637: RA 04 22 53.3, dec +27 30 18, P = 1.57 ra = np.array([[4, 14, 50.2], [4, 13, 47.3], [4, 22, 53.3]]) dec = np.array([[37, 35, 54], [37, 9, 32], [27, 30, 18]]) rad = np.radians(15 * (ra[:, 0] + ra[:, 1] / 60 + ra[:, 2] / 3600)) decd = np.radians(dec[:, 0] + dec[:, 1] / 60 + dec[:, 2] / 3600) p = np.array([0.0061, 0.0142, 0.0157]) # matplotlib formatting plt.rcParams['font.family'] = 'Times New Roman' plt.rcParams['font.size'] = 22