def get_LOFAR_centered_positions(self, out=None): """returns the positions (as a 2D numpy array) of the antennas with respect to CS002. if out is a numpy array, it is used to store the antenna positions, otherwise a new array is allocated. Does not account for polarization flips, but shouldn't need too.""" if out is None: out = np.empty((len(self.dipoleNames), 3)) md.convertITRFToLocal(self.get_ITRF_antenna_positions(), out=out) return out
def get_XYZ(self, center='LOFAR'): ## TODO: use python package instead. if self.local_XYZ is None: ITRF = geoditic_to_ITRF( [self.latitude, self.longitude, self.altitude]) if center == 'LOFAR': phase_center = ITRFCS002 reflatlon = latlonCS002 elif center == "LMA": array_latlonalt = np.array([ self.header.array_lat, self.header.array_lon, self.header.array_alt ]) reflatlon = array_latlonalt[:2] phase_center = geoditic_to_ITRF(array_latlonalt) else: ## assume center is lat lon alt array_latlonalt = np.array(center) reflatlon = array_latlonalt[:2] phase_center = geoditic_to_ITRF(array_latlonalt) self.local_XYZ = convertITRFToLocal(np.array([ITRF]), phase_center, reflatlon)[0] return self.local_XYZ
def get_XYZ(self): if self.local_XYZ is None: ITRF = geoditic_to_ITRF( [self.latitude, self.longitude, self.altitude]) self.local_XYZ = convertITRFToLocal(np.array([ITRF]))[0] return self.local_XYZ
def RCUname_to_anti(self, antenna_name): """given RCUid (and known mode), return internal index of the X-dipole of that antenna""" station = SId_to_Sname[int(antenna_name[:3])] known_positions = md.convertITRFToLocal( md.getItrfAntennaPosition(station, self.antenna_mode)) this_antenna_location = known_positions[int(antenna_name[-3:])] return self.loc_to_anti(this_antenna_location[0:2])
def get_LNA_filter(self): """given the antenna mode, return two things. First is np.array of indecies of LNAs that are on, second is np.array of LNAs that are off""" station_ant_positions = [] for station in ['CS002', 'CS003', 'CS004', 'CS005', 'CS006', 'CS007']: station_ant_positions.append( md.convertITRFToLocal( md.getItrfAntennaPosition(station, self.antenna_mode))[::2, :]) found_indeces = [] unfound_indeces = [] AARFAACC_X_locations = self.AART_ant_positions[0] AARFAACC_Y_locations = self.AART_ant_positions[1] err2 = 0.1 * 0.1 for AAR_i in range(len(AARFAACC_X_locations)): found = False for stat_ant_XYZ in station_ant_positions: for XYZ in stat_ant_XYZ: KX, KY, KZ = XYZ AX = AARFAACC_X_locations[AAR_i] AY = AARFAACC_Y_locations[AAR_i] R2 = (AX - KX)**2 + (AY - KY)**2 if R2 < err2: found = True break if found: break if found: found_indeces.append(AAR_i) else: unfound_indeces.append(AAR_i) return np.array(found_indeces), np.array(unfound_indeces)
def get_LOFAR_centered_positions(self, out=None): """returns the positions (as a 2D numpy array) of the antennas with respect to CS002. if out is a numpy array, it is used to store the antenna positions, otherwise a new array is allocated""" return md.convertITRFToLocal(self.ITRF_dipole_positions, out=out)