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

Gemmi setup MapReorderOnly never sets AxisOrder for a grid #322

Open
gabriellareggiano opened this issue Jul 3, 2024 · 1 comment
Open

Comments

@gabriellareggiano
Copy link

Hello,

I've been using gemmi for a bit and I wanted to check that this was the intended behavior. I load in a X-ray map which has a map extent that is not equal to the unit cell. When I attempt to do setup with the MapReorderOnly, the axis order of the grid stays as unknown. Here's my ipython session (just removed some typo lines), gemmi version 0.6.4:

In [17]: m8jsd = gemmi.read_ccp4_map("8jsd-createmap-out-0.ccp4")

In [21]: m8jsd.setup(float('nan'), mode=gemmi.MapSetup.ReorderOnly)

In [22]: m8jsd.grid.axis_order
Out[22]: <AxisOrder.Unknown: 0>

In [24]: m8jsd.full_cell()
Out[24]: False

In [26]: m8jsd.setup(float('nan'))

In [28]: m8jsd.grid.axis_order
Out[28]: <AxisOrder.XYZ: 1>

I believe this happens because it's not in the full cell. Is this the intended usage? It's confusing to me that the axis_order is not updated unless the grid is in the full cell, since we already have the full cell function. Is it to prevent other functions from running on a non-full cell grid?

For context, I just wanted to use set_subarray for this non-full cell grid, which understandably asks for XYZ axis order.

Thank you for your help!

@wojdyr
Copy link
Member

wojdyr commented Jul 4, 2024

Yes, it's confusing. axis_order ended up being primarily used to check if a grid corresponds to the unit cell.

Almost all grid functions work only in full-cell mode, with periodic boundary conditions (grid coordinates modulo grid size) always applied. I know it sometimes gets in the way. On the other hand, having a grid from (0,0,0) to (1,1,1) simplifies things.

We could have a separate class for 3D array data that would allow offset and wouldn't have translation symmetry. I've had it in mind for a long time, but I'm not sure if it's a good idea and what such class would be useful for.

As an alternative to set_subarray, you could modify grid.array which is a NumPy array interface to the grid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants