aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-11-15 11:25:25 +0100
committerThomas White <taw@physics.org>2024-02-06 16:59:34 +0100
commitc752752fc4b7d477a8284a41c948b29e9bbe53e5 (patch)
treeef400080b81b763d6f274358f27e7bdc0d81af0f
parent7513e4e2849a7a6c03bd5075ad579c2167c41ff5 (diff)
Show method for PeakList
-rw-r--r--julia/CrystFEL/src/peaklist.jl19
1 files changed, 19 insertions, 0 deletions
diff --git a/julia/CrystFEL/src/peaklist.jl b/julia/CrystFEL/src/peaklist.jl
index 4814437f..0ca1fa4d 100644
--- a/julia/CrystFEL/src/peaklist.jl
+++ b/julia/CrystFEL/src/peaklist.jl
@@ -1,5 +1,6 @@
module PeakLists
+using Printf
import ..CrystFEL: libcrystfel
export PeakList, InternalPeakList
@@ -79,4 +80,22 @@ function Base.iterate(peaklist::PeakList, state)
end
+function Base.show(io::IO, ::MIME"text/plain", peaklist::PeakList)
+ println(io, "Peak list with ", length(peaklist), " peaks")
+ print(io, " fs ss panel intensity name")
+ let n = 0
+ for pk in Iterators.take(peaklist, 11)
+ if n == 10
+ # We have printed 10 already, and are here again. Truncate...
+ print(io, "\n ⋮ ⋮ ⋮ ⋮ ⋮")
+ break
+ end
+ write(io, "\n")
+ @printf(io, "%7.2f %7.2f %6i %10.2f %s",
+ pk.fs, pk.ss, pk.panelnumber, pk.intensity, pk.name)
+ n += 1
+ end
+ end
+end
+
end # of module