Ejemplo n.º 1
0
def readACC(fn, fDict, lofarStation, sbs, calTable=None):
    """Return the visibilites and UVW coordinates from a LOFAR station ACC file
    fn: ACC filename
    fDict: dictionary of file format meta data, see parse()
    lofarStation: instance, see lofarConfig.py
    sbs: 1-D array of subband IDs (in range 0-511)
    calTable: station gain calibration table filename

    returns:
        vis: visibilities [4, Nsamples, Nsubbands]
        uvw: UVW coordinates [Nsamples, 3, Nsubbands]
        freqs: frequencies [Nsubbands]
        obsdata: [latitude, longitude, LST]
    """

    # longitude and latitude of array
    lat, lon, elev = lofarArrayLatLong(
        lofarStation, lofarConfig.rcuInfo[fDict['rcu']]['array_type'])

    # antenna positions
    ants = lofarStation.antField.antpos[lofarConfig.rcuInfo[fDict['rcu']]
                                        ['array_type']]
    if 'elem' in fDict:  # update the antenna positions if there is an element string
        ants = lofarHBAAntPositions(ants, lofarStation, fDict['elem'])
    nants = ants.shape[0]
    print 'NANTENNAS:', nants

    # frequency information
    freqs, nchan, bw = lofarFreqs(fDict, sbs)
    print 'SUBBANDS:', sbs, '(', freqs / 1e6, 'MHz)'
    npols = 2

    # read LOFAR Calibration Table
    if not (calTable is None):
        if antGains is None:  # read the Cal Table only once
            print 'Using CalTable:', calTable
            antGains = lofarConfig.readCalTable(calTable, nants, nchan, npols)
    else:
        antGains = None

    # get correlation matrix for subbands selected
    nantpol = nants * npols
    print 'Reading in visibility data file ...',
    corrMatrix, tDeltas = lofarACCSelectSbs(fn, sbs, nchan, nantpol,
                                            fDict['int'], antGains)
    print 'done'
    #print corrMatrix.shape, tDeltas.shape

    # create station observer
    obs = lofarObserver(lat, lon, elev, fDict['ts'])
    obsLat = float(obs.lat)  #radians
    obsLong = float(obs.long)  #radians
    print 'Observatory:', obs

    # get the UVW and visibilities for the different subbands
    vis, uvw, LSTangle = lofarGenUVW(corrMatrix, ants, obs, sbs,
                                     fDict['ts'] - np.array(tDeltas))

    return vis, uvw, freqs, [obsLat, obsLong, LSTangle]
Ejemplo n.º 2
0
def readKAIRAXST(fn, fDict, lofarStation, sbs, calTable=None, times='0'):
    """Return the visibilites and UVW coordinates from a KAIRA LOFAR XST format file
    fn: XST filename
    fDict: dictionary of file format meta data, see parse()
    lofarStation: instance, see lofarConfig.py
    sbs: 1-D array of subband IDs (in range 0-511)
    calTable: station gain calibration table filename
    times: the KAIRA XST files contain ~3600 integrations of 1 second each, this will result in a slow SWHT, to reduce this a number of options can be used
        i) a[seconds] : average together integrations into correlation matrixs for every block of time, e.g. times='a600' will average for 600 seconds, which is reasonable for the low resolution KAIRA station
        ii) select unique integrations: for multiple integrations use X,Y,Z and for range use X_Y notation, these can be combined, e.g. 0,100,200,300_310,400, default to function is to select only the first integration
        iii) d[step size]: decimate the integrations to select an integration every 'step size', e.g. d600 will select every 600th integration

    returns:
        vis: visibilities [4, Nsamples, Nsubbands]
        uvw: UVW coordinates [Nsamples, 3, Nsubbands]
        freqs: frequencies [Nsubbands]
        obsdata: [latitude, longitude, LST]
    """

    # longitude and latitude of array
    lat, lon, elev = lofarArrayLatLong(lofarStation, lofarConfig.rcuInfo[fDict['rcu']]['array_type'])

    # antenna positions
    ants = lofarStation.antField.antpos[lofarConfig.rcuInfo[fDict['rcu']]['array_type']]
    if 'elem' in fDict: # update the antenna positions if there is an element string
        ants = lofarHBAAntPositions(ants, lofarStation, fDict['elem'])
    nants = ants.shape[0]
    print 'NANTENNAS:', nants

    # frequency information
    freqs, nchan, bw = lofarFreqs(fDict, sbs)
    print 'SUBBANDS:', sbs, '(', freqs/1e6, 'MHz)'
    npols = 2

    #read LOFAR Calibration Table
    if not (calTable is None):
        if antGains is None: #read the Cal Table only once
            print 'Using CalTable:', calTable
            antGains = lofarConfig.readCalTable(calTable, nants, nchan, npols)
    else: antGains = None

    # get correlation matrix for subbands selected
    nantpol = nants * npols
    print 'Reading in visibility data file ...',
    corrMatrix, tDeltas = lofarKAIRAXST(fn, fDict['sb'], nantpol, fDict['int'], antGains, times=times)
    print 'done'

    # create station observer
    obs = lofarObserver(lat, lon, elev, fDict['ts'])
    obsLat = float(obs.lat) #radians
    obsLong = float(obs.long) #radians
    print 'Observatory:', obs

    # get the UVW and visibilities for the different subbands
    vis, uvw, LSTangle = lofarGenUVW(corrMatrix, ants, obs, sbs, fDict['ts']-np.array(tDeltas))

    return vis, uvw, freqs, [obsLat, obsLong, LSTangle]
