MakeDirectWarpTask

class lsst.pipe.tasks.make_direct_warp.MakeDirectWarpTask(**kwargs)

Bases: PipelineTask

Warp single-detector images onto a common projection.

This task iterates over multiple images (corresponding to different detectors) from a single visit that overlap the target patch. Pixels that receive no input from any detector are set to NaN in the output image, and NO_DATA bit is set in the mask plane.

This differs from the standard MakeWarp Task in the following ways:

  1. No selection on ccds at the time of warping. This is done later during the coaddition stage.

  2. Interpolate over a set of masked pixels before warping.

  3. Generate an image where each pixel denotes how much of the pixel is masked.

  4. Generate multiple noise warps with the same interpolation applied.

  5. No option to produce a PSF-matched warp.

Attributes Summary

canMultiprocess

Methods Summary

compute_median_variance(mi)

Compute the median variance across the good pixels of a MaskedImage.

emptyMetadata()

Empty (clear) the metadata for this Task and all sub-Tasks.

getFullMetadata()

Get metadata for all tasks.

getFullName()

Get the task name as a hierarchical name including parent task names.

getName()

Get the name of the task.

getTaskDict()

Get a dictionary of all tasks as a shallow copy.

get_seed_from_data_id(data_id)

Get a seed value given a data_id.

makeField(doc)

Make a lsst.pex.config.ConfigurableField for this task.

makeSubtask(name, **keyArgs)

Create a subtask as a new instance as the name attribute of this task.

make_noise_exposures(calexp, rng)

Make pure noise realizations based on calexp.

process(exposure, target_wcs, warper[, ...])

Process an exposure.

run(inputs, sky_info, **kwargs)

Create a Warp dataset from inputs.

runQuantum(butlerQC, inputRefs, outputRefs)

Do butler IO and transform to provide in memory objects for tasks run method.

timer(name[, logLevel])

Context manager to log performance data for an arbitrary block of code.

Attributes Documentation

canMultiprocess: ClassVar[bool] = True

Methods Documentation

static compute_median_variance(mi: MaskedImage) float

Compute the median variance across the good pixels of a MaskedImage.

Parameters:
miMaskedImage

The input image on which to compute the median variance.

Returns:
median_variancefloat

Median variance of the input calexp.

emptyMetadata() None

Empty (clear) the metadata for this Task and all sub-Tasks.

getFullMetadata() TaskMetadata

Get metadata for all tasks.

Returns:
metadataTaskMetadata

The keys are the full task name. Values are metadata for the top-level task and all subtasks, sub-subtasks, etc.

Notes

The returned metadata includes timing information (if @timer.timeMethod is used) and any metadata set by the task. The name of each item consists of the full task name with . replaced by :, followed by . and the name of the item, e.g.:

topLevelTaskName:subtaskName:subsubtaskName.itemName

using : in the full task name disambiguates the rare situation that a task has a subtask and a metadata item with the same name.

getFullName() str

Get the task name as a hierarchical name including parent task names.

Returns:
fullNamestr

The full name consists of the name of the parent task and each subtask separated by periods. For example:

  • The full name of top-level task “top” is simply “top”.

  • The full name of subtask “sub” of top-level task “top” is “top.sub”.

  • The full name of subtask “sub2” of subtask “sub” of top-level task “top” is “top.sub.sub2”.

getName() str

Get the name of the task.

Returns:
taskNamestr

Name of the task.

See also

getFullName

Get the full name of the task.

getTaskDict() dict[str, weakref.ReferenceType[lsst.pipe.base.task.Task]]

Get a dictionary of all tasks as a shallow copy.

Returns:
taskDictdict

Dictionary containing full task name: task object for the top-level task and all subtasks, sub-subtasks, etc.

get_seed_from_data_id(data_id) int

Get a seed value given a data_id.

This method generates a unique, reproducible pseudo-random number for a data id. This is not affected by ordering of the input, or what set of visits, ccds etc. are given.

This is implemented as a public method, so that simulations that don’t necessary deal with the middleware can mock up a data_id instance, or override this method with a different one to obtain a seed value consistent with the pipeline task.

Parameters:
data_idDataCoordinate

Data identifier dictionary.

Returns:
seedint

A unique seed for this data_id to seed a random number generator.

classmethod makeField(doc: str) ConfigurableField

