-
Notifications
You must be signed in to change notification settings - Fork 3
DM-51162: Add histograms to wholeSkyPlot #442
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
Conversation
8694c7b to
33b42d4
Compare
| yLimits = ListField[float](doc="Plotting limits for the y axis.", default=[-10.0, 60.0]) | ||
| autoAxesLimits = Field[bool](doc="Find axes limits automatically.", default=True) | ||
| dpi = Field[int](doc="DPI size of the figure.", default=500) | ||
| figureSize = ListField[float](doc="Size of the figure.", default=[9.0, 3.5]) |
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 have removed these because the figures are getting very large and taking a long time to get from the butler. The figure size now also needs to be very specific and if you change it nothing will line up. If this becomes a problem for @erinleighh then I will make a better fix on another ticket in the future.
jrmullaney
left a comment
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.
Generally looks fine.
I wonder whether there should be catches in case both low and high thresholds aren't specified. It could be that one always needs to specify lowThreshold and highThreshold in the yaml file, but I think the code should be able to handle one of them being None or Nan or something similar to indicate that it hasn't got a lower/upper threshold.
| default=None, | ||
| ) | ||
| addThreshold = Field[bool]( | ||
| doc="Read in the predefined threshold and add it to the histogram.", |
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.
Should this be "threshold(s)"? Aren't there often more than one thresholds per metric?
Also, suggest "indicate it on the histogram" rather than "add".
| ax.axvline(meds[i], ls=(0, (5, 3)), lw=1, c=colors[i]) | ||
| if self.panels[panel].addThreshold and hist in metricDefs: | ||
| lowThreshold = metricDefs[hist]["lowThreshold"] | ||
| highThreshold = metricDefs[hist]["highThreshold"] |
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.
Does this assume that there will always be a "lowThreshold" and a "highThreshold" for each metric in the yaml file.
Will that always be the case?
Will it break meaningfully if someone doesn't include either a "lowThreshold" or a "highThreshold" when they add a new metric to the metricInformation.yaml file, or do we want it to be ok with adding just a single line?
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 would prefer if people always added a sensible value for both however I have added catches for infinite values and only one of the thresholds, or neither, being present.
| labelTracts = Field[bool](doc="Label the tracts.", default=False) | ||
|
|
||
| addThreshold = Field[bool]( | ||
| doc="Read in the predefined threshold and add it to the histogram.", |
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.
Same comment as for the same config in histPlot.py.
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.
| doc="Read in the predefined threshold and add it to the histogram.", | |
| doc="Read in the predefined thresholds and indicate them on the histogram.", |
| ------- | ||
| text : `str` | ||
| A string containing the 5 tracts with the largest outlier values. | ||
| """ |
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.
Should this say "10 tracts" now?
| # Sort values in descending (-) absolute value order discounting | ||
| # NaNs. | ||
| maxInds = np.argsort(-np.abs(outlierValues)) | ||
| # Show up to five values on the plot. |
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.
Should this say "up to ten values" now?
| dataName = self.zAxisLabel.format_map(kwargs) | ||
| colBarVals = np.array(colBarVals) | ||
| if self.addThreshold and dataName in metricDefs: | ||
| lowThreshold = metricDefs[dataName]["lowThreshold"] |
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.
Again, just wondering whether there should be a catch in cases where there isn't both a lower and upper threshold in metricInformation.
Or what happens if one of them is Nan or None.
| ax1.yaxis.tick_right() | ||
|
|
||
| if self.addThreshold and dataName in metricDefs: | ||
| ax1.axvline(lowThreshold, color=accent_color()) |
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.
Again, will we always have upper and lower thresholds?
What if one of these is Nan or None?
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 caught this but if people go around setting the thresholds to NaN I will be irritated.
f6e24a3 to
08b72d8
Compare
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.
Just a couple of typos - you can just accept my suggestions on github, if you like.
| default=None, | ||
| ) | ||
| addThresholds = Field[bool]( | ||
| doc="Read in the predefined threshold and indicate it on the histogram.", |
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.
| doc="Read in the predefined threshold and indicate it on the histogram.", | |
| doc="Read in the predefined thresholds and indicate them on the histogram.", |
| labelTracts = Field[bool](doc="Label the tracts.", default=False) | ||
|
|
||
| addThreshold = Field[bool]( | ||
| doc="Read in the predefined threshold and add it to the histogram.", |
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.
| doc="Read in the predefined threshold and add it to the histogram.", | |
| doc="Read in the predefined thresholds and indicate them on the histogram.", |
08b72d8 to
2eff89c
Compare
2eff89c to
d8cc047
Compare
No description provided.