Ejemplo n.º 3
0
def readACC(fn, fDict, lofarStation, sbs, calTable=None):
    """Return the visibilites and UVW coordinates from a LOFAR station ACC file
    fn: ACC filename
    fDict: dictionary of file format meta data, see parse()
    lofarStation: instance, see lofarConfig.py
    sbs: 1-D array of subband IDs (in range 0-511)
    calTable: station gain calibration table filename

    returns:
        vis: visibilities [4, Nsamples, Nsubbands]
        uvw: UVW coordinates [Nsamples, 3, Nsubbands]
        freqs: frequencies [Nsubbands]
        obsdata: [latitude, longitude, LST]
    """

    # longitude and latitude of array
    lat, lon, elev = lofarArrayLatLong(lofarStation, lofarConfig.rcuInfo[fDict['rcu']]['array_type'])

    # antenna positions
    ants = lofarStation.antField.antpos[lofarConfig.rcuInfo[fDict['rcu']]['array_type']]
    if 'elem' in fDict: # update the antenna positions if there is an element string
        ants = lofarHBAAntPositions(ants, lofarStation, fDict['elem'])
    nants = ants.shape[0]
    print 'NANTENNAS:', nants

    # frequency information
    freqs, nchan, bw = lofarFreqs(fDict, sbs)
    print 'SUBBANDS:', sbs, '(', freqs/1e6, 'MHz)'
    npols = 2

    # read LOFAR Calibration Table
    if not (calTable is None):
        if antGains is None: # read the Cal Table only once
            print 'Using CalTable:', calTable
            antGains = lofarConfig.readCalTable(calTable, nants, nchan, npols)
    else: antGains = None

    # get correlation matrix for subbands selected
    nantpol = nants * npols
    print 'Reading in visibility data file ...',
    corrMatrix, tDeltas = lofarACCSelectSbs(fn, sbs, nchan, nantpol, fDict['int'], antGains)
    print 'done'
    #print corrMatrix.shape, tDeltas.shape
    
    # create station observer
    obs = lofarObserver(lat, lon, elev, fDict['ts'])
    obsLat = float(obs.lat) #radians
    obsLong = float(obs.long) #radians
    print 'Observatory:', obs

    # get the UVW and visibilities for the different subbands
    vis, uvw, LSTangle = lofarGenUVW(corrMatrix, ants, obs, sbs, fDict['ts']-np.array(tDeltas))

    return vis, uvw, freqs, [obsLat, obsLong, LSTangle]
Ejemplo n.º 4
0
def readKAIRAXST(fn, fDict, lofarStation, sbs, calTable=None, times='0'):
    """Return the visibilites and UVW coordinates from a KAIRA LOFAR XST format file
    fn: XST filename
    fDict: dictionary of file format meta data, see parse()
    lofarStation: instance, see lofarConfig.py
    sbs: 1-D array of subband IDs (in range 0-511)
    calTable: station gain calibration table filename
    times: the KAIRA XST files contain ~3600 integrations of 1 second each, this will result in a slow SWHT, to reduce this a number of options can be used
        i) a[seconds] : average together integrations into correlation matrixs for every block of time, e.g. times='a600' will average for 600 seconds, which is reasonable for the low resolution KAIRA station
        ii) select unique integrations: for multiple integrations use X,Y,Z and for range use X_Y notation, these can be combined, e.g. 0,100,200,300_310,400, default to function is to select only the first integration
        iii) d[step size]: decimate the integrations to select an integration every 'step size', e.g. d600 will select every 600th integration

    returns:
        vis: visibilities [4, Nsamples, Nsubbands]
        uvw: UVW coordinates [Nsamples, 3, Nsubbands]
        freqs: frequencies [Nsubbands]
        obsdata: [latitude, longitude, LST]
    """

    # longitude and latitude of array
    lat, lon, elev = lofarArrayLatLong(
        lofarStation, lofarConfig.rcuInfo[fDict['rcu']]['array_type'])

    # antenna positions
    ants = lofarStation.antField.antpos[lofarConfig.rcuInfo[fDict['rcu']]
                                        ['array_type']]
    if 'elem' in fDict:  # update the antenna positions if there is an element string
        ants = lofarHBAAntPositions(ants, lofarStation, fDict['elem'])
    nants = ants.shape[0]
    print 'NANTENNAS:', nants

    # frequency information
    freqs, nchan, bw = lofarFreqs(fDict, sbs)
    print 'SUBBANDS:', sbs, '(', freqs / 1e6, 'MHz)'
    npols = 2

    #read LOFAR Calibration Table
    if not (calTable is None):
        if antGains is None:  #read the Cal Table only once
            print 'Using CalTable:', calTable
            antGains = lofarConfig.readCalTable(calTable, nants, nchan, npols)
    else:
        antGains = None

    # get correlation matrix for subbands selected
    nantpol = nants * npols
    print 'Reading in visibility data file ...',
    corrMatrix, tDeltas = lofarKAIRAXST(fn,
                                        fDict['sb'],
                                        nantpol,
                                        fDict['int'],
                                        antGains,
                                        times=times)
    print 'done'

    # create station observer
    obs = lofarObserver(lat, lon, elev, fDict['ts'])
    obsLat = float(obs.lat)  #radians
    obsLong = float(obs.long)  #radians
    print 'Observatory:', obs

    # get the UVW and visibilities for the different subbands
    vis, uvw, LSTangle = lofarGenUVW(corrMatrix, ants, obs, sbs,
                                     fDict['ts'] - np.array(tDeltas))

    return vis, uvw, freqs, [obsLat, obsLong, LSTangle]