ptiede / VIDA.jl

EHT Image domain analysis through template matching.
MIT License
13 stars 4 forks source link

Polarization support for movies #80

Open rohandahale opened 1 month ago

rohandahale commented 1 month ago

Both load_hdf5 and get_image both work only with IntensityMap / Stokes I instead of StokesIntensityMap. It would be great if VIDAMovie can work with polarization as well. Currently the only way is to split the movie in polarized .fits and then load them.

ptiede commented 1 month ago

So StokesIntensityMap is a internal hack for Zygote and is not considered part of the public API. That being said we can totally add polarization loading for hdf5 into VIDA.

I think standard fits loading just calls into ComradeBase so polarization is already handled.

Also we may want to separate this functionality into something like @aplavin VLBIData.jl since I don't think VIDA should own this stuff.

ptiede commented 1 month ago

Oh nevermind I forgot that I added polarization support to the hdf5 image loading a few months ago so this should just work.

If you do load_image(fname; polarization=true) you should be fine.

rohandahale commented 1 month ago

Oh that is great! But I think I am not using it correctly I think because load_image(fname; polarization=true) gives me a header error as it is looking for "dsource" even though the movie was created with ehtim.

julia> load_image("SGRA_LO_ehtim.hdf5"; polarization=true)
ERROR: KeyError: key "dsource" not found
Stacktrace:
  [1] getindex(dset::HDF5.Dataset, name::String)
    @ HDF5 ~/.julia/packages/HDF5/Z859u/src/attributes.jl:403
  [2] (::VIDA.var"#8#9"{Bool})(fid::HDF5.File)
    @ VIDA ~/.julia/packages/VIDA/qIbLv/src/io.jl:45
  [3] (::HDF5.var"#17#18"{HDF5.HDF5Context, @Kwargs{}, VIDA.var"#8#9"{Bool}, HDF5.File})()
    @ HDF5 ~/.julia/packages/HDF5/Z859u/src/file.jl:101
  [4] task_local_storage(body::HDF5.var"#17#18"{HDF5.HDF5Context, @Kwargs{}, VIDA.var"#8#9"{Bool}, HDF5.File}, key::Symbol, val::HDF5.HDF5Context)
    @ Base ./task.jl:297
  [5] #h5open#16
    @ ~/.julia/packages/HDF5/Z859u/src/file.jl:96 [inlined]
  [6] h5open
    @ ~/.julia/packages/HDF5/Z859u/src/file.jl:94 [inlined]
  [7] #load_im_h5#7
    @ ~/.julia/packages/VIDA/qIbLv/src/io.jl:43 [inlined]
  [8] load_im_h5
    @ ~/.julia/packages/VIDA/qIbLv/src/io.jl:42 [inlined]
  [9] load_image(fname::String; polarization::Bool)
    @ VIDA ~/.julia/packages/VIDA/qIbLv/src/io.jl:25
 [10] top-level scope
    @ REPL[11]:1
ptiede commented 1 day ago

Ok that's because this is a movie. To get this to work, I would need the actual movie you are reading in.

rohandahale commented 15 hours ago

Here is the link to the actual movie (It is large so I cannot directly attach here): Link