def radec2fp(self, ra, dec): x_tan, y_tan = radec2tan(ra, dec, self.ra, self.dec, mjd=self.mjd, lst_deg=self.lst, hexrot_deg=self.hexrot_deg, precession=self.precession, aberration=self.aberration, polar_misalignment=self.polar_misalignment) x_tan, y_tan = self.tancorr_sky2inst(x_tan, y_tan) # correction x_fp, y_fp = tan2fp(x_tan, y_tan, self.adc1, self.adc2) return x_fp, y_fp
def compute_fieldrot(self) : # cross of side length 1 degree in tangent plane phi = np.arange(4)*np.pi/2. x1 = np.append(0.,np.pi/180.*np.cos(phi)) y1 = np.append(0.,np.pi/180.*np.sin(phi)) # convert to sky xfp,yfp = tan2fp(x1,y1,self.adc1,self.adc2) ra,dec = self.fp2radec(xfp,yfp) # vanilla transformation from ha,dec to tangent plane ha = self.lst - ra x2,y2 = hadec2xy(ha,dec,ha[0],dec[0]) return 180./np.pi*np.mean((y1[1:]*x2[1:]-x1[1:]*y2[1:])/np.sqrt((x1[1:]**2+y1[1:]**2)*(x2[1:]**2+y2[1:]**2)))
def test_default_tan2fp(self): ifilename = resource_filename("desimeter", "data/raytrace-tan2fp-4957-v17.csv") table = Table.read(ifilename, format="csv") tmp = np.unique(table["ADC1"]) adc1 = float(tmp[tmp.size // 2]) # one random value of adc1 on grid selection = (table["ADC1"] == adc1) adc2 = float(table["ADC2"][selection][0]) selection = (table["ADC1"] == adc1) & (table["ADC2"] == adc2) xtan = table["X_TAN"][selection] ytan = table["Y_TAN"][selection] xfp = table["X_FP"][selection] yfp = table["Y_FP"][selection] xfp2, yfp2 = tan2fp(xtan, ytan, adc1, adc2) rms = np.sqrt(np.mean((xfp2 - xfp)**2 + (yfp2 - yfp)**2)) print("for ADC1={} ADC2={} rms(TAN->FP) = {:4.3f} microns".format( adc1, adc2, rms * 1000.)) self.assertLess(rms, 3e-3) # less than 3 um