diff options
author | Thomas White <taw@physics.org> | 2024-01-19 14:09:11 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-02-06 16:59:35 +0100 |
commit | 93a6a827f115f27ed9e148aa635ec9400ffa700d (patch) | |
tree | e928a99fb3ffea887827e8e1b6ec2104af4af7c6 /julia/CrystFEL | |
parent | 9a907d58a931472eb1178c42bfa1e7629e30ab00 (diff) |
Julia: add translategroup() (and use it)
Diffstat (limited to 'julia/CrystFEL')
-rw-r--r-- | julia/CrystFEL/src/CrystFEL.jl | 2 | ||||
-rw-r--r-- | julia/CrystFEL/src/datatemplates.jl | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/julia/CrystFEL/src/CrystFEL.jl b/julia/CrystFEL/src/CrystFEL.jl index 27ee8b0b..63b636b1 100644 --- a/julia/CrystFEL/src/CrystFEL.jl +++ b/julia/CrystFEL/src/CrystFEL.jl @@ -46,7 +46,7 @@ export SymOpList include("datatemplates.jl") using .DataTemplates -export DataTemplate, loaddatatemplate, wavelength, cameralength +export DataTemplate, loaddatatemplate, wavelength, cameralength, translategroup include("peaklist.jl") using .PeakLists diff --git a/julia/CrystFEL/src/datatemplates.jl b/julia/CrystFEL/src/datatemplates.jl index 16433d9f..b76a272e 100644 --- a/julia/CrystFEL/src/datatemplates.jl +++ b/julia/CrystFEL/src/datatemplates.jl @@ -3,6 +3,7 @@ module DataTemplates import ..CrystFEL: libcrystfel export DataTemplate, InternalDataTemplate, loaddatatemplate export wavelength, cameralength +export translategroup # Represents the real C-side (opaque) structure. mutable struct InternalDataTemplate end @@ -83,4 +84,25 @@ function cameralength(dtempl::DataTemplate) end +""" + translategroup(datatemplate, groupname, xshift, yshift, zshift) + +Modifies `DataTemplate` by moving the specified panel group by the specified +amount (in metres). + +Corresponds to CrystFEL C API function `data_template_translate_group`. +""" +function translategroup(dtempl::DataTemplate, groupname, xshift, yshift, zshift) + r = @ccall libcrystfel.data_template_translate_group_m(dtempl.internalptr::Ptr{InternalDataTemplate}, + groupname::Cstring, + xshift::Cdouble, + yshift::Cdouble, + zshift::Cdouble)::Cint + if r != 0 + throw(ErrorException("Failed to shift DataTemplate")) + end + +end + + end # of module |