-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add geometry methods to get physical locations of data coordinates #142
Conversation
LGTM, given that Henry is ok with it. |
Thanks! Just to check: are you saying that you've spoken to Henry and he is happy with it, or that you're happy so long as it suits Henry? |
Sorry, I meant LGTM from my side. No idea about Henry. I think he is on beamtime compensation or Holiday. |
OK, thanks. When you see Henry back around, it might be good to remind him about this. |
2185c73
to
3a5e410
Compare
f14ebb4
to
648f594
Compare
648f594
to
61dd097
Compare
These were working out the same thing, just in slightly different formats.
Do we have a notebook as an example that could go into the Karabo data documentation? I think this is interesting enough to be on read the docs. (Thinking in particular about the discussion with Andreas and the general need of having to know where pixels are for checking and integration/feeding of other tools etc). |
I've just added a bit to the DSSC geometry notebook that was already there. |
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'm trying to catch up with geometry code and I'm obviously not there yet...
I feel like it would be more efficient (for me) to wait until you're here next week if you have some time to waste on explaining this to me
for t, tile in enumerate(mod, start=0): | ||
corner_x, corner_y, corner_z = tile.corner_pos * self.pixel_size | ||
ss_unit_x, ss_unit_y, ss_unit_z = tile.ss_vec * self.pixel_size | ||
fs_unit_x, fs_unit_y, fs_unit_z = tile.fs_vec * self.pixel_size |
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.
How do you define the corner position for a DSSC pixel, do you consider a box around the pixel?
I believe the positions in the slow scan axis will be wrong, due to the fact that the hexagon pixel is not regular and pixels are tessellated (considering the corner of a box around the pixel, it would be somewhere in an other pixel, e.g. corner of pixel [1, 0] would be in pixel [0, 0] - this is probably not clear, would be better if I could draw something...) and it looks like here that, e.g. pixel [1, 0] start at the edge of the pixel's [0, 0] box?
You probably got that right already and it's just me not getting the full picture... Maybe it would be easier if you could explain this to me next week?
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 do consider a box around the pixel, so if you pass centre=False
, it will give a point just outside the pixel (the corner of the bounding box). I'm OK with that. I'm planning to implement the distortion array method based on this, and that uses offsets from the corner of the bounding box.
However, I have made a mistake and got the centres slightly off. We should be adding 2/3 instead of 1/2 in the slow-scan direction - for the same reason as the 4/3 multiplication in the other PR you reviewed recently.
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.
|
||
Returns an array of similar shape with an extra dimension of length 3, | ||
for (x, y, z) coordinates in metres. | ||
""" |
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 do not understand this method and what should be the inputs :(
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'll try to clarify it tomorrow. But briefly, it's for things like the output of the robust peak finder: it gives peak locations in pixel coordinates within the input data - e.g. 31.2 pixels in the slow-scan direction, 10.78 pixels fast scan. This method can convert those into coordinates in physical space (x, y, z).
Two more things: Context: the plotting of the hexagons and the pixel positions is really great and useful in understanding and debugging things.
I imagine this will also be useful when we evaluate various 'snapping' algorithms: we will then want to plot the 'assumed' pixel position on top of the real (hexagonal) pixel position.
If it is too hard to squeeze in now, then please object and convert into a new ticket. I think we'll need it in any case. |
|
The second new method is now called |
Codecov Report
@@ Coverage Diff @@
## master #142 +/- ##
==========================================
+ Coverage 87.06% 87.44% +0.37%
==========================================
Files 15 15
Lines 2450 2500 +50
==========================================
+ Hits 2133 2186 +53
+ Misses 317 314 -3
Continue to review full report at Codecov.
|
Got an offline LGTM from @tmichela |
Discussion on #139