diff options
author | Thomas White <taw@physics.org> | 2024-02-07 14:50:00 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-02-07 14:50:00 +0100 |
commit | a4d8e53aa1969565c288b93ad36d1a7030ad19a3 (patch) | |
tree | 6462fd2e05d1e63d2e8e66e9e4ae8b08a7a9e081 /julia/CrystFEL | |
parent | bf126681d49c198dcec0e70e470a22d26dc31d55 (diff) |
Julia: Add allcrystals()
Diffstat (limited to 'julia/CrystFEL')
-rw-r--r-- | julia/CrystFEL/src/CrystFEL.jl | 2 | ||||
-rw-r--r-- | julia/CrystFEL/src/streams.jl | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/julia/CrystFEL/src/CrystFEL.jl b/julia/CrystFEL/src/CrystFEL.jl index 95b2a61d..5ecfab91 100644 --- a/julia/CrystFEL/src/CrystFEL.jl +++ b/julia/CrystFEL/src/CrystFEL.jl @@ -77,7 +77,7 @@ export Indexer, index include("streams.jl") using .Streams -export Stream, chunkwrite, chunkread +export Stream, chunkwrite, chunkread, allcrystals include("millepede.jl") using .Millepede diff --git a/julia/CrystFEL/src/streams.jl b/julia/CrystFEL/src/streams.jl index d5c86464..798663e1 100644 --- a/julia/CrystFEL/src/streams.jl +++ b/julia/CrystFEL/src/streams.jl @@ -3,7 +3,7 @@ module Streams import ..CrystFEL: libcrystfel import ..CrystFEL.DataTemplates: DataTemplate, InternalDataTemplate import ..CrystFEL.Images: Image, InternalImage -export Stream, chunkwrite, chunkread +export Stream, chunkwrite, chunkread, allcrystals # Represents the real C-side (opaque) structure. mutable struct InternalStream end @@ -122,4 +122,17 @@ function chunkread(st::Stream; peaks=true, reflections=true) end +function allcrystals(st) + Channel() do ch + while true + image = chunkread(st) + image === nothing && break + for cr in image.crystals + put!(ch, (cr.crystal, cr.reflections)) + end + end + end +end + + end # of module |