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-34124: Add separate histogram label argument into histPlot #29

Merged
merged 1 commit into from Mar 21, 2022

Conversation

leeskelvin
Copy link
Contributor

No description provided.

Copy link
Contributor

@natelust natelust left a comment

Choose a reason for hiding this comment

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

Looks fine for this change set, with some minor tweaks requested.

Outside the scope of this ticket: This function is really huge and complex with lots of specific syntax baked in.

I feel it would read better if it was abstracted away into other methods or free functions such that the main body of the method is 5-15 lines of code dispatching to the other functions with names describing what they are doing. Potentially those methods too might need abstracted a bit as well.

I think that would leave things in a much more maintainable state, that is easier for others to understand and update. Again, not important for this ticket, just a general comment if you happen to have a good point to consider it.

@@ -46,8 +46,16 @@ class HistPlotConfig(pexConfig.Config):
)

actions = ConfigurableActionStructField(
doc="A dict of configurable actions, with each key-value pair corresponding to each histogram. "
"Dict keys will be used to label each histogram in the panel.",
doc="A dict of configurable actions, with each item corresponding to a single histogram.",
Copy link
Contributor

Choose a reason for hiding this comment

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

ConfigurableActionStructField is NOT a dict, it is like a Struct or SimpleNamespace object. It only supports dict like assignment and construction in order to save developers the trouble of typing out config.actions.x = 1; config.actions.y = 2, ... everywhere in a similar way to initializing the above mentioned classes with kw args.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Changed to:

A Struct-like object, with each item corresponding to a single histogram action.


histLabels = pexConfig.DictField(
doc="A dict specifying the histogram labels to be printed in the upper corner of each panel. If the "
"key matches a key specified in `actions`, then the corresponding value will be printed on the plot. "
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"key matches a key specified in `actions`, then the corresponding value will be printed on the plot. "
"matches an `attribute` of the `actions` field, ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, changed as suggested!

@leeskelvin leeskelvin merged commit b9ee1be into main Mar 21, 2022
@leeskelvin leeskelvin deleted the tickets/DM-34124 branch March 21, 2022 22:09
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.

None yet

2 participants