Make a lsst.pex.config.ConfigurableField for this task.

Parameters:
docstr

Help text for the field.

Returns:
configurableFieldlsst.pex.config.ConfigurableField

A ConfigurableField for this task.

Examples

Provides a convenient way to specify this task is a subtask of another task.

Here is an example of use:

class OtherTaskConfig(lsst.pex.config.Config):
    aSubtask = ATaskClass.makeField("brief description of task")
makeSubtask(name: str, **keyArgs: Any) None

Create a subtask as a new instance as the name attribute of this task.

Parameters:
namestr

Brief name of the subtask.

**keyArgs

Extra keyword arguments used to construct the task. The following arguments are automatically provided and cannot be overridden:

  • config.

  • parentTask.

Notes

The subtask must be defined by Task.config.name, an instance of ConfigurableField or RegistryField.

make_noise_exposures(calexp: ExposureF, rng) dict[int, lsst.afw.image._exposure.ExposureF]

Make pure noise realizations based on calexp.

Parameters:
calexpExposureF

The input exposure on which to base the noise realizations.

rngnp.random.RandomState

Random number generator to use for the noise realizations.

Returns:
noise_calexpsdict [int, ExposureF]

A mapping of integers ranging from 0 up to config.numberOfNoiseRealizations to the corresponding noise realization exposures.

process(exposure, target_wcs, warper, old_background=None, new_background=None, visit_summary=None, maxBBox=None, destBBox=None)

Process an exposure.

There are three processing steps that are applied to the input:

  1. Interpolate over bad pixels before warping.

  2. Apply all calibrations from visit_summary to the exposure.

  3. Warp the exposure to the target coordinate system.

Parameters:
exposureExposure

The input exposure to be processed.

target_wcsSkyWcs

The WCS of the target patch.

warperWarper

The warper to use for warping the input exposure.

old_backgroundBackground | None

The old background to be added back into the calexp.

new_backgroundBackground | None

The new background to be subtracted from the calexp.

visit_summaryExposureCatalog | None

Table of visit summary information. If not None, the visit_summary information will be used to update the calibration of the input exposures. Otherwise, the input exposures will be used as-is.

maxBBoxBox2I | None

Maximum bounding box of the warped exposure. If None, this is determined automatically.

destBBoxBox2I | None

Exact bounding box of the warped exposure. If None, this is determined automatically.

Returns:
warped_exposureExposure

The processed and warped exposure.

run(inputs, sky_info, **kwargs)

Create a Warp dataset from inputs.

Parameters:
inputsMapping

Dictionary of input datasets. It must have a list of input calexps under the key “calexp_list”. Other supported keys are “background_revert_list” and “background_apply_list”, corresponding to the old and the new backgrounds to be reverted and applied to the calexps. They must be in the same order as the calexps.

sky_infoStruct

A Struct object containing wcs, bounding box, and other information about the patches within the tract.

visit_summaryExposureCatalog | None

Table of visit summary information. If provided, the visit summary information will be used to update the calibration of the input exposures. If None, the input exposures will be used as-is.

Returns:
resultsStruct

A Struct object containing the warped exposure, noise exposure(s), and masked fraction image.

runQuantum(butlerQC, inputRefs, outputRefs)

Do butler IO and transform to provide in memory objects for tasks run method.

Parameters:
butlerQCQuantumContext

A butler which is specialized to operate in the context of a lsst.daf.butler.Quantum.

inputRefsInputQuantizedConnection

Datastructure whose attribute names are the names that identify connections defined in corresponding PipelineTaskConnections class. The values of these attributes are the lsst.daf.butler.DatasetRef objects associated with the defined input/prerequisite connections.

outputRefsOutputQuantizedConnection

Datastructure whose attribute names are the names that identify connections defined in corresponding PipelineTaskConnections class. The values of these attributes are the lsst.daf.butler.DatasetRef objects associated with the defined output connections.

timer(name: str, logLevel: int = 10) Iterator[None]

Context manager to log performance data for an arbitrary block of code.

Parameters:
namestr

Name of code being timed; data will be logged using item name: Start and End.

logLevelint

A logging level constant.

See also

lsst.utils.timer.logInfo

Implementation function.

Examples

Creating a timer context:

with self.timer("someCodeToTime"):
    pass  # code to time