Imaging

Imaging

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

Changed in version 1.1.0: ‘set’ can now be either an integer or a list to pull back multiple integrations.

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

Changed in version 1.1.0: ‘set’ can now be either an integer or a list to pull back multiple integrations.

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

Changed in version 1.1.0: ‘set’ can now be either an integer or a list to pull back multiple integrations.

getObserver()

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

class lsl.imaging.utils.ImgWPlus(size=100, res=1, wres=0.5, mf_order=0)

Sub-class of the aipy.img.ImgW class that adds support for different visibility weighting scheme and uv plane tapering. This class also adds in a couple of additional methods that help determine the size of the field of view and the pixels near the phase center.

bm_image(center=(0, 0), term=None, weighting='natural', localFraction=0.5, robust=0.0, taper=(0.0, 0.0))

Return the inverse FFT of the sample weightings (for all mf_order terms, or the specified term if supplied), with the 0,0 point moved to ‘center’. In the images return north is up and east is to the left.

There are a few keywords that control how the image is formed. There are:

  • weighting - The weighting scheme (‘natural’, ‘uniform’, or

    ‘briggs’) used on the data;

  • localFraction - The fraction of the uv grid that is consider

    “local” for the ‘uniform’ and ‘briggs’ methods;

  • robust - The value for the weighting robustness under the

    ‘briggs’ method; and

  • taper - The size of u and v Gaussian tapers at the 30% level.

getFieldOfView()

Return the approximate size of the field of view in radians. The field of view calculate is based off the maximum and minimum values of L found for the inverted uv matrix.

getPixelSize()

Return the approximate size of pixels at the phase center in radians. The pixel size is averaged over the four pixels that neighboor the phase center.

image(center=(0, 0), weighting='natural', localFraction=0.5, robust=0.0, taper=(0.0, 0.0))

Return the inverse FFT of the UV matrix, with the 0,0 point moved to ‘center’. In the images return north is up and east is to the left.

There are a few keywords that control how the image is formed. There are:

  • weighting - The weighting scheme (‘natural’, ‘uniform’, or

    ‘briggs’) used on the data;

  • localFraction - The fraction of the uv grid that is consider

    “local” for the ‘uniform’ and ‘briggs’ methods;

  • robust - The value for the weighting robustness under the

    ‘briggs’ method; and

  • taper - The size of u and v Gaussian tapers at the 30% level.

put(uvw, data, wgts=None, invker2=None)

Same as Img.put, only now the w component is projected to the w=0 plane before applying the data to the UV matrix.

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, shifted=True, origin='lower', 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 matplotlib object added to the plot

Changed in version 1.2.1: Changed the function to return the matplotlib object plotted so that colorbars can be added

Changed in version 1.1.0: Added a ‘shifted’ keyword to control whether or not the image is centered or not.

New in version 1.0.1.

lsl.imaging.utils.getImageRADec(gimg, aa, phaseCenter='z', shifted=True)

Given a gridded image generated by the buildGriddedImage() function and an AntennaArray instance, return a two-element tuple containing the RA and dec. values (in radians) for each pixel in the image.

The ‘phaseCenter’ keyword controls what the phase center of the image is and defaults to zenith.

lsl.imaging.utils.getImageAzEl(gimg, aa, phaseCenter='z', shifted=True)

Given a gridded image generated by the buildGriddedImage() function and an AntennaArray instance, return a two-element tuple containing the azimuth and elevation (altitude), both in radians, for each pixel in the image.

The ‘phaseCenter’ keyword controls what the phase center of the image is and defaults to zenith.

Self-Calibration

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

lsl.imaging.deconv.clean(aa, dataDict, aipyImg, imageInput=None, MapSize=80, MapRes=0.5, MapWRes=0.1, pol='xx', chan=None, gain=0.2, maxIter=150, sigma=3.0, verbose=True, plot=False)

Given a AIPY antenna array instance, a data dictionary, 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.2)
  • maxIter - Maximum number of iterations (default 150)
  • sigma - Threshold in sigma to stop cleaning (default 3.0)
lsl.imaging.deconv.cleanSources(aa, dataDict, aipyImg, srcs, imageInput=None, MapSize=80, MapRes=0.5, MapWRes=0.1, pol='xx', chan=None, gain=0.1, maxIter=150, sigma=2.0, verbose=True, plot=False)

Given a AIPY antenna array instance, a data dictionary, an AIPY ImgW instance filled with data, and a dictionary of sources, return the CLEAN components and the residuals map. 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.

This function differs from clean() in that it only cleans localized regions around each source rather than the whole image. This is intended to help the mem() function along.

CLEAN tuning parameters:
  • gain - CLEAN loop gain (default 0.1)
  • maxIter - Maximum number of iterations (default 150)
  • sigma - Threshold in sigma to stop cleaning (default 2.0)
lsl.imaging.deconv.lsq(aa, dataDict, aipyImg, imageInput=None, MapSize=80, MapRes=0.5, MapWRes=0.1, pol='xx', chan=None, gain=0.05, maxIter=150, rtol=1e-09, verbose=True, plot=False)

Given a AIPY antenna array instance, a data dictionary, and an AIPY ImgW instance filled with data, return a deconvolved image. This function implements a least squares deconvolution.

Least squares tuning parameters:
  • gain - least squares loop gain (default 0.05)

  • maxIter - Maximum number of iteration (default 150)

  • rtol - Minimum change in the residual RMS between iterations

    (default 1e-9)

Table Of Contents

Previous topic

Correlation

Next topic

Post-Acquisition Beam Forming

This Page