API
Modules
Types and constants
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LH5Array
LegendHDF5IO.LHDataStore
Functions and macros
LegendHDF5IO.add_entries!
LegendHDF5IO.add_entries!
LegendHDF5IO.delete_entry!
LegendHDF5IO.lh5open
LegendHDF5IO.lh5open
Documentation
LegendHDF5IO.LH5Array
— TypeLH5Array{T, N} <: AbstractArray{T, N}
Array wrapper for HDF5.Datasets following the LEGEND data format as in ".lh5" files.
An LH5Array
contains a HDF5.Dataset file
and Unitful.Unitlike units
as returned by getunits
(file).
getindexand
append!are supported.
getindexessentially falls back to
getindexfor
HDF5.Datasets, enabling the user to always read in the desired part of an ondisk array without having to load it in whole beforehand.
append!` uses chunks to append the data provided to the ondisk array. It is important to note, that data is always appended along the last dimension of an array
Default constructors
LH5Array{T}(ds::HDF5.Dataset, u::Unitful.Unitlike)
LH5Array{T, N}(ds::HDF5.Dataset)
LH5Array(ds::Union{HDF5.Dataset, HDF5.H5DataStore})
Examples:
julia> using HDF5
julia> f = h5open("path/to/lh5/file", "r")
julia> l5 = LH5Array(f["path/to/HDF5/Dataset"])
[...]
julia> x = lh[1:10] # load the first 10 elements of the ondisk array
[...]
julia> append!(lh, x) # append those 10 elements to the ondisk array
[...]
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.Dataset, ::Type{<:AbstractArray{<:Bool}}) = begin
return a LH5Array
with dimensions equal to that of ds
and element type Bool
. Applying getindex!
on LH5Array{Bool}
will yield a BitArray.
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.Dataset, ::Type{<:AbstractArray{<:Tuple}})
return an Array of NTuples
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.Dataset, ::Type{<:AbstractArray})
return a LH5Array
with dimensions equal to that of ds
and element type equal to eltype(ds) * u
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.H5DataStore, ::Type{<:AbstractArrayOfSimilarArrays{<:RealQuantity}})
return an ArraysOfSimilarArrays
where the field data
is a LH5Array
(see ArraysOfSimilarArrays
)
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.H5DataStore, ::Type{<:Bool}) = begin
return a value with type Bool
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.Dataset, ::Type{<:String})
return a String
.
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.Dataset, ::Type{<:Symbol})
return a Symbol
.
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.Dataset, ::Type{<:Tuple})
return an Tuple
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.Dataset, ::Type{<:RealQuantity})
return a value with type RealQuantity
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.DataStore, ::Type{<:AbstractVector{<:AbstractVector{<:RealQuantity}}})
return a VectorOfVectors
object where data
is an LH5Array
(see VectorOfArrays
)
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.DataStore, ::Type{<:AbstractVector{<:RDWaveform}})
return an ArrayOfRDWaveforms
where the field signal
is either a VectorOfSimilarVectors
with an LH5Array
as data
or VectorOfVectors
with an LH5Array
as data
(see ArrayOfRDWaveforms
and ArraysOfArrays
)
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.H5DataStore, ::Type{<:AbstractEncodedArray{T, 1} where {T}})
return an EncodedArray
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.H5DataStore, ::Type{<:VectorOfEncodedArrays{T, 1} where {T}})
return a VectorOfEncodedArrays
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.H5DataStore, ::Type{<:VectorOfEncodedSimilarArrays{T, 1} where {T}})
return a VectorOfEncodedSimilarArrays
LegendHDF5IO.LH5Array
— Method" LH5Array(ds::HDF5.H5DataStore, ::Type{<:Histogram{<:RealQuantity}})
return a Histogram
.
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.Dataset, ::Type{<:NamedTuple{T}}) where T
return a NamedTuple
where each field
is the output of LH5Array
applied to it.
LegendHDF5IO.LH5Array
— MethodLH5Array(ds::HDF5.DataStore, ::Type{<:TypedTables.Table{<:NamedTuple{(T)}}}) where T
return a Table
where each column is the output of LH5Array
applied to it.
LegendHDF5IO.LHDataStore
— TypeLHDataStore <: AbstractDict{String,Any}
Dictionary wrapper for HDF5.H5DataStore
objects, which were constructed according to the LEGEND data format in ".lh5" files.
Constructor:
LHDataStore(h5ds::HDF5.DataStore)
This return an LHDataStore
object that wraps an h5ds
which will typically be an HDF5.File
be may also be an HDF5.H5DataStore
(e.g. an HDF5.Group
). in general.
To read or write ".lh5" file directly (without using HDF5.h5open
first), we recommend using lh5open
.
Supports getindex
and setindex!
where getindex(lh::LHDataStore, s)
returns the output of LH5Array
applied to data_store[s]
and setindex!
creates and writes HDF5.Group
s and HDF5.Dataset
s using chunks of size 1000 to the ondisk array. Currently supported are objects with types: AbstractArray{<:RealQuantity}
, ArraysOfSimilarArrays{<:RealQuantity}
, VectorOfVectors{<:RealQuantity}
, NamedTuple
,TypedTables.Table
, Vector{<:RDWaveform}
. For AbstractArray{<:RealQuantity}
It is assumed that the last axis of the provided array corresponds to the event number index.
Example
julia> using HDF5
julia> h5ds = h5open("path/to/lhf/file")
julia> lhf = LHDataStore(h5ds)
julia> lhf["raw"]
[...]
julia> using Unitful
julia> x = rand(100) * u"ns"
julia> lhf["new"] = x
[...]
LegendHDF5IO.add_entries!
— Functionadd_entries!(lhd::LHDataStore, i::AbstractString, src::TypedTable.Table,
dest::TypedTable.Table=LH5Array(lhd.data_store[i]))
extend the Table dest
at lhd[i]
with columns from src
.
LegendHDF5IO.add_entries!
— Functionadd_entries!(lhd::LHDataStore, i::AbstractString, src::NamedTuple,
dest::NamedTuple=LH5Array(lhd.data_store[i]))
extend the NamedTuple dest
at lhd[i]
with elements from src
.
LegendHDF5IO.delete_entry!
— Methoddelete_entry!(lhd::LHDataStore, i::AbstractString)
remove the dataset lhd[i]
and adjust the datatype of the parent if necessary. Currently supported are elements of NamedTuple
, TypedTable.Table
or HDF5.Group
.
LegendHDF5IO.lh5open
— Functionlh5open(f, filename::AbstractString, access::AbstractString = "r")
Return f(lh5open(f, filename, access)).
Opens and closes the LEGEND HDF5 file filename
automatically.
LegendHDF5IO.lh5open
— Functionlh5open(filename::AbstractString, access::AbstractString = "r")
Open a LEGEND HDF5 file and return an LHDataStore
object.
LEGEND HDF5 files typically use the file extention ".lh5".