def __init__(self, url, plane=0, beam=None): super(AartfaacCasaImage, self).__init__(url, plane=0, beam=None) table = casacore_table(self.url.encode(), ack=False) self.taustart_ts = self.parse_taustartts(table) self.telescope = table.getkeyword('coords')['telescope'] # TODO: header does't contain integration time # aartfaac imaginig pipeline issue #25 self.tau_time = 1
def casa_detect(filename): """ Detect which telescope produced CASA data, return corresponding accessor. Checks for known CASA table types where we expect additional metadata. If the telescope is unknown we return nothing. """ table = casacore_table(filename.encode(), ack=False) telescope = table.getkeyword('coords')['telescope'] return casa_telescope_keyword_mapping.get(telescope, None)
def open_subtables(self): """open all subtables defined in the LOFAR format args: table: a casacore table handler to a LOFAR CASA table returns: a dict containing all LOFAR CASA subtables """ subtables = {} for subtable in subtable_names: subtable_location = self.table.getkeyword("ATTRGROUPS")[subtable] subtables[subtable] = casacore_table(subtable_location, ack=False) return subtables
def __init__(self, url, plane=0, beam=None): super(LofarCasaImage, self).__init__(url, plane, beam) table = casacore_table(self.url.encode(), ack=False) subtables = self.open_subtables(table) self.taustart_ts = self.parse_taustartts(subtables) self.tau_time = self.parse_tautime(subtables) # Additional, LOFAR-specific metadata self.antenna_set = self.parse_antennaset(subtables) self.ncore, self.nremote, self.nintl = self.parse_stations(subtables) self.subbandwidth = self.parse_subbandwidth(subtables) self.subbands = self.parse_subbands(subtables)
def __init__(self, url, plane=0, beam=None): super(CasaImage, self).__init__() self.url = url self.table = casacore_table(self.url.encode(), ack=False) self.data = self.parse_data(plane) self.wcs = self.parse_coordinates() self.centre_ra, self.centre_decl = self.parse_phase_centre() self.freq_eff, self.freq_bw = self.parse_frequency() self.pixelsize = self.parse_pixelsize() if beam: (bmaj, bmin, bpa) = beam else: bmaj, bmin, bpa = self.parse_beam() self.beam = self.degrees2pixels( bmaj, bmin, bpa, self.pixelsize[0], self.pixelsize[1])
def iscasa(filename): """returns True if filename is a lofar casa directory""" if not os.path.isdir(filename): return False for file_ in casafiles: casafile = os.path.join(filename, file_) if not os.path.isfile(casafile): logger.debug("%s doesn't contain %s" % (filename, file_)) return False try: table = casacore_table(filename.encode(), ack=False) table.close() except RuntimeError as e: logger.debug("directory looks casacore, but cannot open: %s" % str(e)) return False return True
def __init__(self, url, plane=0, beam=None): super(CasaImage, self).__init__() self.url = url # we don't want the table as a property since it makes the accessor # not serializable table = casacore_table(self.url.encode(), ack=False) self.data = self.parse_data(table, plane) self.wcs = self.parse_coordinates(table) self.centre_ra, self.centre_decl = self.parse_phase_centre(table) self.freq_eff, self.freq_bw = self.parse_frequency(table) self.pixelsize = self.parse_pixelsize() if beam: (bmaj, bmin, bpa) = beam else: bmaj, bmin, bpa = self.parse_beam(table) self.beam = self.degrees2pixels( bmaj, bmin, bpa, self.pixelsize[0], self.pixelsize[1])
def __init__(self, url, plane=0, beam=None): super(Kat7CasaImage, self).__init__(url, plane, beam) table = casacore_table(self.url.encode(), ack=False) self.taustart_ts = self.parse_taustartts(table) self.tau_time = 1 # Placeholder value
def __init__(self, url, plane=0, beam=None): super(Kat7CasaImage, self).__init__(url, plane, beam) table = casacore_table(self.url, ack=False) self.taustart_ts = self.parse_taustartts(table) self.tau_time = 1 # Placeholder value