JuliaAstro / FITSIO.jl

Flexible Image Transport System (FITS) file support for Julia
http://juliaastro.org/FITSIO.jl/
MIT License
55 stars 29 forks source link

Integration with Plots.jl #90

Closed giordano closed 6 years ago

giordano commented 6 years ago

Besides integration with Images.jl, it may be useful to have integration with Plots.jl. This can be achieved with plot recipes. I recently used them in Measurements.jl, they're pretty cool. If there are WCS coordinates, they could be automatically used as tics on the axes.

mweastwood commented 6 years ago

Maybe worth waiting for glue modules? I think it would be unfortunate to have Plots.jl be a hard dependency of FITSIO.jl.

https://github.com/JuliaLang/julia/issues/2025#issuecomment-338005473

giordano commented 6 years ago

You don't have to require Plots.jl, just RecipesBase.jl, which is very lightweight, depends only on Julia.

Anyway I'm not going to implement this feature soon, this is just a proposal :-)

mweastwood commented 6 years ago

Oh ok, that's much less of an onerous dependency.

kbarbary commented 6 years ago

Sounds cool, but I think this sort of thing should go in a separate or different package. I think it is good organization to limit FITSIO.jl to (serialized FITS format on disk or in memory) <--> (arrays, tables and metadata), and have other packages depend on FITSIO for these transformations when needed. That is, it should go in a separate package for the same reason that it wouldn't go in HDF5.jl.

For plotting specifically: the FITS format happens to be able to encode array data and WCS transformations, but you might want to plot data with a WCS solution without ever serializing to FITS. Then it is pretty weird to have this functionality in FITSIO: it really only depends on arrays and WCS.jl.

In Python, plotting WCS coordinates can be done with wcsaxes which is pretty well separated from FITS I/O (and for a while, was its own separate package outside astropy).

But, a Julia package to enable plots with WCS coordinates would be awesome!

giordano commented 6 years ago

I think this sort of thing should go in a separate or different package

I agree. I just wanted to propose a new feature related to this package ;-)

the FITS format happens to be able to encode array data and WCS transformations, but you might want to plot data with a WCS solution without ever serializing to FITS.

You mean that one may want to do something like

plot(::Matrix, ::WCSTransform)

? This should be fairly easy to accomplish with a recipe like

@recipe function f(A::Matrix, wcs::WCSTransform)
...
end

Yesterday another plotting package joined the game: https://discourse.julialang.org/t/prerelease-makie-interactive-plotting/6811. The situation currently is very fluid with regard to plotting in Julia, but if MakiE.jl will ever take over Plots.jl there is the possibility that plot recipes for the current Plots.jl will still work in the future

giordano commented 6 years ago

I've just created the package AstroImages.jl, which should provide integration of astronomical images with popular images and plotting packages. This is very basic, at the moment it provides only a FileIO.load method to read an extension from a FITS file and a new type, AstroImage, to convert the extension to Matrix{Gray}.

I'm going to close this issue in favor of https://github.com/JuliaAstro/AstroImages.jl/issues/2