Skip to content

Commit

Permalink
Electron probe tweaks (#661)
Browse files Browse the repository at this point in the history
* Do not overwrite Probe unless requested. Fixes #2515
* Use electron Probe in two ED format classes that were missed before
  • Loading branch information
dagewa authored Oct 11, 2023
1 parent cd03663 commit 4ad0ce5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions newsfragments/661.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The beam probe is no longer reset if any geometrical override is provided at import.
1 change: 1 addition & 0 deletions newsfragments/661.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set the beam probe to ``electron`` in both ``FormatNXmxED`` and ``FormatSER``.
2 changes: 2 additions & 0 deletions src/dxtbx/format/FormatNXmxED.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from dxtbx.format.FormatNXmx import FormatNXmx
from dxtbx.masking import mask_untrusted_circle, mask_untrusted_polygon
from dxtbx.model import SimplePxMmStrategy
from dxtbx.model.beam import Probe


class FormatNXmxED(FormatNXmx):
Expand Down Expand Up @@ -65,6 +66,7 @@ def _beam(self, index=None):

beam = super()._beam()
beam.set_polarization_fraction(0.5)
beam.set_probe(Probe.electron)

return beam

Expand Down
2 changes: 2 additions & 0 deletions src/dxtbx/format/FormatSER.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from dxtbx import IncorrectFormatError
from dxtbx.format.Format import Format
from dxtbx.format.FormatMultiImage import FormatMultiImage
from dxtbx.model.beam import Probe


# The read_emi and _parseEntry_emi functions are taken from openNCEM project
Expand Down Expand Up @@ -334,6 +335,7 @@ def cal_wavelength(V0):
wavelength=wavelength,
polarization=(0, 1, 0),
polarization_fraction=0.5,
probe=Probe.electron,
)

def _get_raw_data(self, index):
Expand Down
3 changes: 2 additions & 1 deletion src/dxtbx/model/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def from_phil(
beam.set_flux(params.beam.flux)
if params.beam.sample_to_source_distance is not None:
beam.set_sample_to_source_distance(params.beam.sample_to_source_distance)
beam.set_probe(Beam.get_probe_from_name(params.beam.probe))
if params.beam.probe != "x-ray":
beam.set_probe(Beam.get_probe_from_name(params.beam.probe))

return beam

Expand Down

0 comments on commit 4ad0ce5

Please sign in to comment.