Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-46059: Add new metric to capture uncapped offsets between amp interfaces during ampOffsetTask execution #318

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

enourbakhsh
Copy link
Contributor

No description provided.

Copy link
Contributor

@jrmullaney jrmullaney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've one mandatory change, but I also wonder whether we could simplify this more generally...see comments below, and my direct messages on slack.

python/lsst/analysis/tools/tasks/metadataAnalysis.py Outdated Show resolved Hide resolved
python/lsst/analysis/tools/tasks/metadataAnalysis.py Outdated Show resolved Hide resolved
python/lsst/analysis/tools/tasks/metadataAnalysis.py Outdated Show resolved Hide resolved
@@ -89,3 +106,29 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):
raise NoWorkFound(f"No metadata entries for {taskName}.")
outputs = self.run(data=metadata, plotInfo=plotInfo)
butlerQC.put(outputs, outputRefs)


class DictTypeDatasetMetadataAnalysisTask(AnalysisPipelineTask):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we simply call this DatasetMetadataAnalysisTask, or do we expect there to be other, non-dict datasets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also expect non-dict metadata that simply offer a value for each metric name; I can add one for such regular 1:1 mappings for completeness. This specific ticket focuses on the interactions between many amplifiers on a detector, so it made sense to store information about all those so-called interface offsets in a dictionary that pairs amp names with the offsets, rather than cluttering our metadata with less human-readable names.

Copy link
Contributor Author

@enourbakhsh enourbakhsh Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced the DatasetMetadataAnalysisTask class, which adapts its behavior based on the metricsStoredAsDict config option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, do feel free to revert back to DictTypeDatasetMetadataAnalysisTask and remove the metricsStoredAsDict parameter. I'll leave that up to you, though.

Copy link
Contributor Author

@enourbakhsh enourbakhsh Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having it this way with metricsStoredAsDict is more future-proof because most metrics I know are not stored as dictionaries.

pipelines/pviMetrics.yaml Show resolved Hide resolved
pipelines/pviMetrics.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@jrmullaney jrmullaney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy for this to be merged once you've made the requested changes. All are very minor.

Thanks for this!

metadataDimensions: ["instrument", "visit", "detector"]
atools.calexpMetadataMetrics: MetadataMetricTool
connections.inputName: calibrate_metadata
connections.outputName: calibrate_metadata_analysis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove _analysis from this output name, please? While I had thought it was a problem, it turns out it isn't, as _metrics is added to the end of the output name - so what we'd end up with here is calibrate_metadata_analysis_metrics. I'd rather keep the names as short as possible, while still being meaningful and unique. Might be worth adding a # Appended with "_metrics" - or similar - comment here so I don't get confused again!

Sorry for the confusion!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

metadataDimensions: ["instrument", "visit", "detector"]
atools.calibrateImageMetadataMetrics: MetadataMetricTool
connections.inputName: calibrateImage_metadata
connections.outputName: calibrateImage_metadata_analysis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same applies here (i.e., please remove _analysis).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

metadataDimensions: ["instrument", "visit", "detector"]
atools.calexpMetadataMetrics: MetadataMetricTool
connections.inputName: calibrate_metadata
connections.outputName: calibrate_metadata_analysis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

dimensions=frozenset(config.metadataDimensions),
)

self.dimensions = frozenset(config.inputDimensions)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.dimensions = frozenset(config.inputDimensions) should come before super().__init__(config=config) so that the inputDimensions are picked-up here, when the metrics output connection is defined. Otherwise, the output metric bundle doesn't have any dimensions!
I should have realised this when I asked you to set dimensions={} above - sorry for my oversight.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants