Skip to content

Commit

Permalink
Add the ability to read hdf5 files when there is no pol field
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiede committed Sep 11, 2024
1 parent 3ba678f commit 0ba2b3e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,19 @@ function load_im_h5(fname::String; polarization=false)
dx = read(header["camera"]["dx"])
nx = Int(read(header["camera"]["nx"]))
time = read(header["t"])*tunit/3600
if polarization
stokesI = collect(fid["pol"][1,:,:]')[end:-1:1,:]
stokesQ = collect(fid["pol"][2,:,:]')[end:-1:1,:]
stokesU = collect(fid["pol"][3,:,:]')[end:-1:1,:]
stokesV = collect(fid["pol"][4,:,:]')[end:-1:1,:]
image = StructArray{StokesParams{eltype(stokesI)}}((I=stokesI, Q=stokesQ, U=stokesU, V=stokesV))

if haskey(fid, "pol")
if polarization
stokesI = collect(fid["pol"][1,:,:]')[end:-1:1,:]
stokesQ = collect(fid["pol"][2,:,:]')[end:-1:1,:]
stokesU = collect(fid["pol"][3,:,:]')[end:-1:1,:]
stokesV = collect(fid["pol"][4,:,:]')[end:-1:1,:]
image = StructArray{StokesParams{eltype(stokesI)}}((I=stokesI, Q=stokesQ, U=stokesU, V=stokesV))
else
image = collect(fid["pol"][1,:,:]')[end:-1:1,:]
end
else
image = collect(fid["pol"][1,:,:]')[end:-1:1,:]
image = fid["unpol"][:,:]'[end:-1:begin, :]
end


Expand Down

0 comments on commit 0ba2b3e

Please sign in to comment.