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

Add wavelength_cal to reflection table. #29

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dials/algorithms/indexing/bravais_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def as_dict(self):
"rmsd": item.rmsd,
"nspots": item.Nmatches,
"bravais": item["bravais"],
"volume": uc.volume(),
"unit_cell": uc.parameters(),
"cb_op": str(item["cb_op_inp_best"] * self.cb_op_to_primitive),
"max_cc": item.max_cc,
Expand Down
2 changes: 2 additions & 0 deletions src/dials/algorithms/indexing/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ def refine(self, experiments, reflections):
predicted = refiner.predict_for_indexed()
reflections["xyzcal.mm"] = predicted["xyzcal.mm"]
reflections["entering"] = predicted["entering"]
if "wavelength_cal" in predicted:
reflections["wavelength_cal"] = predicted["wavelength_cal"]
reflections.unset_flags(
flex.bool(len(reflections), True), reflections.flags.centroid_outlier
)
Expand Down
1 change: 1 addition & 0 deletions src/dials/algorithms/refinement/refiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def _filter_reflections(reflections):
"shoebox",
"delpsical.weights",
"wavelength",
"wavelength_cal",
"tof",
"s0",
]
Expand Down
21 changes: 13 additions & 8 deletions src/dials/array_family/flex_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,8 +1065,7 @@ def contains_tof_data(self):

def get_pixel_bbox_centroid_positions(
self, panel: int, pixel_pos: Tuple[int, int]
) -> Tuple[list, list, list]:

) -> Tuple[list, list, list, list]:
"""
Finds any bounding boxes within px and py on panel
and returns their pz positions along with
Expand All @@ -1080,11 +1079,16 @@ def get_pixel_bbox_centroid_positions(
centroids = self["xyzobs.px.value"].select(sel)
else:
centroids = None
if "miller_index" in self:
miller_indices = self["miller_index"].select(sel)
else:
miller_indices = None
py = int(pixel_pos[0])
px = int(pixel_pos[1])
bbox_pos = []
centroid_pos = []
refl_ids = []
selected_miller_indices = []
for i in range(len(x0)):
if px >= x0[i] and px <= x1[i]:
if py >= y0[i] and py <= y1[i]:
Expand All @@ -1095,7 +1099,12 @@ def get_pixel_bbox_centroid_positions(
ci = centroids[i][2]
x, y = z0[i], z1[i]
assert ci >= x and ci <= y, f"{ci} {x} {y}"
return bbox_pos, centroid_pos, refl_ids
if miller_indices:
selected_miller_indices.append(miller_indices[i])
else:
selected_miller_indices.append((0, 0, 0))

return bbox_pos, centroid_pos, refl_ids, selected_miller_indices

def find_overlaps(self, experiments=None, border=0):
"""
Expand Down Expand Up @@ -1337,7 +1346,6 @@ def centroid_px_to_mm(self, experiments):
self["xyzobs.mm.variance"].set_selected(sel, centroid_variance)

def add_beam_data(self, experiments):

"""
Adds wavelength, tof, s0, and unit_s0 columns to self.
All experiments with a TOFSequence have values set from their time-of-flight.
Expand Down Expand Up @@ -1519,10 +1527,7 @@ def map_centroids_to_reciprocal_space(
if self.contains_beam_data():
import numpy as np

if calculated:
wavelengths = self["wavelength_cal"].select(sel)
else:
wavelengths = self["wavelength"].select(sel)
wavelengths = self["wavelength"].select(sel)
S = cctbx.array_family.flex.vec3_double(len(s1))
s1 = s1 / s1.norms()
for s1_idx in range(len(s1)):
Expand Down
2 changes: 2 additions & 0 deletions src/dials/command_line/simple_tof_integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ def run_simple_integrate(params, experiments, reflections):
)
sel = predicted_reflections.get_flags(predicted_reflections.flags.reference_spot)
predicted_reflections = predicted_reflections.select(sel)
if "idx" in reflections:
predicted_reflections["idx"] = reflections["idx"]

"""
Create profile model and add it to erperiment.
Expand Down
Loading