API

Modules

    Types and constants

    Functions and macros

    Documentation

    LegendHDF5IO.LH5ArrayType
    LH5Array{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).getindexandappend!are supported.getindexessentially falls back togetindexforHDF5.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 
    [...]
    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(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.

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(ds::HDF5.Dataset, ::Type{<:AbstractArray})

    return a LH5Array with dimensions equal to that of ds and element type equal to eltype(ds) * u

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(ds::HDF5.H5DataStore, ::Type{<:AbstractArrayOfSimilarArrays{<:RealQuantity}})

    return an ArraysOfSimilarArrays where the field data is a LH5Array (see ArraysOfSimilarArrays)

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(ds::HDF5.DataStore, ::Type{<:AbstractVector{<:AbstractVector{<:RealQuantity}}})

    return a VectorOfVectors object where data is an LH5Array (see VectorOfArrays)

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(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)

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(ds::HDF5.H5DataStore, ::Type{<:AbstractEncodedArray{T, 1} where {T}})

    return an EncodedArray

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(ds::HDF5.H5DataStore, ::Type{<:VectorOfEncodedArrays{T, 1} where {T}})

    return a VectorOfEncodedArrays

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(ds::HDF5.H5DataStore, ::Type{<:VectorOfEncodedSimilarArrays{T, 1} where {T}})

    return a VectorOfEncodedSimilarArrays

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(ds::HDF5.Dataset, ::Type{<:NamedTuple{T}}) where T

    return a NamedTuple where each field is the output of LH5Array applied to it.

    source
    LegendHDF5IO.LH5ArrayMethod
    LH5Array(ds::HDF5.DataStore, ::Type{<:TypedTables.Table{<:NamedTuple{(T)}}}) where T

    return a Table where each column is the output of LH5Array applied to it.

    source
    LegendHDF5IO.LHDataStoreType
    LHDataStore <: 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.Groups and HDF5.Datasets 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
    [...]
    source
    LegendHDF5IO.add_entries!Function
    add_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.

    source
    LegendHDF5IO.add_entries!Function
    add_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.

    source
    LegendHDF5IO.delete_entry!Method
    delete_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.

    source
    LegendHDF5IO.lh5openFunction
    lh5open(f, filename::AbstractString, access::AbstractString = "r")

    Return f(lh5open(f, filename, access)).

    Opens and closes the LEGEND HDF5 file filename automatically.

    source
    LegendHDF5IO.lh5openFunction
    lh5open(filename::AbstractString, access::AbstractString = "r")

    Open a LEGEND HDF5 file and return an LHDataStore object.

    LEGEND HDF5 files typically use the file extention ".lh5".

    source