pipeline.hif.heuristics package

Submodules

pipeline.hif.heuristics.bandpass module

class pipeline.hif.heuristics.bandpass.MedianSNR[source]

Bases: pipeline.infrastructure.api.Heuristic

calculate(snr)[source]

Make a calculation based on the given parameters.

This is an abstract method and must be implemented by all Heuristic subclasses.

Note

The signature and return types of calculate() are intended to be implementation specific. Refer to the documentation of the implementing class for the appropriate signature.

pipeline.hif.heuristics.bporder module

class pipeline.hif.heuristics.bporder.BPOrder[source]

Bases: pipeline.infrastructure.api.Heuristic

calculate(channel_data={'DV01': []})[source]

Method to estimate the order of polynomial required to fit the give data sequence. Does this by:

# Fourier transform the sequence # Find highest frequency in the amplitude spectrum > 10 * mean # Order = max(2, 3 * frequency)

Keyword arguments: data – A dictionary of data sequences keyed by antenna identifier

Returns: order - order of polynomial required.

pipeline.hif.heuristics.checkproductsize module

class pipeline.hif.heuristics.checkproductsize.CheckProductSizeHeuristics(inputs)[source]

Bases: object

calculate_sizes(imlist)[source]
mitigate_imsize()[source]

Mitigate product size by adjusting ppb and imsize only. This is used in the VLA imaging heuristic, see PIPE-676.

Uses the size_mitigation_parameters dictionary similarly to mitigate_sizes() method.

mitigate_sizes()[source]

pipeline.hif.heuristics.cleanbox module

pipeline.hif.heuristics.cleanbox.analyse_clean_result(multiterm, model, restored, residual, pb, cleanmask, pblimit_image=0.2, pblimit_cleanmask=0.3, cont_freq_ranges=None)[source]

pipeline.hif.heuristics.findcont module

class pipeline.hif.heuristics.findcont.FindContHeuristics(context)[source]

Bases: object

find_continuum(dirty_cube, pb_cube=None, psf_cube=None, single_continuum=False)[source]

pipeline.hif.heuristics.findrefant module

class pipeline.hif.heuristics.findrefant.RefAntFlagging(vis, field, spw, intent)[source]

Bases: object

calc_score()[source]
class pipeline.hif.heuristics.findrefant.RefAntGeometry(vis)[source]

Bases: object

calc_score()[source]
class pipeline.hif.heuristics.findrefant.RefAntHeuristics(vis, field, spw, intent, geometry, flagging, refantignore=None)[source]

Bases: object

calculate()[source]
refantignore

VisDependentProperty is a Python data descriptor that standardises the behaviour of pipeline Inputs properties and lets them create default values more easily.

On reading a VisDependentProperty (ie. using the dot prefix: inputs.solint), one of two things happens:

  1. If a NullMarker is found - signifying that no user input has been provided - and a ‘getter’ function has been defined, the getter function will be called to provide a default value for that measurement set.

  2. If a user has overridden the value (eg. inputs.solint = 123), that value will be retrieved.

  3. The value, either the default from step 1 or user-provided from step 2, is run through the optional postprocess function, which gives a final opportunity to change the value depending on the state/value of other properties.

A VisDependentProperty can be made read-only by specifying ‘readonly=True’ when creating the instance.

A VisDependentProperty can be hidden from the containing Inputs string representation by setting ‘hidden=True’ when creating the instance. This will hide the property from the web log and CLI getInputs calls.

Each VisDependentProperty has a set of values it considers equivalent to null. When the user sets the VDP value to one of these null values, the VDP machinery converts this to a private NullObject marker that signifies the property is now unset, resulting in the default value being returned next time the property is read. Developers can specify which values should be converted to NullObject by specifying null_input at creation time, e.g.,

solint = @VisDependentProperty(default=5, null_input=[None, ‘’, ‘RESET’, -1])

pipeline.hif.heuristics.gaincal module

class pipeline.hif.heuristics.gaincal.MedianSNRNoAdapter[source]

Bases: pipeline.infrastructure.api.Heuristic

calculate(caltable)[source]

Opens and reads the SNR column from the given caltable, and returns the median value.

Parameters

caltable (string) – the caltable filename

pipeline.hif.heuristics.imageparams_alma module

class pipeline.hif.heuristics.imageparams_alma.ImageParamsHeuristicsALMA(vislist, spw, observing_run, imagename_prefix='', proj_params=None, contfile=None, linesfile=None, imaging_params={})[source]

Bases: pipeline.hif.heuristics.imageparams_base.ImageParamsHeuristics

calc_percentile_baseline_length(percentile)[source]

Calculate percentile baseline length for the vis list used in this heuristics instance.

dr_correction(threshold, dirty_dynamic_range, residual_max, intent, tlimit)[source]

Adjustment of cleaning threshold due to dynamic range limitations.

get_autobox_params(iteration, intent, specmode, robust)[source]

Default auto-boxing parameters for ALMA main array and ACA.

intent()[source]
keep_iterating(iteration, hm_masking, tclean_stopcode, dirty_dynamic_range, residual_max, residual_robust_rms, field, intent, spw, specmode)[source]

