Skip to content

Commit

Permalink
fix: use norm instead of z-coord
Browse files Browse the repository at this point in the history
  • Loading branch information
jokasimr committed Sep 19, 2024
1 parent 0a0d008 commit 6c5d2dc
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/ess/amor/resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ def wavelength_resolution(
The angular resolution variable, as standard deviation.
"""
pixel_position = da.coords["position"]
distance_between_choppers = (
chopper_2_position.fields.z - chopper_1_position.fields.z
)
chopper_midpoint = (chopper_1_position + chopper_2_position) * sc.scalar(0.5)
chopper_detector_distance = pixel_position.fields.z - chopper_midpoint.fields.z
distance_between_choppers = sc.norm(chopper_2_position - chopper_1_position)
chopper_detector_distance = sc.norm(pixel_position - chopper_midpoint)
return WavelengthResolution(
fwhm_to_std(distance_between_choppers / chopper_detector_distance)
)
Expand Down Expand Up @@ -77,7 +75,11 @@ def sample_size_resolution(
"""
return fwhm_to_std(
sc.to_unit(sample_size, "m")
/ sc.to_unit(da.coords["position"].fields.z, "m", copy=False)
/ sc.to_unit(
sc.norm(da.coords["position"] - da.coords["sample_position"]),
"m",
copy=False,
)
)


Expand Down Expand Up @@ -109,7 +111,11 @@ def angular_resolution(
sc.to_unit(
sc.atan(
sc.to_unit(detector_spatial_resolution, "m")
/ sc.to_unit(da.coords["position"].fields.z, "m", copy=False)
/ sc.to_unit(
sc.norm(da.coords["position"] - da.coords["sample_position"]),
"m",
copy=False,
)
),
theta.bins.unit,
copy=False,
Expand Down

0 comments on commit 6c5d2dc

Please sign in to comment.