Imaging

Imaging

Module to support imaging correlated data. This module provides utilities to read FITS IDI files into data dictionaries (as described in lsl.sim.vis) and build AIPY ImgW instances from the data dictionaries. Also included is a utility to sort data dictionaries by baselines.

New in version 0.5.0.

Changed in version 1.0.0: Added support for UVFITS files and CASA measurement sets

Changed in version 1.0.1: Added the plotGriddedImage() function

lsl.imaging.utils.baselineOrder(bls)

Like numpy.argsort(), but for a list of two-element tuples of baseline pairs. The resulting lists can then be used to sort a data dictionary a la sortDataDict().

lsl.imaging.utils.sortDataDict(dataDict, order=None)

Sort a data dictionary by the specified order. If no order is supplied, the data dictionary is sorted by baseline using baselineOrder().

lsl.imaging.utils.pruneBaselineRange(dataDict, uvMin=0, uvMax=inf)

Prune baselines from a data dictionary that are less than uvMin or greater than or equal to uvMax.

Note

uvMin and uvMax should be specified in lambda

lsl.imaging.utils.rephaseData(aa, dataDict, currentPhaseCenter='z', newPhaseCenter='z')

Given an AntennaArray instance and a data dictionary, re-phase the data to change the pointing center.

lsl.imaging.utils.CorrelatedData(filename)

Read in and work with FITS IDI and UVFITS files. Returns either a CorrelateDataIDI or CorrelatedDataUV instance.

class lsl.imaging.utils.CorrelatedDataIDI(filename)

Class to make accessing information about a FITS IDI easy. This wraps all of the “messy” machinery needed to extract both the metadata and data from the file and return them as common LSL objects.

This class has three main attributes to interact with:
  • getAntennaArray - Return a lsl.sim.vim.AntennaArray instance that represents the array where the data was obtained. This is useful for simulation proposes and computing source positions.
  • getObserver - Return a ephem.Observer instance representing the array
  • getDataSet - Return a data dictionary of all baselines for a given set of observations
The class also includes a variety of useful metadata attributes:
  • pols - Numpy array of polarization product codes
  • freq - Numpy array of frequency channels in Hz
  • station - LSL lsl.common.stations.LWAStation instance for the array
  • dateObs - Datetime object for the reference date of the FIT IDI file
  • antennas - List of lsl.common.stations.Antenna instances

Note

The CorrelatedData.antennas attribute should be used over CorrelatedData.station.getAntennas() since the mapping in the FITS IDI file may not be the same as the digitizer order.

getAntennaArray()

Return an AIPY AntennaArray instance for the array that made the observations contained here.

getDataSet(set, includeAuto=False, sort=True, uvMin=0, uvMax=inf)

Return a baseline sorted data dictionary for the specified data set. By default this excludes the autocorrelations. To include autocorrelations set the value of ‘includeAuto’ to True. Setting the ‘sort’ keyword to False will disable the baseline sorting. Optionally, baselines with lengths between uvMin and uvMax can only be returned.

Note

uvMin and uvMax should be specified in lambda

getObserver()

Return a ephem.Observer instances for the array described in the file.

class lsl.imaging.utils.CorrelatedDataUV(filename)

Class to make accessing information about a UVFITS file easy. This wraps all of the “messy” machinery needed to extract both the metadata and data from the file and return them as common LSL objects.

This class has three main attributes to interact with:
  • getAntennaArray - Return a lsl.sim.vim.AntennaArray instance that represents the array where the data was obtained. This is useful for simulation proposes and computing source positions.
  • getObserver - Return a ephem.Observer instance representing the array
  • getDataSet - Return a data dictionary of all baselines for a given set of observations
The class also includes a variety of useful metadata attributes:
  • pols - Numpy array of polarization product codes
  • freq - Numpy array of frequency channels in Hz
  • station - LSL lsl.common.stations.LWAStation instance for the array
  • dateObs - Datetime object for the reference date of the FIT IDI file
  • antennas - List of lsl.common.stations.Antenna instances

Note

The CorrelatedDataUV.antennas attribute should be used over CorrelatedDataUV.station.getAntennas() since the mapping in the UVFITS file may not be the same as the digitizer order.

getAntennaArray()

Return an AIPY AntennaArray instance for the array that made the observations contained here.

getDataSet(set, includeAuto=False, sort=True, uvMin=0, uvMax=inf)

Return a baseline sorted data dictionary for the specified data set. By default this excludes the autocorrelations. To include autocorrelations set the value of ‘includeAuto’ to True. Setting the ‘sort’ keyword to False will disable the baseline sorting. Optionally, baselines with lengths between uvMin and uvMax can only be returned.

Note

uvMin and uvMax should be specified in lambda

getObserver()

Return a ephem.Observer instances for the array described in the file.

class lsl.imaging.utils.CorrelatedDataMS(filename)

Class to make accessing information about a MS easy. This wraps all of the “messy” machinery needed to extract both the metadata and data from the file and return them as common LSL objects.

This class has three main attributes to interact with: * getAntennaArray - Return a lsl.sim.vim.AntennaArray instance that represents the array where the data was obtained. This is useful for simulation proposes and computing source positions. * getObserver - Return a ephem.Observer instance representing the array * getDataSet - Return a data dictionary of all baselines for a given set of observations

