diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..7f2b79a --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,31 @@ +name: Documentation + +on: + push: + branches: [master] + tags: '*' + pull_request: + +jobs: + build: + # These permissions are needed to: + # - Deploy the documentation: https://documenter.juliadocs.org/stable/man/hosting/#Permissions + # - Delete old caches: https://github.com/julia-actions/cache#usage + permissions: + actions: write + contents: write + pull-requests: read + statuses: write + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: '1' + show-versioninfo: true + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-docdeploy@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index f65b967..88a7e65 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ *.jl.cov *.jl.mem .DS_Store -/Manifest.toml +Manifest.toml /test/data/ +docs/build/ diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..d60b2e7 --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,9 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Reproject = "d1dcc2e6-806e-11e9-2897-3f99785db2ae" + +[compat] +Documenter = "1" + +[sources] +Reproject = {path = ".."} diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..25a1350 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,18 @@ +using Documenter +using Reproject + +makedocs(; + sitename = "Reproject.jl", + modules = [Reproject], + authors = "Mosè Giordano, Rohit Kumar", + format = Documenter.HTML(), + pages = [ + "index.md", + "api-reference.md", + ], +) + +deploydocs(; + repo = "github.com/JuliaAstro/Reproject.jl.git", + push_preview = true +) diff --git a/docs/src/api-reference.md b/docs/src/api-reference.md new file mode 100644 index 0000000..d46417a --- /dev/null +++ b/docs/src/api-reference.md @@ -0,0 +1,5 @@ +# API Reference + +```@autodocs +Modules = [Reproject] +``` diff --git a/docs/src/assets/input.png b/docs/src/assets/input.png new file mode 100644 index 0000000..e79235d Binary files /dev/null and b/docs/src/assets/input.png differ diff --git a/docs/src/assets/output.png b/docs/src/assets/output.png new file mode 100644 index 0000000..c26e7e5 Binary files /dev/null and b/docs/src/assets/output.png differ diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..0256650 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,78 @@ +# Reproject + +Implementation in [Julia](https://julialang.org/) of the +[`reproject`](https://github.com/astropy/reproject) package by Thomas +Robitaille, part of the Astropy project. + +This package can be used to reproject Astronomical Images from one world coordinate to another. By reproject we mean re-gridding of images using interpolation (i.e changing the pixel resolution, orientation, coordinate system). + +Installation +------- + +Reproject.jl is avilable for Julia 1.0 and later versions and can be installed with [Julia built-in package manager](https://docs.julialang.org/en/v1/stdlib/Pkg/). + +```julia-repl +julia> import Pkg; Pkg.add("Reproject") +``` + +Usage +------- + +After installing the package, you can start using it with + +```julia-repl +julia> using Reproject + +julia> result = reproject(input_data, output_projection) +``` + +This returns a tuple of reprojected Image and footprint. + + +Reprojecting Images +------- + +To reproject Astronomical Images, primary requirements are Image data (2D Matrix), world cordinate frame of input Image and required output frame in which it needs to be reprojected. + +The Image data and input frame is given together as an [ImageHDU](http://juliaastro.github.io/FITSIO.jl/latest/index.html) or [FITS](https://github.com/JuliaAstro/FITSIO.jl) file or name of the FITS file in `input_data`. A keyword argument `hdu_in` can be given while using FITS or FITS file name to specify specific HDU in FITS file. + +The `output_projection` is the output world coordinate frame and needs to be a a [WCSTransform](https://github.com/JuliaAstro/WCS.jl) or an [ImageHDU](http://juliaastro.github.io/FITSIO.jl/latest/index.html) or [FITS](https://github.com/JuliaAstro/FITSIO.jl) file or name of the FITS file. A keyword argument `hdu_out` can be given while using FITS or FITS file name to specify specific HDU in FITS file. +WCS information is extracted from header when ImageHDU or FITS file is given as `output_projection`. + +Order of Interpolation can be specified by keyword `order` (i.e 0, 1(default), 2). +The dimensions of output Image can be given by keyword `shape_out`. This can be used to change resolution. + + +Example +------- +```julia-repl +julia> using Reproject, FITSIO + +julia> input_data = FITS("gc_msx_e.fits") + +julia> output_projection = FITS("gc_2mass_k.fits") + +julia> result = reproject(input_data, output_projection, shape_out = (1000,1000), order = 2, hdu_in = 1, hdu_out = 1) +``` +**Input Image:** + +![community](assets/input.png) + +**Output:** + +![community](assets/output.png) + +Test files can be obtained from [here](https://www.astropy.org/astropy-data/). + +Related Packages +------- +Check out [AstroImages.jl](https://github.com/JuliaAstro/AstroImages.jl), which use this package to form coloured RGB image from 2D CCD Astromonical Images. + +License +------- + +The `reproject` package is released under the terms of the BSD 3-Clause "New" or +"Revised" License. The `Reproject.jl` package received written permission to be +released under the MIT "Expat" License. + +The authors of this package are [aquatiko](https://github.com/aquatiko) and [giordano](https://github.com/giordano).