Last active
April 5, 2024 13:28
-
-
Save benjaminhwilliams/d91d042248f5a5f3143a76e82ccabb89 to your computer and use it in GitHub Desktop.
DXTBX format class for DLS I19-2 Eiger data, with custom DAC opening angle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from dxtbx.format.FormatNXmxDLSI19_2 import FormatNXmxDLSI19_2 | |
from dxtbx.masking import GoniometerMaskerFactory | |
class FormatNXmxDLSI19_2_CustomDAC(FormatNXmxDLSI19_2): | |
""" | |
Read NXmx-flavour data from beamline I19-2 at Diamond Light Source. | |
Include the option of dynamic shadowing of the standard I19-2 diamond anvil | |
pressure cell with a 120° conical aperture. | |
""" | |
def get_goniometer_shadow_masker(self, goniometer=None): | |
"""Apply the dynamic mask for a diamond anvil cell with a 120° aperture.""" | |
return GoniometerMaskerFactory.diamond_anvil_cell( | |
goniometer or self.get_goniometer(), cone_opening_angle=math.radians(120) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
About
This Gist provides a custom 'format class' (the mechanism for reading and interpreting a specific data format from a particular instrument into DIALS and xia2) for data from EH2 on beamline I19 at Diamond Light Source, using a custom opening angle for masking the shadow of the conical aperture of a diamond anvil pressure cell. By default, I19-2 DAC data are assumed to use a 76° conical aperture. This alternative format class allows for a 120° opening angle and can be configured with the angle of your choice.
Instructions
To use this, you need to have a working DIALS build (e.g.
module load dials
at Diamond). Then you can either download the Gist as a file (if you think you might need to modify the 120° opening angle, for example), or load the format class directly with just the Gist URL. In either case, you'll usedxtbx.install_format -u
, which will create a directory.dxtbx
in your home directory (i.e.~/.dxtbx
), containing the custom format class.This custom format class will only be available to you. Other users will have to repeat these instructions themselves if they want to make use of the custom format class.
Installing
Option 1 (easy, fixed 120° opening angle)
To load directly from the Gist, if you know you want a 120° opening angle and only a 120° opening angle:
Option 2 (editable opening angle)
Alternatively, you can download the Gist as a file. If you've previously loaded straight from the Gist URL (option 1), you'll first need to delete the installed format class with
or even, if there's nothing else in
~/.dxtbx
that you care about (be very careful withrm -r
),Now download the Gist. Suppose you save it as
some/directory/format_nxmx_dls_i19_2_custom_dac.py
. Then you can edit the file with the opening angle of your choice and install the format class withUsing the new format class
Just do your normal
dials.import dynamic_shadowing=True
orxia2 dynamic_shadowing=True
, as usual. For data from the EH2 Eiger on I19, the 120° opening angle (or whatever you've configured in a modified format class) will be used.