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

Fix AGIPD1M 'position_modules_interpolate', introduce upscale. #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

turkot
Copy link
Contributor

@turkot turkot commented Sep 11, 2022

I've fixed the 'position_modules_interpolate' method in AGIPD_1MGeometry class and introduced the 'scale' optional parameter in case someone would like to upscale. Part of the output array without scaling:
interpolate_scale_1
same part of the image with the scale of 4:
interpolate_scale_4
Of course scaling makes the interpolation slower.

@turkot turkot self-assigned this Sep 12, 2022
@takluyver
Copy link
Member

Thanks! Which bit was the actual fix? Is it the division by pixel size? If so, this has been broken for a long time, which probably illustrates that no-one has been using it.

If we're bringing this into use, and especially if we're introducing a new option that can make it even slower, I think we should try to improve the implementation so that it's significantly faster overall. Back when I wrote this, I made the odd decision to allocate a full layer for every tile (so a stack of 128 images of ~1 MPx each), transform each tile into one layer, and then use nanmax to reduce it down to a single image. I think the rationale was something about preserving NaN values in the gaps, but I don't think that's actually worth making it hideously slow for.

Maybe we can interpolate each tile in an array just large enough to hold it, and then copy it into the right place in the output image. Or maybe make a sparse array mapping input pixels to output pixels, so you flatten the input array and do a giant matrix multiplication to get the output? Or perhaps we just figure out how to take advantage of what PyFAI or some other package has already done.

@turkot
Copy link
Contributor Author

turkot commented Sep 12, 2022

Yes, this and also the 'offset' was calculated in a weird way.
Yes, these sound like possible options. One other think we could do is to add an option to plot only a part (like roi) of the output image - for example, as in my plots shown before we don't need the whole detector image.

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.

2 participants