aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2024-02-02 15:10:12 +0100
committerThomas White <taw@physics.org>2024-02-06 16:59:35 +0100
commit85da29bd648334ddac81537c6309fefab68547a4 (patch)
tree1e17d7dfb520de25b91b3cb09ce4a956ee86d981
parentc1cd21679686f59d8f3533145108118419b40356 (diff)
Julia: Add 'rotategroup!'
-rw-r--r--julia/CrystFEL/src/CrystFEL.jl3
-rw-r--r--julia/CrystFEL/src/datatemplates.jl21
2 files changed, 22 insertions, 2 deletions
diff --git a/julia/CrystFEL/src/CrystFEL.jl b/julia/CrystFEL/src/CrystFEL.jl
index 86637014..91af5d19 100644
--- a/julia/CrystFEL/src/CrystFEL.jl
+++ b/julia/CrystFEL/src/CrystFEL.jl
@@ -46,7 +46,8 @@ export SymOpList, asymmetricindices
include("datatemplates.jl")
using .DataTemplates
-export DataTemplate, loaddatatemplate, wavelength, cameralength, translategroup!
+export DataTemplate, loaddatatemplate, wavelength, cameralength
+export translategroup!, rotategroup!
include("peaklist.jl")
using .PeakLists
diff --git a/julia/CrystFEL/src/datatemplates.jl b/julia/CrystFEL/src/datatemplates.jl
index 7ede6843..9632346e 100644
--- a/julia/CrystFEL/src/datatemplates.jl
+++ b/julia/CrystFEL/src/datatemplates.jl
@@ -3,7 +3,7 @@ module DataTemplates
import ..CrystFEL: libcrystfel
export DataTemplate, InternalDataTemplate, loaddatatemplate
export wavelength, cameralength
-export translategroup!
+export translategroup!, rotategroup!
# Represents the real C-side (opaque) structure.
mutable struct InternalDataTemplate end
@@ -105,4 +105,23 @@ function translategroup!(dtempl::DataTemplate, groupname, xshift, yshift, zshift
end
+"""
+ rotategroup!(datatemplate, groupname, angle, axis)
+
+Modifies `DataTemplate` by rotating the specified panel group by the specified
+amount (in degrees) about the specified xaxis (:x, :y or :z).
+
+Corresponds to CrystFEL C API function `data_template_rotate_group`.
+"""
+function rotategroup!(dtempl::DataTemplate, groupname, angle, axis)
+ r = @ccall libcrystfel.data_template_rotate_group(dtempl.internalptr::Ptr{InternalDataTemplate},
+ groupname::Cstring,
+ deg2rad(angle)::Cdouble,
+ String(axis)[1]::Cchar)::Cint
+ if r != 0
+ throw(ErrorException("Failed to rotate DataTemplate"))
+ end
+
+end
+
end # of module