def get_mean_exp_centroids(self, extrap_wlen=False): # Create time steps covering this exposure. midnight = astropy.time.Time(self.mjd, format='mjd', scale='tai', location=self.pointing.where) ha = np.mean(self.ha) time = specsim.transform.adjust_time_to_hour_angle(midnight, self.ra_center, ha, max_iterations=100) tai = time.mjd * 86400. temperature = np.mean(self.temperature) pressure = np.mean(self.pressure) print 'Mean Exposure: seeing {:.3f}, T={:+5.1f}, P={:.1f}, TAI {:.1f} ({:+7.3f} days, HA {:+.1f})'.format( np.mean(self.seeing), temperature, pressure, tai, (tai - self.design_tai)/86400., ha) # Calculate the actual guide target positions on the focal plane without any guiding. guide_x, guide_y, _, _ = self.pointing.transform( self.guide_targets[:, np.newaxis], tai, self.guide_wlen, self.design_temp, self.design_pressure) # Solve for the optimal guider corrections. guider = tpcorr.guider.Guider(self.guide_x0, self.guide_y0, guide_x, guide_y) # Calculate the offset target paths on the focal plane without any guiding, for the actual observing conditions. offset_x, offset_y, _, _ = self.pointing.transform( self.offset_targets[:, np.newaxis, np.newaxis], tai, self.wlen_grid, self.design_temp, self.design_pressure, extrap_wlen=extrap_wlen) return guider.correct(offset_x, offset_y)
def get_exp_centroids(self, exp_index, guide_plot_name=None): # Create time steps covering this exposure. tai_steps = np.linspace(self.tai_beg[exp_index], self.tai_end[exp_index], self.steps_per_exposure) # Calculate the actual guide target positions on the focal plane without any guiding. guide_x, guide_y, _, _ = self.pointing.transform( self.guide_targets[:, np.newaxis], tai_steps, self.guide_wlen, self.temperature[exp_index], self.pressure[exp_index]) # Solve for the optimal guider corrections. guider = tpcorr.guider.Guider(self.guide_x0, self.guide_y0, guide_x, guide_y) if guide_plot_name: guider.plot(tai_steps, field_radius=340 * u.mm, zoom=5000., fiber_radius=0.1 * u.arcsec * self.pointing.platescale, save=guide_plot_name) # Calculate the offset target paths on the focal plane without any guiding, for the actual observing conditions. offset_x, offset_y, _, _ = self.pointing.transform( self.offset_targets[:, np.newaxis, np.newaxis], tai_steps, self.wlen_grid, self.temperature[exp_index], self.pressure[exp_index]) # Apply guiding corrections to estimate the actual offset target paths during the exposure. return guider.correct(offset_x, offset_y)