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-31217: Add ConsolidateHealSparsePropertyMapsTask #577
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor clarifications requested.
def __init__(self, *, config=None): | ||
super().__init__(config=config) | ||
|
||
# Remove connections from those that are not configured |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would there be unconfigured connections? Is this something a user should be warned about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've improved the comments here and when I used the same pattern for the tract-based maps. But the idea is that we have to create all possible connections that are in the registry, and then remove those that weren't configured to run to leave the subset of connections that we want to use.
|
||
|
||
class ConsolidateHealSparsePropertyMapTask(pipeBase.PipelineTask): | ||
"""Task to consolidate HealSparse property maps.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to document somewhere what exactly is being consolidated as it's not obvious to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am expanding this, and adding rst task documentation which I had forgotten to add.
# Create input/output connections for all possible maps defined in the | ||
# registry. | ||
for name in BasePropertyMap.registry: | ||
vars()[f"{name}_map_min"] = pipeBase.connectionTypes.Input( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the preferred pattern for batch assignment of connections? It seems sensible on second thought but was unexpected to me at first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only way that I know of to programatically make connections which must be class instance variables. I've added additional comments, including a link to the magic stack overflow which told me how to do this: https://stackoverflow.com/questions/2519807/setting-a-class-attribute-with-a-given-name-in-python-while-defining-the-class
04bf37b
to
8342f0e
Compare
8342f0e
to
04b79dd
Compare
No description provided.