Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
oschulz committed May 24, 2024
2 parents 006a6dd + 1100b3d commit 545dc81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ return a VectorOfEncodedArrays
LH5Array(ds::HDF5.H5DataStore, ::Type{<:VectorOfEncodedArrays{T, 1} where {T}}
) = begin

data_vec::VectorOfVectors{UInt8, Vector{UInt8}} = LH5Array(
ds["encoded_data"])[:]
data_vec = LH5Array(
ds["encoded_data"])
size_vec::Vector{NTuple{1, Int64}} = LH5Array(ds["decoded_size"])
U = haskey(ds, "sample_data") ? eltype(ds["sample_data"]) : Int32
codec_name = Symbol(getattribute(ds, :codec, String))
Expand All @@ -232,8 +232,8 @@ return a VectorOfEncodedSimilarArrays
LH5Array(ds::HDF5.H5DataStore,
::Type{<:VectorOfEncodedSimilarArrays{T, 1} where {T}}) = begin

data::VectorOfVectors{UInt8, Vector{UInt8}} = LH5Array(
ds["encoded_data"])[:]
data = LH5Array(
ds["encoded_data"])
innersize::NTuple{1, Int64} = (LH5Array(ds["decoded_size"]),)
U = haskey(ds, "sample_data") ? eltype(ds["sample_data"]) : Int32
codec_name = Symbol(getattribute(ds, :codec, String))
Expand Down Expand Up @@ -263,9 +263,6 @@ Base.getindex(lh::LH5AoSA{T, M}, idxs::LHIndexType...) where {T, M} = begin
ArrayOfSimilarArrays{T, M}(lh.data[indices...])
end

Base.getindex(lh::LH5ArrayOfRDWaveforms, idxs::LHIndexType...) =
ArrayOfRDWaveforms((lh.time[idxs...], lh.signal[idxs...]))

_inv_element_ptrs(el_ptr::AbstractVector{<:Int}) = UInt32.(el_ptr .- 1)[2:end]

Base.size(lh::LH5Array{T, N}) where {T, N} = begin
Expand Down
4 changes: 2 additions & 2 deletions test/test_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ using LegendDataManagement
vofvec = VectorOfVectors(data)
vofvec_enc = broadcast(|>, vofvec, codec)
@test setindex!(lhd, vofvec_enc, "vofvec_enc") |> isnothing
@test lhd["vofvec_enc"] == vofvec_enc
@test lhd["vofvec_enc"][:] == vofvec_enc
end
@testset "IO of VectorOfEncodedSimilarArrays" begin
codec = VarlenDiffArrayCodec()
data = [rand(-5:5, 100) for _ in 1:50]
vofsimvec = VectorOfSimilarVectors(data)
vofsimvec_enc = broadcast(|>, vofsimvec, codec)
@test setindex!(lhd, vofsimvec_enc, "vofsimvec_enc") |> isnothing
@test lhd["vofsimvec_enc"] == vofsimvec_enc
@test lhd["vofsimvec_enc"][:] == vofsimvec_enc
end
@testset "IO of ArrayOfRDWaveforms" begin
data = nestedview(rand(UInt16, 50, 50)*u"m")
Expand Down

0 comments on commit 545dc81

Please sign in to comment.