Determine if another tclean iteration is necessary.

mosweight(intent, field)[source]

tclean flag to use mosaic weighting.

niter_correction(niter, cell, imsize, residual_max, threshold, residual_robust_rms, mask_frac_rad=0.0)[source]

Adjustment of number of cleaning iterations due to mask size.

See base class method for parameter description.

nterms(spwspec)[source]
robust()[source]

robust parameter heuristic.

threshold(iteration, threshold, hm_masking)[source]
uvtaper(beam_natural=None, protect_long=3)[source]

Adjustment of uvtaper parameter based on desired resolution or representative baseline length.

warn_missing_cont_ranges()[source]

pipeline.hif.heuristics.imageparams_base module

class pipeline.hif.heuristics.imageparams_base.ImageParamsHeuristics(vislist, spw, observing_run, imagename_prefix='', proj_params=None, contfile=None, linesfile=None, imaging_params={})[source]

Bases: object

Image parameters heuristics base class. One instance is made per make/editimlist call. There are subclasses for different imaging modes such as ALMA or VLASS.

aggregate_bandwidth(spwids=None)[source]
antenna_diameters(vislist=None)[source]

Count the antennas of given diameters per MS.

antenna_ids(intent, vislist=None)[source]

Get the antenna IDs to be used for imaging.

calc_sensitivities(vis, field, intent, spw, nbin, spw_topo_chan_param_dict, specmode, gridder, cell, imsize, weighting, robust, uvtaper, center_only=False, known_sensitivities={}, force_calc=False)[source]

Compute sensitivity estimate using CASA.

calc_topo_ranges(inputs)[source]

Calculate TOPO ranges for hif_tclean inputs.

cell(beam, pixperbeam=5.0)[source]

Calculate cell size.

center_field_ids(msnames, field, intent, phasecenter, exclude_intent=None)[source]

Get per-MS IDs of field closest to the phase center.

check_psf(psf_name, field, spw)[source]

Check for bad psf fits.

conjbeams()[source]
cont_ranges_spwsel()[source]

Determine spw selection parameters to exclude lines for mfs and cont images.

cyclefactor(iteration)[source]
cycleniter(iteration)[source]
datacolumn()[source]
deconvolver(specmode, spwspec)[source]
dr_correction(threshold, dirty_dynamic_range, residual_max, intent, tlimit)[source]

Adjustment of cleaning threshold due to dynamic range limitations.

field(intent, field, exclude_intent=None, vislist=None)[source]
field_intent_list(intent, field)[source]
find_good_commonbeam(psf_filename)[source]

Find and replace outlier beams to calculate a good common beam. Method from Urvashi Rao.

Returns new common beam and array of channel numbers with invalid beams. Leaves old beams in the PSF as is.

freq_intersection(vis, field, intent, spw, frame='LSRK')[source]

Calculate LSRK frequency intersection of a list of MSs for a given field and spw. Exclude flagged channels.

get_autobox_params(iteration, intent, specmode, robust)[source]

Default auto-boxing parameters.

get_bw_corr_factor(ms_do, spw, nchan)[source]

Calculate effective bandwidth correction factor.

get_channel_flags(msname, field, spw)[source]

Determine channel flags for a given field and spw selection in one MS.

get_first_unflagged_channel_from_center(channel_flags)[source]

Find first unflagged channel from center channel.

get_fractional_bandwidth(spwspec)[source]

Returns fractional bandwidth for selected spectral windows

get_min_max_freq(spwspec)[source]

Given a comma separated string list of spectral windows, determines the minimum and maximum frequencies in spectral window list and the corresponding spectral window indexes.

Parameters

spwspec – comma separated string list of spectral windows.

Returns

dictionary min. and max. frequencies (in Hz) and corresponding spw indexes.

get_scanidlist(vis, field, intent)[source]
get_sensitivity(ms_do, field, intent, spw, chansel, specmode, cell, imsize, weighting, robust, uvtaper)[source]

Get sensitivity for a field / spw / chansel combination from CASA’s apparentsens method and a correction for effective channel widths in case of online smoothing.

This heuristic is currently optimized for ALMA data only.

gridder(intent, field)[source]
has_data(field_intent_list, spwspec, vislist=None)[source]
imagename(output_dir=None, intent=None, field=None, spwspec=None, specmode=None, band=None)[source]
imsize(fields, cell, primary_beam, sfpblimit=None, max_pixels=None, centreonly=False, vislist=None, spwspec=None)[source]

Image size heuristics for single fields and mosaics. The pixel count along x and y image dimensions is determined by the cell size, primary beam size and the spread of phase centers in case of mosaics.

Parameters
  • fields – list of comma separated strings of field IDs per MS.

  • cell – pixel (cell) size in arcsec.

  • primary_beam – primary beam width in arcsec.

  • sfpblimit – single field primary beam response. If provided then imsize is chosen such that the image edge is at normalised primary beam level equals to sfpblimit.

  • max_pixels – maximum allowed pixel count, integer. The same limit is applied along both image axes.

  • centreonly – if True, then ignore the spread of field centers.

  • vislist – list of visibility path string to be used for imaging. If not set then use all visibilities in the context.

  • spwspec – ID list of spectral windows used to create image product. List or string containing comma separated spw IDs list. Not used in the base method.

