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 write_crystfel_geom offset unit #102

Merged
merged 4 commits into from
Sep 22, 2021
Merged

Conversation

JunCEEE
Copy link
Contributor

@JunCEEE JunCEEE commented Aug 27, 2021

Fix issue #101

@JunCEEE
Copy link
Contributor Author

JunCEEE commented Aug 27, 2021

I have no idea why the test failed...

@@ -54,7 +54,8 @@ def _crystfel_format_vec(vec):

def frag_to_crystfel(fragment, p, a, ss_slice, fs_slice, dims, pixel_size):
tile_name = 'p{}a{}'.format(p, a)
c = fragment.corner_pos / pixel_size
c = fragment.corner_pos
c[:2] = c[:2] / pixel_size
Copy link
Member

Choose a reason for hiding this comment

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

This will modify fragment.corner_pos, so exporting a geometry object to a .geom file will change it. This is because c is a reference to the existing array, not a copy.

For clarity, I think it's better to make a separate array with positions in pixel units, rather than mixing pixel units and metres in the same array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it mean the corner_pos needs to be redefined here if one will have a separate variable for the offset?

@JunCEEE
Copy link
Contributor Author

JunCEEE commented Aug 30, 2021

Please see the current workaround:
https://github.com/European-XFEL/EXtra-geom/pull/102/files

Copy link
Member

@takluyver takluyver left a comment

Choose a reason for hiding this comment

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

Thanks Jun, this looks fine. I've made a little simplification, which I'll apply now and merge it.

extra_geom/crystfel_fmt.py Outdated Show resolved Hide resolved
extra_geom/crystfel_fmt.py Outdated Show resolved Hide resolved
@takluyver takluyver merged commit 77fda04 into European-XFEL:master Sep 22, 2021
@takluyver takluyver added this to the 1.6 milestone Sep 22, 2021
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