-
Notifications
You must be signed in to change notification settings - Fork 2
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-32450: Add camera geometry plotting utilities #131
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.
This looks good--I mostly just have comments about things that might be able to be made simpler. However, can you put some example plots for the two different levels on the jira ticket?
|
||
xAxisLabel = Field[str](doc="Label to use for the x axis.", optional=False) | ||
yAxisLabel = Field[str](doc="Label to use for the y axis.", optional=False) | ||
zAxisLabel = Field[str](doc="Label to use for the z axis.", optional=False) |
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.
Not sure, but can these and statistic
below just be inherited from the parent class?
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 believe so. I've removed them and confirmed that the plots look identical.
|
||
# U/V coordinates represent focal plane locations. | ||
minU, minV = corners.min(axis=0) | ||
maxU, maxV = corners.max(axis=0) |
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.
Can you just use these to set plotLimit_x
and plotLimit_y
rather than go through the loop above?
# This does the appropriate statistic for this | ||
# detector's data. | ||
statistic, _, _ = binned_statistic_dd( | ||
[focalPlane_x[detectorInd], focalPlane_y[detectorInd]], |
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.
Aren't focalPlane_x and focalPlane_y all zeros here? I guess it doesn't matter, since you're just trying to get one number for the whole detector, but then it seems like you could use something simpler than binned_statistic_dd
. That said, I couldn't find another scipy function with the needed functionality.
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.
The contents of focalPlane_xy
are arbitrary, and should be ignored in this block. I also tried to find another function that understood the same statistic
argument, and tracked through the source to see that the other binned_statistic
functions make calls to binned_statistic_dd
, which does the conversion from the string statistic name to the numeric result itself (here: https://github.com/scipy/scipy/blob/v1.11.1/scipy/stats/_binned_statistic.py#L596).
ampName = amplifier.getName() | ||
detectorInd = data["detector"] == detectorId | ||
ampInd = data["x"] == ampName | ||
detectorInd &= ampInd |
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.
Personally, I think it would be clearer to reverse this to ampInd &= detectorInd
so that you are using ampInd
later.
|
||
class FocalPlaneGeometryPlot(FocalPlanePlot): | ||
"""Plots the focal plane distribution of a parameter in camera | ||
geometry units. |
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.
Can you clarify that camera geometry units means detectors or amplifiers?
for amplifier in detector: | ||
ampName = amplifier.getName() | ||
detectorInd = data["detector"] == detectorId | ||
ampInd = data["x"] == ampName |
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.
If x
is supposed to be the amp name, can you add that to the docs?
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 comment convinced me to switch from using x
(which as suggested, isn't obvious) to a new amplifier
field. I've updated the docs to reflect this. This also allows the x
and y
vectors to be ignored, allowing a single catalog to be plotted using either FocalPlanePlot
or FocalPlaneGeometryPlot
(for level='detector'
).
I wrote a method to manage some further conversions, but it seemed out of scope for this ticket, so I've saved that as a snippet that might be useful in the future.
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.
Very minor comment: you could remove "x" and "y" from the columns that are expected in data
(lines 290-293).
* Switch to an explicit 'amplifier' column, so as not to overload 'x'. * Switch to using 'z' column for all expected lengths, as it should always exist. * Clarify index name, as it applies to amplifiers, not detectors.
No description provided.