MetricsDelegate

class lsst.daf.butler.tests.MetricsDelegate(storageClass: StorageClass)

Bases: StorageClassDelegate

Parameter handler for parameters using Metrics.

Methods Summary

getComponent(composite, componentName)

Attempt to retrieve component from composite object by heuristic.

handleParameters(inMemoryDataset[, parameters])

Modify the in-memory dataset using the supplied parameters, returning a possibly new object.

selectResponsibleComponent(readComponent, ...)

Select the best component for calculating a derived component.

Methods Documentation

getComponent(composite: Any, componentName: str) Any

Attempt to retrieve component from composite object by heuristic.

Will attempt a direct attribute retrieval, or else getter methods of the form “get_componentName” and “getComponentName”.

Parameters:
compositeobject

Item to query for the component.

componentNamestr

Name of component to retrieve.

Returns:
componentobject

Component extracted from composite.

Raises:
AttributeError

The attribute could not be read from the composite.

handleParameters(inMemoryDataset: Any, parameters: Mapping[str, Any] | None = None) Any

Modify the in-memory dataset using the supplied parameters, returning a possibly new object.

Parameters:
inMemoryDatasetobject

Object to modify based on the parameters.

parametersdict

Parameters to apply. Values are specific to the parameter. Supported parameters are defined in the associated StorageClass. If no relevant parameters are specified the inMemoryDataset will be return unchanged.

Returns:
inMemoryDatasetobject

Updated form of supplied in-memory dataset, after parameters have been used.

classmethod selectResponsibleComponent(readComponent: str, fromComponents: set[str | None]) str

Select the best component for calculating a derived component.

Given a possible set of components to choose from, return the component that should be used to calculate the requested derived component.

Parameters:
derivedComponentstr

The derived component that is being requested.

fromComponentsset of str

The available set of component options from which that derived component can be computed. None can be included but should be ignored.

Returns:
requiredstr

The component that should be used.

Raises:
NotImplementedError

Raised if this delegate refuses to answer the question.

ValueError

Raised if this delegate can not determine a relevant component from the supplied options.