pclean API

pclean — Parallel CLEAN imaging with Dask and CASA tools.

Provides a pclean() function with a tclean-compatible interface and transparent Dask-based parallelism for cube (channel) and continuum (visibility-row) imaging.

pclean.pclean(config=None, vis='', selectdata=True, field='', spw='', timerange='', uvrange='', antenna='', scan='', observation='', intent='', datacolumn='corrected', imagename='', imsize=[100], cell='1arcsec', phasecenter='', stokes='I', projection='SIN', startmodel='', specmode='mfs', reffreq='', nchan=-1, start='', width='', outframe='LSRK', veltype='radio', restfreq=[], interpolation='linear', perchanweightdensity=True, gridder='standard', facets=1, wprojplanes=1, vptable='', mosweight=True, aterm=True, psterm=False, wbawp=True, conjbeams=False, cfcache='', usepointing=False, computepastep=360.0, rotatepastep=360.0, pointingoffsetsigdev=[], pblimit=0.2, normtype='flatnoise', psfphasecenter='', deconvolver='hogbom', scales=[], nterms=2, smallscalebias=0.0, fusedthreshold=0.0, largestscale=-1, restoration=True, restoringbeam=[], pbcor=False, outlierfile='', weighting='natural', robust=0.5, noise='1.0Jy', npixels=0, uvtaper=[], niter=0, gain=0.1, threshold='0.0mJy', nsigma=0.0, cycleniter=-1, cyclefactor=1.0, minpsffraction=0.05, maxpsffraction=0.8, interactive=False, nmajor=-1, fullsummary=False, usemask='user', mask='', pbmask=0.0, sidelobethreshold=3.0, noisethreshold=5.0, lownoisethreshold=1.5, negativethreshold=0.0, smoothfactor=1.0, minbeamfrac=0.3, cutthreshold=0.01, growiterations=100, dogrowprune=True, minpercentchange=0.0, verbose=False, fastnoise=True, python_automask=True, restart=True, savemodel='none', calcres=True, calcpsf=True, psfcutoff=0.35, parallel=False, nworkers=None, scheduler_address=None, threads_per_worker=1, memory_limit='0', local_directory=None, cube_chunksize=-1, keep_subcubes=False, keep_partimages=False, concat_mode='auto', cluster_type='local', slurm_queue=None, slurm_account=None, slurm_walltime='24:00:00', slurm_job_mem='20GB', slurm_cores_per_job=1, slurm_job_name=None, slurm_job_extra_directives=None, slurm_python=None, slurm_local_directory=None, slurm_log_directory='logs', slurm_job_script_prologue=None)

Parallel CLEAN imaging – tclean-compatible interface.

Parameters are identical to CASA tclean with the following additions:

  • parallel – enable Dask-distributed parallelism.

  • nworkers – number of Dask workers (default: CPU count).

  • scheduler_address – connect to an existing Dask scheduler.

  • threads_per_worker – threads per Dask worker (default 1).

  • memory_limit – per-worker memory cap ('0' disables; see docs/memory_management.md).

  • local_directory – Dask scratch directory.

  • cube_chunksize – channels per sub-cube task for cube parallelism. -1 (default) sets nparts = nworkers; 1 creates one task per channel (maximum load balancing); N groups N channels per task.

  • keep_subcubes – if True, preserve intermediate sub-cube images and per-worker temp directories after concatenation. Useful for debugging or downstream per-channel analysis. Default False removes them to save disk space.

  • keep_partimages – if True, preserve partial images produced by each worker during continuum (MFS) imaging. Default False removes them after gathering.

  • concat_mode – concatenation strategy for cube imaging. 'auto' (default) picks a virtual concatenation strategy when keep_subcubes=True, 'paged' otherwise. 'paged' always does a full pixel copy. 'virtual' creates a reference catalog (subcubes must stay). 'movevirtual' renames subcubes into the output (near-instant).

  • config – a PcleanConfig instance, a path to a YAML config file, or None. When provided, the hierarchical config is used as the base and any explicit keyword arguments override it.

Returns:

Imaging summary (convergence, major-cycle count, image names).

Parameters:
Return type:

dict

class pclean.CustomFormatter(fmt=None, datefmt=None, style='%')[source]

Bases: Formatter

Custom logging formatter that defaults to CASA-style output and UTC time.

Format: YYYY-MM-DD HH:MM:SS LEVEL LoggerName Message

Parameters:
  • fmt (str | None)

  • datefmt (str | None)

  • style (Literal['%', '{', '$'])

converter()
gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,

tm_sec, tm_wday, tm_yday, tm_isdst)

Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a. GMT). When ‘seconds’ is not passed in, convert the current time instead.

If the platform supports the tm_gmtoff and tm_zone, they are available as attributes only.