The class also includes a variety of useful metadata attributes: * pols - Numpy array of polarization product codes * freq - Numpy array of frequency channels in Hz * station - LSL lsl.common.stations.LWAStation instance for the array * dateObs - Datetime object for the reference date of the FIT IDI file * antennas - List of lsl.common.stations.Antenna instances

Note

The CorrelatedDataMS.antennas attribute should be used over CorrelatedDataMS.station.getAntennas() since the mapping in the MS may not be the same as the digitizer order.

getAntennaArray()

Return an AIPY AntennaArray instance for the array that made the observations contained here.

getDataSet(set, includeAuto=False, sort=True, uvMin=0, uvMax=inf)

Return a baseline sorted data dictionary for the specified data set. By default this excludes the autocorrelations. To include autocorrelations set the value of ‘includeAuto’ to True. Setting the ‘sort’ keyword to False will disable the baseline sorting. Optionally, baselines with lengths between uvMin and uvMax can only be returned.

Note

uvMin and uvMax should be specified in lambda

getObserver()

Return a ephem.Observer instances for the array described in the file.

lsl.imaging.utils.buildGriddedImage(dataDict, MapSize=80, MapRes=0.5, MapWRes=0.1, pol='xx', chan=None, verbose=True)

Given a data dictionary, build an aipy.img.ImgW object of gridded uv data which can be used for imaging. The ImgW object itself is returned by this function to make it more versatile.

lsl.imaging.utils.plotGriddedImage(ax, gimg, interpolation='nearest', **kwargs)

Given a blank matplotlib axes instance and a gridded image generated by the buildGriddedImage() function, plot the image on the axes and setup the basic coordinate system. This function returns the NumPy array of the image that is plotted.

New in version 1.0.1.

Self-Calibration

Simple self-calibration module for correlated TBW and TBN data. The supported self-calibration methods are:

  • phase-only
  • amplitude and phase
  • delay-only
  • amplitude and delay
  • delay/phase offset
  • amplitude and delay/phase offset
..versionchanged:: 0.6.3
Reworked the module to make it more versatile

..versionadded:: 0.5.5

lsl.imaging.selfCal.phaseOnly(aa, dataDict, simDict, chan, pol, refAnt=0, nIter=30, amplitude=False, amplitudeCutoff=1.001, phaseCutoff=0.01, verbose=True)

Function to apply a phase-only (and, optionally, a amplitude) self- calibration to data stored in a readUVData dictionary and a model sky stored in a lsl.sim.vis.buildSimSky dictionary for the given polarization and channel(s).

Note

If the “amplitude” keyword is set to True, a three-element tuple of self-cal’d data, gain coefficients, and phase offsets is returned rather than the standard two-element tuple.

lsl.imaging.selfCal.delayOnly(aa, dataDict, simDict, chan, pol, refAnt=0, nIter=30, amplitude=False, amplitudeCutoff=1.001, delayCutoff=0.2, verbose=True)

Function to apply a delay-only (and, optionally, a amplitude) self- calibration to data stored in a readUVData dictionary and a model sky stored in a lsl.sim.vis.buildSimSky dictionary for the given polarization and channel(s).

Note

If the “amplitude” keyword is set to True, a three-element tuple of self-cal’d data, gain coefficients, and delays in ns is returned rather than the standard two-element tuple.

lsl.imaging.selfCal.delayAndPhase(aa, dataDict, simDict, chan, pol, refAnt=0, nIter=30, amplitude=False, amplitudeCutoff=1.001, delayCutoff=0.2, phaseCutoff=0.01, verbose=True)

Function to apply a delay and phase offset (and, optionally, a amplitude) self-calibration to data stored in a readUVData dictionary and a model sky stored in a lsl.sim.vis.buildSimSky dictionary for the given polarization and channel(s).

Note

If the “amplitude” keyword is set to True, a four-element tuple of self-cal’d data, gain coefficients, delays in ns, and phase offsets is returned rather than the standard three-element tuple.

Deconvolution

Deconvolution support for images made with lsl.imaging.utils.buildGriddedImage().

lsl.imaging.deconv.estimateBeam(aa, HA, dec, MapSize=80, MapRes=0.5, MapWRes=0.1, chan=None, baselines=None, scale=0.0)

Compute the beam shape for a specified pointing and array configuration. To get the scale of the beam and the gridding correct, the MapSize, MapRes, and MapWRes for the image all need to be specified.

Returns a numpy array of the beam response.

lsl.imaging.deconv.deconvolve(aa, dataDict, aipyImg, MapSize=80, MapRes=0.5, MapWRes=0.1, chan=None, gain=0.3, maxIter=150, scales=[0], verbose=True)

Given a AIPY antenna array instance and an AIPY ImgW instance filled with data, return a deconvolved image. This function uses a CLEAN-like method that computes the array beam for each peak in the flux. Thus the CLEAN loop becomes:

  1. Find the peak flux in the residual image
  2. Compute the systems response to a point source at that location
  3. Remove the scaled porition of this beam from the residuals
  4. Go to 1.
CLEAN tuning parameters:
  • gain - CLEAN loop gain (default 0.1)
  • maxIter - Maximum number of iteration (default 150)

Table Of Contents

Previous topic

Correlation

Next topic

Post-Acquisition Beam Forming

This Page