Returns

two element list of pixel count along x and y image axes.

is_eph_obj(field)[source]
keep_iterating(iteration, hm_masking, tclean_stopcode, dirty_dynamic_range, residual_max, residual_robust_rms, field, intent, spw, specmode)[source]

Determine if another tclean iteration is necessary.

largest_primary_beam_size(spwspec, intent)[source]
majority_antenna_ids(vislist=None)[source]

Get the IDs of the majority (by diameter) antennas per MS.

mask()[source]
mosweight(intent, field)[source]

tclean flag to use mosaic weighting.

nchan_and_width(field_intent, spwspec)[source]
ncorr(spwid)[source]
niter()[source]
niter_correction(niter, cell, imsize, residual_max, threshold, residual_robust_rms, mask_frac_rad=0.0)[source]

Adjustment of number of cleaning iterations due to mask size.

Circular mask is assumed with a radius equal to mask_frac_rad times the longest image dimension in arcsec. If mask_frac_rad=0.0, then no new cleaning iteration step number is estimate and the input niter value is returned.

Note that the method assumes synthesized_beam = 5 * cell. This might lead to underestimated new niter value if the beam is sampled by less than 5 pixels (e.g. when hif_checkproductsize() task was called earlier.

Parameters
  • niter – User or heuristics set number of cleaning iterations

  • cell – Image cell size in arcsec

  • imsize – Two element list or array of image pixel count along x and y axis

  • residual_max – Dirty image residual maximum [Jy].

  • threshold – Cleaning threshold value [Jy].

  • residual_robust_rms – Residual scaled MAD [Jy] (not used in base method).

  • mask_frac_rad – Mask radius is given by mask_frac_rad * max(imsize) * cell [arcsec]

Returns

Modified niter value based on mask and beam size heuristic.

nsigma(iteration, hm_nsigma)[source]
nterms(spwspec)[source]
pb_correction()[source]
pblimits(pb)[source]
phasecenter(fields, centreonly=True, vislist=None, shift_to_nearest_field=False, primary_beam=None, intent='TARGET')[source]
primary_beam_size(spwid, intent)[source]

Calculate primary beam size in arcsec.

reffreq()[source]
representative_target()[source]
restfreq()[source]
robust()[source]

Default robust value.

rotatepastep()[source]
savemodel(iteration)[source]
scales()[source]
specmode()[source]
stokes()[source]
synthesized_beam(field_intent_list, spwspec, robust=0.5, uvtaper=[], pixperbeam=5.0, known_beams={}, force_calc=False, parallel='automatic', shift=False)[source]

Calculate synthesized beam for a given field / spw selection.

threshold(iteration, threshold, hm_masking)[source]
usepointing()[source]

tclean flag to use pointing table.

uvrange(field=None, spwspec=None)[source]
uvtaper(beam_natural=None, protect_long=None)[source]
warn_missing_cont_ranges()[source]
width(spwid)[source]
wprojplanes()[source]

pipeline.hif.heuristics.imageparams_factory module

class pipeline.hif.heuristics.imageparams_factory.ImageParamsHeuristicsFactory[source]

Bases: object

Imaging heuristics factory class.

static getHeuristics(vislist, spw, observing_run, imagename_prefix='', proj_params=None, contfile=None, linesfile=None, imaging_params={}, imaging_mode='ALMA')[source]

pipeline.hif.heuristics.imageparams_vla module

class pipeline.hif.heuristics.imageparams_vla.ImageParamsHeuristicsVLA(vislist, spw, observing_run, imagename_prefix='', proj_params=None, contfile=None, linesfile=None, imaging_params={})[source]

Bases: pipeline.hif.heuristics.imageparams_base.ImageParamsHeuristics

deconvolver(specmode, spwspec)[source]

See PIPE-679 and CASR-543

imagename(output_dir=None, intent=None, field=None, spwspec=None, specmode=None, band=None)[source]
imsize(fields, cell, primary_beam, sfpblimit=None, max_pixels=None, centreonly=False, vislist=None, spwspec=None)[source]

Image size heuristics for single fields and mosaics. The pixel count along x and y image dimensions is determined by the cell size, primary beam size and the spread of phase centers in case of mosaics.

Frequency dependent image size may be computed for VLA imaging.

For single fields, 18 GHz and above FOV extends to the first minimum of the primary beam Airy pattern. Below 18 GHz, FOV extends to the second minimum (incorporating the first sidelobes).

See PIPE-675 and CASR-543

Parameters
  • fields – list of comma separated strings of field IDs per MS.

  • cell – pixel (cell) size in arcsec.

  • primary_beam – primary beam width in arcsec.

  • sfpblimit – single field primary beam response. If provided then imsize is chosen such that the image edge is at normalised primary beam level equals to sfpblimit.

  • max_pixels – maximum allowed pixel count, integer. The same limit is applied along both image axes.

  • centreonly – if True, then ignore the spread of field centers.

  • vislist – list of visibility path string to be used for imaging. If not set then use all visibilities in the context.

  • spwspec – ID list of spectral windows used to create image product. List or string containing comma separated spw IDs list.

Returns

two element list of pixel count along x and y image axes.

niter_correction(niter, cell, imsize, residual_max, threshold, residual_robust_rms, mask_frac_rad=0.0)[source]

Adjustment of number of cleaning iterations due to mask size.

Uses residual_robust_rms instead threshold to compute the new niter value.

See PIPE-682 and CASR-543 and base class method for parameter description.

nsigma(iteration, hm_nsigma)[source]

See PIPE-678 and CASR-543

nterms(spwspec)[source]

Determine nterms depending on the fractional bandwidth. Returns 1 if the fractional bandwidth is < 10 per cent, 2 otherwise.

See PIPE-679 and CASR-543

pblimits(pb)[source]

PB gain level at which to cut off normalizations (tclean parameter).

See PIPE-674 and CASR-543

robust()[source]

See PIPE-680 and CASR-543

specmode()[source]

See PIPE-683 and CASR-543

threshold(iteration, threshold, hm_masking)[source]

See PIPE-678 and CASR-543

uvrange(field=None, spwspec=None)[source]

Restrict uvrange in case of very extended emission.

If the amplitude of the shortest 5 per cent of the covered baselines is more than 2 times that of the 50-55 per cent baselines, then exclude the shortest 5 per cent of the baselines.

See PIPE-681 and CASR-543.

Parameters
  • field

  • spwspec

Returns

(None or string in the form of ‘> {x}klambda’, where {x}=0.05*max(baseline), baseline ratio)

uvtaper(beam_natural=None, protect_long=None)[source]

pipeline.hif.heuristics.imageparams_vlass_quick_look module

class pipeline.hif.heuristics.imageparams_vlass_quick_look.ImageParamsHeuristicsVlassQl(vislist, spw, observing_run, imagename_prefix='', proj_params=None, contfile=None, linesfile=None, imaging_params={})[source]

Bases: pipeline.hif.heuristics.imageparams_base.ImageParamsHeuristics

buffer_radius()[source]
cell(beam=None, pixperbeam=None)[source]

Calculate cell size.

conjbeams()[source]
cyclefactor(iteration)[source]
cycleniter(iteration)[source]
datacolumn()[source]
deconvolver(specmode, spwspec)[source]
find_fields(distance='0deg', phase_center=None, matchregex='')[source]
get_autobox_params(iteration, intent, specmode, robust)[source]

Default auto-boxing parameters.

get_sensitivity(ms_do, field, intent, spw, chansel, specmode, cell, imsize, weighting, robust, uvtaper)[source]

Get sensitivity for a field / spw / chansel combination from CASA’s apparentsens method and a correction for effective channel widths in case of online smoothing.

This heuristic is currently optimized for ALMA data only.

getfieldirbox_Claire(distance='0deg', phase_center=None, matchregex='')[source]
getfieldirbox_Steve(distance='0deg', phase_center=None, matchregex='')[source]
gridder(intent, field)[source]
imsize(fields=None, cell=None, primary_beam=None, sfpblimit=None, max_pixels=None, centreonly=None, vislist=None, spwspec=None)[source]

Image size heuristics for single fields and mosaics. The pixel count along x and y image dimensions is determined by the cell size, primary beam size and the spread of phase centers in case of mosaics.

Parameters
  • fields – list of comma separated strings of field IDs per MS.

  • cell – pixel (cell) size in arcsec.

  • primary_beam – primary beam width in arcsec.

  • sfpblimit – single field primary beam response. If provided then imsize is chosen such that the image edge is at normalised primary beam level equals to sfpblimit.

  • max_pixels – maximum allowed pixel count, integer. The same limit is applied along both image axes.

  • centreonly – if True, then ignore the spread of field centers.

  • vislist – list of visibility path string to be used for imaging. If not set then use all visibilities in the context.

  • spwspec – ID list of spectral windows used to create image product. List or string containing comma separated spw IDs list. Not used in the base method.

Returns

two element list of pixel count along x and y image axes.

intent()[source]
mask(hm_masking=None, rootname=None, iteration=None, mask=None)[source]
niter()[source]
niter_correction(niter, cell, imsize, residual_max, threshold, residual_robust_rms, mask_frac_rad=0.0)[source]

Adjustment of number of cleaning iterations due to mask size.

Circular mask is assumed with a radius equal to mask_frac_rad times the longest image dimension in arcsec. If mask_frac_rad=0.0, then no new cleaning iteration step number is estimate and the input niter value is returned.

Note that the method assumes synthesized_beam = 5 * cell. This might lead to underestimated new niter value if the beam is sampled by less than 5 pixels (e.g. when hif_checkproductsize() task was called earlier.

Parameters
  • niter – User or heuristics set number of cleaning iterations

  • cell – Image cell size in arcsec

  • imsize – Two element list or array of image pixel count along x and y axis

  • residual_max – Dirty image residual maximum [Jy].

  • threshold – Cleaning threshold value [Jy].

  • residual_robust_rms – Residual scaled MAD [Jy] (not used in base method).

  • mask_frac_rad – Mask radius is given by mask_frac_rad * max(imsize) * cell [arcsec]

Returns

Modified niter value based on mask and beam size heuristic.

nsigma(iteration, hm_nsigma)[source]
nterms(spwspec)[source]
pb_correction()[source]
reffreq()[source]
robust()[source]

Default robust value.

rotatepastep()[source]
savemodel(iteration)[source]
scales()[source]
specmode()[source]
stokes()[source]
threshold(iteration, threshold, hm_masking)[source]
uvrange(field=None, spwspec=None)[source]
uvtaper(beam_natural=None, protect_long=None)[source]
wprojplanes()[source]

pipeline.hif.heuristics.imageparams_vlass_single_epoch_continuum module

class pipeline.hif.heuristics.imageparams_vlass_single_epoch_continuum.ImageParamsHeuristicsVlassSeCont(vislist, spw, observing_run, imagename_prefix='', proj_params=None, contfile=None, linesfile=None, imaging_params={})[source]

Bases: pipeline.hif.heuristics.imageparams_base.ImageParamsHeuristics

buffer_radius()[source]
cell(beam=None, pixperbeam=None)[source]

Calculate cell size.

conjbeams()[source]
cyclefactor(iteration)[source]
cycleniter(iteration)[source]
datacolumn()[source]
deconvolver(specmode, spwspec)[source]
find_fields(distance='0deg', phase_center=None, matchregex='')[source]
get_autobox_params(iteration, intent, specmode, robust)[source]

Default auto-boxing parameters.

get_sensitivity(ms_do, field, intent, spw, chansel, specmode, cell, imsize, weighting, robust, uvtaper)[source]

Get sensitivity for a field / spw / chansel combination from CASA’s apparentsens method and a correction for effective channel widths in case of online smoothing.

This heuristic is currently optimized for ALMA data only.

gridder(intent, field)[source]
imsize(fields=None, cell=None, primary_beam=None, sfpblimit=None, max_pixels=None, centreonly=None, vislist=None, spwspec=None)[source]

Image size heuristics for single fields and mosaics. The pixel count along x and y image dimensions is determined by the cell size, primary beam size and the spread of phase centers in case of mosaics.

Parameters
  • fields – list of comma separated strings of field IDs per MS.

  • cell – pixel (cell) size in arcsec.

  • primary_beam – primary beam width in arcsec.

  • sfpblimit – single field primary beam response. If provided then imsize is chosen such that the image edge is at normalised primary beam level equals to sfpblimit.

  • max_pixels – maximum allowed pixel count, integer. The same limit is applied along both image axes.

  • centreonly – if True, then ignore the spread of field centers.

  • vislist – list of visibility path string to be used for imaging. If not set then use all visibilities in the context.

  • spwspec – ID list of spectral windows used to create image product. List or string containing comma separated spw IDs list. Not used in the base method.

Returns

two element list of pixel count along x and y image axes.

intent()[source]
keep_iterating(iteration, hm_masking, tclean_stopcode, dirty_dynamic_range, residual_max, residual_robust_rms, field, intent, spw, specmode)[source]

Determine if another tclean iteration is necessary.

mask()[source]
niter()[source]
niter_correction(niter, cell, imsize, residual_max, threshold, residual_robust_rms, mask_frac_rad=0.0)[source]

Adjustment of number of cleaning iterations due to mask size.

Circular mask is assumed with a radius equal to mask_frac_rad times the longest image dimension in arcsec. If mask_frac_rad=0.0, then no new cleaning iteration step number is estimate and the input niter value is returned.

Note that the method assumes synthesized_beam = 5 * cell. This might lead to underestimated new niter value if the beam is sampled by less than 5 pixels (e.g. when hif_checkproductsize() task was called earlier.

Parameters
  • niter – User or heuristics set number of cleaning iterations

  • cell – Image cell size in arcsec

  • imsize – Two element list or array of image pixel count along x and y axis

  • residual_max – Dirty image residual maximum [Jy].

  • threshold – Cleaning threshold value [Jy].

  • residual_robust_rms – Residual scaled MAD [Jy] (not used in base method).

  • mask_frac_rad – Mask radius is given by mask_frac_rad * max(imsize) * cell [arcsec]

Returns

Modified niter value based on mask and beam size heuristic.

nsigma(iteration, hm_nsigma)[source]
nterms(spwspec)[source]
pb_correction()[source]
reffreq()[source]
robust()[source]

Default robust value.

rotatepastep()[source]
savemodel(iteration)[source]
scales()[source]
specmode()[source]
stokes()[source]
threshold(iteration, threshold, hm_masking)[source]
usepointing()[source]

clean flag to use pointing table.

uvrange(field=None, spwspec=None)[source]
uvtaper(beam_natural=None, protect_long=None)[source]
wprojplanes()[source]

pipeline.hif.heuristics.imageparams_vlass_single_epoch_cube module

class pipeline.hif.heuristics.imageparams_vlass_single_epoch_cube.ImageParamsHeuristicsVlassSeCube(vislist, spw, observing_run, imagename_prefix='', proj_params=None, contfile=None, linesfile=None, imaging_params={})[source]

Bases: pipeline.hif.heuristics.imageparams_base.ImageParamsHeuristics

buffer_radius()[source]
cell(beam=None, pixperbeam=None)[source]

Calculate cell size.

conjbeams()[source]
cyclefactor(iteration)[source]
cycleniter(iteration)[source]
deconvolver(specmode, spwspec)[source]
find_fields(distance='0deg', phase_center=None, matchregex='')[source]
get_sensitivity(ms_do, field, intent, spw, chansel, specmode, cell, imsize, weighting, robust, uvtaper)[source]

Get sensitivity for a field / spw / chansel combination from CASA’s apparentsens method and a correction for effective channel widths in case of online smoothing.

This heuristic is currently optimized for ALMA data only.

gridder(intent, field)[source]
imsize(fields=None, cell=None, primary_beam=None, sfpblimit=None, max_pixels=None, centreonly=None, vislist=None, spwspec=None)[source]

Image size heuristics for single fields and mosaics. The pixel count along x and y image dimensions is determined by the cell size, primary beam size and the spread of phase centers in case of mosaics.

Parameters
  • fields – list of comma separated strings of field IDs per MS.

  • cell – pixel (cell) size in arcsec.

  • primary_beam – primary beam width in arcsec.

  • sfpblimit – single field primary beam response. If provided then imsize is chosen such that the image edge is at normalised primary beam level equals to sfpblimit.

  • max_pixels – maximum allowed pixel count, integer. The same limit is applied along both image axes.

  • centreonly – if True, then ignore the spread of field centers.

  • vislist – list of visibility path string to be used for imaging. If not set then use all visibilities in the context.

  • spwspec – ID list of spectral windows used to create image product. List or string containing comma separated spw IDs list. Not used in the base method.

Returns

two element list of pixel count along x and y image axes.

intent()[source]
keep_iterating(iteration, hm_masking, tclean_stopcode, dirty_dynamic_range, residual_max, residual_robust_rms, field, intent, spw, specmode)[source]

Determine if another tclean iteration is necessary.

mask(hm_masking=None, rootname=None, iteration=None, mask=None)[source]
niter()[source]
niter_correction(niter, cell, imsize, residual_max, threshold, residual_robust_rms, mask_frac_rad=0.0)[source]

Adjustment of number of cleaning iterations due to mask size.

Circular mask is assumed with a radius equal to mask_frac_rad times the longest image dimension in arcsec. If mask_frac_rad=0.0, then no new cleaning iteration step number is estimate and the input niter value is returned.

Note that the method assumes synthesized_beam = 5 * cell. This might lead to underestimated new niter value if the beam is sampled by less than 5 pixels (e.g. when hif_checkproductsize() task was called earlier.

Parameters
  • niter – User or heuristics set number of cleaning iterations

  • cell – Image cell size in arcsec

  • imsize – Two element list or array of image pixel count along x and y axis

  • residual_max – Dirty image residual maximum [Jy].

  • threshold – Cleaning threshold value [Jy].

  • residual_robust_rms – Residual scaled MAD [Jy] (not used in base method).

  • mask_frac_rad – Mask radius is given by mask_frac_rad * max(imsize) * cell [arcsec]

Returns

Modified niter value based on mask and beam size heuristic.

nsigma(iteration, hm_nsigma)[source]
nterms(spwspec)[source]
pb_correction()[source]
reffreq()[source]
robust()[source]

Default robust value.

savemodel(iteration)[source]
scales()[source]
specmode()[source]
stokes()[source]
threshold(iteration, threshold, hm_masking)[source]
usepointing()[source]

clean flag to use pointing table.

uvrange(field=None, spwspec=None)[source]
uvtaper(beam_natural=None, protect_long=None)[source]
wprojplanes()[source]

pipeline.hif.heuristics.imageparams_vlass_single_epoch_taper module

class pipeline.hif.heuristics.imageparams_vlass_single_epoch_taper.ImageParamsHeuristicsVlassSeTaper(vislist, spw, observing_run, imagename_prefix='', proj_params=None, contfile=None, linesfile=None, imaging_params={})[source]

Bases: pipeline.hif.heuristics.imageparams_base.ImageParamsHeuristics

buffer_radius()[source]
cell(beam=None, pixperbeam=None)[source]

Calculate cell size.

conjbeams()[source]
cyclefactor(iteration)[source]
cycleniter(iteration)[source]
deconvolver(specmode, spwspec)[source]
find_fields(distance='0deg', phase_center=None, matchregex='')[source]
get_sensitivity(ms_do, field, intent, spw, chansel, specmode, cell, imsize, weighting, robust, uvtaper)[source]

Get sensitivity for a field / spw / chansel combination from CASA’s apparentsens method and a correction for effective channel widths in case of online smoothing.

This heuristic is currently optimized for ALMA data only.

gridder(intent, field)[source]
imsize(fields=None, cell=None, primary_beam=None, sfpblimit=None, max_pixels=None, centreonly=None, vislist=None, spwspec=None)[source]

Image size heuristics for single fields and mosaics. The pixel count along x and y image dimensions is determined by the cell size, primary beam size and the spread of phase centers in case of mosaics.

Parameters
  • fields – list of comma separated strings of field IDs per MS.

  • cell – pixel (cell) size in arcsec.

  • primary_beam – primary beam width in arcsec.

  • sfpblimit – single field primary beam response. If provided then imsize is chosen such that the image edge is at normalised primary beam level equals to sfpblimit.

  • max_pixels – maximum allowed pixel count, integer. The same limit is applied along both image axes.

  • centreonly – if True, then ignore the spread of field centers.

  • vislist – list of visibility path string to be used for imaging. If not set then use all visibilities in the context.

  • spwspec – ID list of spectral windows used to create image product. List or string containing comma separated spw IDs list. Not used in the base method.

Returns

two element list of pixel count along x and y image axes.

intent()[source]
keep_iterating(iteration, hm_masking, tclean_stopcode, dirty_dynamic_range, residual_max, residual_robust_rms, field, intent, spw, specmode)[source]

Determine if another tclean iteration is necessary.

mask(hm_masking=None, rootname=None, iteration=None, mask=None)[source]
niter()[source]
niter_correction(niter, cell, imsize, residual_max, threshold, residual_robust_rms, mask_frac_rad=0.0)[source]

Adjustment of number of cleaning iterations due to mask size.

Circular mask is assumed with a radius equal to mask_frac_rad times the longest image dimension in arcsec. If mask_frac_rad=0.0, then no new cleaning iteration step number is estimate and the input niter value is returned.

Note that the method assumes synthesized_beam = 5 * cell. This might lead to underestimated new niter value if the beam is sampled by less than 5 pixels (e.g. when hif_checkproductsize() task was called earlier.

Parameters
  • niter – User or heuristics set number of cleaning iterations

  • cell – Image cell size in arcsec

  • imsize – Two element list or array of image pixel count along x and y axis

  • residual_max – Dirty image residual maximum [Jy].

  • threshold – Cleaning threshold value [Jy].

  • residual_robust_rms – Residual scaled MAD [Jy] (not used in base method).

  • mask_frac_rad – Mask radius is given by mask_frac_rad * max(imsize) * cell [arcsec]

Returns

Modified niter value based on mask and beam size heuristic.

nsigma(iteration, hm_nsigma)[source]
nterms(spwspec)[source]
pb_correction()[source]
reffreq()[source]
robust()[source]

Default robust value.

savemodel(iteration)[source]
scales()[source]
specmode()[source]
stokes()[source]
threshold(iteration, threshold, hm_masking)[source]
uvrange(field=None, spwspec=None)[source]
uvtaper(beam_natural=None, protect_long=None)[source]

pipeline.hif.heuristics.mosaicoverlap module

pipeline.hif.heuristics.mosaicoverlap.angularSeparation(ra0, dec0, ra1, dec1, returnComponents=False)[source]

Computes the great circle angle between two celestial coordinates. using the Vincenty formula from wikipedia which is correct for all angles, as long as atan2() is used to handle a zero denominator.

ras and decs must be given in degrees. The output is returned in degrees.

This routine also works for the az, el coordinate system.

Component separations are field_0 minus field_1. See also angularSeparationRadians() returnComponents: if True, then also compute angular separation in both

coordinates and the position angle of the separation vector on the sky

pipeline.hif.heuristics.mosaicoverlap.angularSeparationOfDirections(dir1, dir2, returnComponents=False)[source]

Accepts two direction dictionaries and returns the separation in radians. It computes great circle angle using the Vincenty formula.

pipeline.hif.heuristics.mosaicoverlap.angularSeparationRadians(ra0, dec0, ra1, dec1, returnComponents=False)[source]

Computes the great circle angle between two celestial coordinates. using the Vincenty formula from wikipedia which is correct for all angles, as long as you use atan2() to handle a zero denominator.

Input and output are in radians. This routine also works for the az, el coordinate system.

returnComponents=True will return: [separation, raSeparation,

decSeparation, raSeparationCosDec]

pipeline.hif.heuristics.mosaicoverlap.baarsTaperFactor(taper_dB, use2007formula=True)[source]

Converts a taper in dB to the constant X in the formula FWHM=X*lambda/D for the parabolic illumination pattern. We assume that taper_dB comes in as a positive value. use2007formula: False –> use Equation 18 from ALMA Memo 456.

True –> use Equation 4.13 from Baars 2007 book

Inputs

taper: The taper in DB

use2007formula: If True use Baars formula

pipeline.hif.heuristics.mosaicoverlap.centralObstructionFactor(diameter, obscuration=0.75)[source]

Computes the scale factor of an Airy pattern as a function of the central obscuration, using Table 10.1 of Schroeder’s “Astronomical Optics”.

Inputs

diameter: The outer dish diameter in meters

obscuration: The diameter of the central obscuration in meters

pipeline.hif.heuristics.mosaicoverlap.effectiveTaper(fwhmFactor, diameter, obscuration=0.75, use2007formula=True)[source]

The inverse of Baars formula multiplied by the central obstruction factor. Converts an observed value of the constant X in the formula FWHM = X * lambda / D into a taper in dB which must be a positive value.

if use2007formula == False, use Equation 18 from ALMA Memo 456 if use2007formula == True, use Equation 4.13 from Baars 2007 book

Inputs
fwhmfactor: The fwhm factor, if given ignore the taper

diameter: The outer dish diameter in meters

obscuration: The diameter of the central obscuration in meters

use2007formula: If True use Baars formula

pipeline.hif.heuristics.mosaicoverlap.gaussianBeamResponse(radius, frequency, diameter, taper=10.0, obscuration=0.75, fwhmfactor=None, use2007formula=True)[source]

Computes the gain at the specified radial offset from the center of a Gaussian beam.

Inputs:

radius: The radius in arcseconds

frequency: The frequency in Hz
diameter: The outer diameter of the dish in m

taper: The taper in DB

obscuration: Diameter of the central obscuration in meters

fwhmfactor: The fwhm factor, if given ignore the taper

use2007formula: If True use Baars formula

pipeline.hif.heuristics.mosaicoverlap.mosaicOverlapFactorMS(ms, source, spw, diameter, intent='TARGET', fwhmfactor=1.13, taper=10.0, obscuration=0.75)[source]

This routine computes the maximum sensitivity increase factor for a mosaic. It handles an arbitrary mosaic pattern. It does not account for flagging or different observing depths at different pointings. Defaulted parameters take values appropriate for ALMA. The use2007formula parameter in the primaryBeamArsec and gaussianBeamResponse methods default to True. This parameter could be pulled up to the interface of this routine if required.

Inputs:

ms: The ms object from the pipeline context

source: The target source id or name

spw: Determine the frequency based on this spw or list of spws.

diameter: The effective antenna diameter in meters

intent: The target source intent

fwhmfactor: Factor passed to gaussianBeamResponse and primaryBeamArcsec

taper: The taper in DB which is used if fwhmfactor = None

obscuration: The diameter of the central obscuration in meters

Returns:

A single floating point value for the maximum sensitivity increase factor, which is typically for the center of the mosaic but not necessarily so. It is meant to be applied to a theoretical rms computed based on the total time spent on only one of the pointings of the mosaic.

pipeline.hif.heuristics.mosaicoverlap.mosaicOverlapFactorVIS(vis, source, spw, diameter, fwhmfactor=1.13, taper=10.0, obscuration=0.75, intent='OBSERVE_TARGET#ON_SOURCE')[source]

This routine computes the maximum sensitivity increase factor for an ALMA mosaic. It handles an arbitrary mosaic pattern. It does not account for flagging or different observing depths at different pointings.

Inputs:

vis: The name of the measurement set

source: The source id or name
spw: determine the frequency based on this spw or list of spws.

Defaults to all with the specified intent.

diameter: The effective outer antenna diameter in meters

fwhmfactor: Factor passed to gaussianBeamResponse and primaryBeamArcsec

taper: The taper in DB

obscuration: The diameter of the central obscuration in meters

intent: The CASA data selection intent

Returns:

A single floating point value for the maximum sensitivity increase factor, which is typically the center of the mosaic but not necessarily so. It is meant to be applied to a theoretical rms computed based on the total time spent on only one of the pointings of the mosaic.

pipeline.hif.heuristics.mosaicoverlap.primaryBeamArcsec(frequency, diameter, taper=10.0, obscuration=0.75, fwhmfactor=None, use2007formula=True)[source]
Implements the Baars formula: b * lambda / D.

if use2007formula==False, use the formula from ALMA Memo 456 if use2007formula==True, use the formula from Baars 2007 book

In either case, the taper value is expected to be entered as positive. Note: if a negative value is entered, it is converted to positive.

The effect of the central obstruction on the pattern is also accounted for by using a spline fit to Table 10.1 of Schroeder’s Astronomical Optics.

The default values correspond to our best knowledge of the ALMA 12m antennas.

Inputs
frequency: The frequency in Hz
diameter: The outer diameter of the dish in meters

taper: The taper in DB

obscuration: The diameter of the central obscuration in meters

fwhmfactor: The fwhm factor, if given ignore the taper

use2007formula: If True use Baars formula

pipeline.hif.heuristics.solint module

class pipeline.hif.heuristics.solint.PhaseUpSolInt[source]

Bases: pipeline.infrastructure.api.Heuristic

PhaseUpSolInt is a heuristic to calculate which phase-up solution intervals should be used to evaluate the phase-up bandpass.

calculate(int_time)[source]

Get the range of phase-up solution intervals.

Parameters

int_time (an integer or float) – the integration time for the bandpass observation under consideration

Return type

a list of solution intervals that be given to gaincal

pipeline.hif.heuristics.standard module

class pipeline.hif.heuristics.standard.Standard[source]

Bases: pipeline.infrastructure.api.Heuristic

calculate(field)[source]

Make a calculation based on the given parameters.

This is an abstract method and must be implemented by all Heuristic subclasses.

Note

The signature and return types of calculate() are intended to be implementation specific. Refer to the documentation of the implementing class for the appropriate signature.

ephemeris_fields = {'Callisto', 'Ceres', 'Davida', 'Europa', 'Ganymede', 'Io', 'Juno', 'Jupiter', 'Mars', 'Neptune', 'Pallas', 'Pluto', 'Titan', 'Triton', 'Uranus', 'Venus', 'Vesta', 'Victoria'}

Module contents