105.1. Introduction to the Science Pipelines#
105.1. Introduction to the Science Pipelines¶
For the Rubin Science Platform at data.lsst.cloud.
Data Release: Data Preview 2
Container Size: Large
LSST Science Pipelines version: r30.0.11
Last verified to run: 2026-11-15
Repository: github.com/lsst/tutorial-notebooks
DOI: 10.11578/rubin/dc.20250909.20
Learning objective: How to use the LSST Science Pipelines
LSST data products: None (pipeline definitions only)
Packages: lsst.pipe.base, lsst.drp.tasks
Credit: Originally developed by the Rubin Community Science team. Please consider acknowledging them if this notebook is used for the preparation of journal articles, software releases, or other notebooks.
Get Support: Everyone is encouraged to ask questions or raise issues in the Support Category of the Rubin Community Forum. Rubin staff will respond to all questions posted there.
1. Introduction¶
An overview of the LSST Science Pipelines software is provided in Rubin Observatory Science Pipelines Developers et al. (2026).
In the LSST software stack, the concepts of Task and PipelineTask are both important for organizing and executing data processing, but they serve different purposes.
Task:
A Task is a fundamental unit of work in the LSST software stack. It is designed to perform a specific operation or set of operations on data. Tasks can be standalone and are typically used for operations that do not require a complex workflow or multiple steps.
Tasks can be executed independently and can be composed together to form more complex workflows.
PipelineTask:
A PipelineTask is a specialized type of Task that is designed to be part of a larger data processing pipeline. It is intended to handle a sequence of operations that are executed in a specific order, often with dependencies between the steps.
PipelineTask provides additional functionality for managing the flow of data through the pipeline, including handling input and output data, managing dependencies, and coordinating the execution of multiple tasks in a defined sequence.
It is particularly useful for processing large datasets where multiple steps need to be executed in a specific order, such as in the case of image processing pipelines that involve calibration, stacking, and analysis.
1.1. Import packages¶
From the LSST Science Pipelines, import modules for pipeline definition (lsst.pipe.base) and an example PipelineTask (lsst.drp.tasks.make_direct_warp.MakeDirectWarpTask). In addition, import the os and Ipython.display modules that provide useful utilities.
from lsst.pipe.base import Pipeline
from lsst.drp.tasks.make_direct_warp import MakeDirectWarpTask
import os
from IPython.display import Image
2. Learn about tasks/modules¶
This notebook explores how to use the LSST Science Pipelines by examining coaddition plus source detection as an example type of processing enabled by these pipelines. MakeDirectWarpTask is an example of a PipelineTask used as part of coaddition within the LSST Science Pipelines. MakeDirectWarpTask "warps" (resamples) input exposures such that the input exposures' pixel data are placed on the same astrometric footprint as the coadd that will be generated.
Find information about a PipelineTask by inspecting its docstring.
?MakeDirectWarpTask
3. View and modify task configurations¶
Each Task generally has a variety of configuration parameters with default values that can be customized. Start by retrieving a configuration object (ConfigClass instance) for the MakeDirectWarpTask.
config = MakeDirectWarpTask.ConfigClass()
For the sake of exploring the MakeDirectWarpTask configuration parameters, obtain a dictionary of these configuration parameters and check how many parameters there are total.
config_dict = config.toDict()
print('total number of config parameters = ', len(config_dict.keys()))
total number of config parameters = 23
Print out a few key/value pairs, where each such pair has the name of one configuration parameter for MakeDirectWarpTask and the associated parameter value.
n_params_to_print = 10
for i, k in enumerate(config_dict.keys()):
if i < n_params_to_print:
print(k, ':', config_dict[k])
saveLogOutput : True numberOfNoiseRealizations : 0 seedOffset : 0 useMedianVariance : True doRevertOldBackground : False doApplyNewBackground : False doApplyFlatBackgroundRatio : False useVisitSummaryPsf : True useVisitSummaryWcs : True useVisitSummaryPhotoCalib : True
The DP2 dataset available to users will not contain all intermediate data products that could potentially be used during coaddition. Once the DP2 visit images become available, DP2 users will be able to run coaddition by modifying the configuration parameters of tasks involved in coaddition. Modify the MakeDirectWarpTask configuration by applying an override to the connections.calexp_list config parameter. This connection specifies the dataset type of the input images to be warped. DP2 Data Release Production used preliminary_visit_image for this input, but that intermediate product will not be part of the DP2 release, so the override points the task to the calibrated visit_image products instead. This is an example of applying configuration overrides to PipelineTasks. Other applications of configuration overrides include changing the threshold for source detection or changing the point-spread-function (PSF) modeling algorithm during image characterization.
config.connections.calexp_list = 'visit_image'
Also, for the sake of illustration, modify the MakeDirectWarpTask configuration so that it includes 1 noise realization rather than the default of 0 noise realizations. 1 noise realization is the default numberOfNoiseRealizations for MakeDirectWarpTask within the Data Release Production pipeline that produced DP2, though the default of MakeDirectWarpTask itself (independent of any pipeline) is numberOfNoiseRealizations = 0.
config.numberOfNoiseRealizations = 1
4. Defining a pipeline¶
In order to perform a multi-step data processing, PipelineTasks are combined together to form a pipeline. The LSST Science Pipelines use a yaml configuration file to specify a pipeline composed of PipelineTasks.
For more information, review the relevant documentation about creating a pipeline.
4.1. The "yaml" file¶
yaml is a human-readable data-serialization language. It is commonly used for configuration files and in applications where data are being stored or transmitted.
All the tasks that generated the DP2 data release products are listed in the DP2 Data Release Production (DRP) pipeline definition yaml.
To see this full list of tasks, first open a new terminal (click the + button at upper left and then select terminal).
Then create a Rubin Observatory environment, and render the pipeline yaml content via the pipetask build command:
setup lsst_distrib
pipetask build -p $DRP_PIPE_DIR/pipelines/LSSTCam/DRP.yaml --show pipeline
You will see a significant amount of yaml output as a result of this command.
4.2. Pipeline steps and connections¶
Note that, within the pipetask build printouts, the ordering of tasks within a given step may be randomized.
Returning to MakeDirectWarpTask, according to the DP2 DRP pipeline definition, it is used in the step named step3a-coadd-tracts and has been configured as follows:
makeDirectWarp:
class: lsst.drp.tasks.make_direct_warp.MakeDirectWarpTask
config:
- connections.calexp_list: preliminary_visit_image
connections.visit_summary: visit_summary
connections.warp: direct_warp
connections.masked_fraction_warp: direct_warp_masked_fraction
idGenerator.release_id: parameters.release_id
numberOfNoiseRealizations: 1
The numberOfNoiseRealizations: 1 line, for example, shows that the default number of noise realizations for DP2 production was 1, as mentioned previously in Section 3.
You can see an abbreviated version of the DP2 pipeline definition yaml by isolating step3a-coadd-tracts as follows:
pipetask build -p $DRP_PIPE_DIR/pipelines/LSSTCam/DRP.yaml#step3a-coadd-tracts --show pipeline
The above command assumes that you've already run setup lsst_distrib to set up the LSST software stack environment.
4.3. Configuration parameters¶
A similar command ending with --show config provides a means of inspecting all configuration parameters for step3a-coadd-tracts:
pipetask build -p $DRP_PIPE_DIR/pipelines/LSSTCam/DRP.yaml#step3a-coadd-tracts --show config
The above command's first few dozen lines of configuration output, listing a brief description of each parameter and showing that parameter's value, look as follows.
### Configuration for task `makeDirectWarp'
# Flag to enable/disable saving of log output for a task, enabled by default.
config.saveLogOutput=True
# Number of noise realizations to simulate and persist.
config.numberOfNoiseRealizations=1
# Offset to the seed used for the noise realization. This can be used to create a different noise realization if the default ones are catastrophic, or for testing sensitivity to the noise.
config.seedOffset=0
# Use the median of variance plane in the input calexp to generate noise realizations? If False, per-pixel variance will be used.
config.useMedianVariance=True
# Revert the old backgrounds from the `background_revert_list` connection?
config.doRevertOldBackground=False
# Apply the new backgrounds from the `background_apply_list` connection?
config.doApplyNewBackground=False
# Apply flat background ratio prior to background adjustments? Should be True if processing was done with an illumination correction.
config.doApplyFlatBackgroundRatio=False
# If True, use the PSF model and aperture corrections from the 'visit_summary' connection to make the warp. If False, use the PSF model and aperture corrections from the 'calexp' connection.
config.useVisitSummaryPsf=True
# If True, use the WCS from the 'visit_summary' connection to make the warp. If False, use the WCS from the 'calexp' connection.
config.useVisitSummaryWcs=True
# If True, use the photometric calibration from the 'visit_summary' connection to make the warp. If False, use the photometric calibration from the 'calexp' connection.
config.useVisitSummaryPhotoCalib=True
5. Create a pipeline¶
Create a pipeline from a subset of the steps included in the full DP2 Data Release Production pipeline, including only certain coaddition and source detection steps of the processing. A pipeline can be instantiated from a URI. A URI is a Uniform Resource Identifier, and as seen below it can incorporate both a file path and additional information: in this case, the additional information is the four processing steps to use as part of coaddition and detection: selectDeepCoaddVisits, makeDirectWarp, assembleCellCoadd, and detectCoaddPeaks. These processing steps are defined in detail in the $DRP_PIPE_DIR/pipelines/LSSTCam/DRP.yaml DRP processing yaml definition file. The URI is constructed by appending # to the yaml file path, followed by a comma-separated list of selected pipeline steps.
yaml_file = '$DRP_PIPE_DIR/pipelines/LSSTCam/DRP.yaml'
steps = 'selectDeepCoaddVisits,makeDirectWarp,assembleCellCoadd,detectCoaddPeaks'
my_uri = yaml_file + '#' + steps
print(my_uri)
$DRP_PIPE_DIR/pipelines/LSSTCam/DRP.yaml#selectDeepCoaddVisits,makeDirectWarp,assembleCellCoadd,detectCoaddPeaks
Create the pipeline using the from_uri method.
coaddPipeline = Pipeline.from_uri(my_uri)
6. View the pipeline graph¶
Pipeline graphs are a tool used by the LSST Science Pipelines to summarize and visualize the flow of a processing pipeline in terms of tasks and their inputs and outputs. The following command generates a pipeline graph visualization showing the inputs and outputs of coaddPipeline.
!pipetask build \
-p $DRP_PIPE_DIR/pipelines/LSSTCam/DRP.yaml#selectDeepCoaddVisits,makeDirectWarp,assembleCellCoadd,detectCoaddPeaks \
--pipeline-dot ~/pipeline.dot; \
dot ~/pipeline.dot -Tpng > ~/coaddPipeline.png
The image below provides a visualization of the coaddPipeline pipeline graph.
Light gray rectangles with rounded corners represent data, whereas light green rectangles with sharp corners represent pipeline tasks. The arrows connecting the data and tasks illustrate the data processing flow. The data processing starts at the top (inputs) and proceeds to the bottom (outputs).
Image(filename=os.getenv('HOME') + "/coaddPipeline.png", width=800)
Figure 1: An example of a pipeline graph for a pipeline built with the LSST Science Pipelines. This pipeline performs coaddition and source detection.
7. Prepare to execute the pipeline¶
A pipeline executor combines the pipeline definition with a specific subset of input data, identified via the Butler. This section prepares the inputs an executor needs.
7.1. Select inputs¶
Focus on a limited set of input data to process, a single patch within DP2 in a single filter. This desired input data is defined by a set of three parameters: tract, patch, and band. Use r-band, and the tract and patch of the DP2 coadd footprint covering the center of the Extended Chandra Deep Field South (ECDFS; see the 200-series deep coadd tutorial notebook for derivation of these patch, tract numbers).
my_filter = 'r'
my_tract = 5063
my_patch = 15
Combine these data identification parameters into a query string that will be used to create the pipeline executor. The skymap value of lsst_cells_v2 is simply the sky tiling that has been used in general for DP2.
query_string = "tract = {tract} AND patch = {patch} AND band = '{band}' AND skymap = 'lsst_cells_v2'".format(
tract=my_tract,
patch=my_patch,
band=my_filter
)
print(query_string)
tract = 5063 AND patch = 15 AND band = 'r' AND skymap = 'lsst_cells_v2'
7.2. Set configuration overrides¶
Section 3 demonstrated how to apply configuration overrides to a Task. Configuration overrides can also be applied to pipelines.
Apply MakeDirectWarpTask config overrides to coaddPipeline. As in Section 3, the first config override ensures that visit images are obtained from products that will be available as part of full DP2. The second override sets the makeDirectWarp number of noise realizations to 0 -- even though DP2 production uses 1 noise realization, coaddPipeline will run faster with no noise realizations.
coaddPipeline.addConfigOverride('makeDirectWarp', 'connections.calexp_list', 'visit_image')
coaddPipeline.addConfigOverride('makeDirectWarp', 'numberOfNoiseRealizations', 0)
Note: Building the pipeline executor requires additional configuration overrides for
assembleCellCoaddanddetectCoaddPeaks, which will be demonstrated in the DP2 custom coaddition tutorial notebook.
7.3. Next steps and advisories¶
The pipeline definition (coaddPipeline), the query string (query_string), and the configuration overrides together specify what processing to perform and which data to perform it on. The next step is to pass these, along with the Butler, to a pipeline executor such as simple_pipeline_executor.SimplePipelineExecutor. When the executor is created, it combines the pipeline graph shown in Figure 1 with the data IDs matching the query string to build the QuantumGraph: each task in the pipeline graph is expanded into one quantum per unit of data it will process, for example one makeDirectWarp quantum per visit overlapping the selected patch. The executor can then run these quanta in an order that guarantees every quantum's inputs exist before it executes.
Building the QuantumGraph and executing this pipeline requires the DP2 visit images as inputs. These are not yet available, so this notebook stops short of creating the executor. A future version of this tutorial will add that step once the visit images are released.