Skip to content

Commit

Permalink
Add ad hoc attempt at allow storage of multiple crystal models when w…
Browse files Browse the repository at this point in the history
…riting a serial crystallographic dataset to NXmx
  • Loading branch information
phyy-nx committed Jun 29, 2023
1 parent a860cd8 commit 65b2cde
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/dxtbx/format/nxmx_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,22 @@ def setup_axis(name, vector, main_axis=False):
)
self.handle["entry/instrument/detector/frame_time"].attrs["units"] = "s"

def setup_multi_crystal(self, multi_crystal_group_name):
self.handle["entry/sample"].create_group(multi_crystal_group_name)

def add_crystal(self, multi_crystal_group_name, crystal):
from dials.utils.nexus import nx_mx

# Assume this is the next crystal in the list, added after the last image
# was added
n_images = self.handle["entry/data/data"].shape[0]
nx_mx.dump_crystal(
self.handle["entry/sample/" + multi_crystal_group_name],
crystal,
None,
"crystal%d" % (n_images - 1),
)


def run(args):
usage = "dials.python nxmx_writer.py <experiments OR image files>"
Expand Down

0 comments on commit 65b2cde

Please sign in to comment.