FileTemplate

class lsst.daf.butler.FileTemplate(template)

Bases: object

Format a path template into a fully expanded path.

Parameters:
template : str

Template string.

Notes

The templates use the standard Format Specification Mini-Language with the caveat that only named fields can be used. The field names are taken from the Dimensions along with several additional fields:

At least one or both of run or collection must be provided to ensure unique filenames.

The mini-language is extended to understand a “?” in the format specification. This indicates that a field is optional. If that Dimension is missing the field, along with the text before the field, unless it is a path separator, will be removed from the output path.

Methods Summary

format(ref) Format a template string into a full path.

Methods Documentation

format(ref)

Format a template string into a full path.

Parameters:
ref : DatasetRef

The dataset to be formatted.

Returns:
path : str

Expanded path.

Raises:
KeyError

Requested field is not defined and the field is not optional. Or, component is specified but “component” was not part of the template.