diff --git a/docs/src/manual/dimensions-and-world-coordinates.md b/docs/src/manual/dimensions-and-world-coordinates.md index 4c4298ac..ed18f8b1 100644 --- a/docs/src/manual/dimensions-and-world-coordinates.md +++ b/docs/src/manual/dimensions-and-world-coordinates.md @@ -86,6 +86,9 @@ plot( World coordinate queries from that slice are aware of their position in the parent image: ```@example coords @show pix_to_world(slice1, [1,1]) +``` + +```@example coords @show pix_to_world(slice2, [1,1]) ``` @@ -100,15 +103,15 @@ Each dimension of an AstroImage is named. The automatic dimension names are `X`, `Y`, `Z`, `Dim{4}`, `Dim{5}`, and so on; however you can pass in other names or orders to the load function and/or AstroImage contructor: -```julia -julia> img = load("eagle-656nmos.fits",1,(Y,Z)) +```julia-repl +julia> img = load("eagle-656nmos.fits", 1, (Y,Z)) 1600×1600 AstroImage{Float32,2} with dimensions: Y Sampled 1:1600 ForwardOrdered Regular Points, Z Sampled 1:1600 ForwardOrdered Regular Points ``` Other useful dimension names are `Spec` for spectral axes, `Pol` for polarization data, and `Ti` for time axes. -These are tracked the same was as the automatic dimension names and interact smoothly with any WCS headers. -You can give an arbitrary name using as a `Dim{Symbol}`, e.g. `Dim{:Velocity}`. +These are tracked the same way as the automatic dimension names and interact smoothly with any WCS headers. +You can give a dimension an arbitrary name using `Dim{Symbol}`, e.g., `Dim{:Velocity}`. You can access AstroImages using dimension names: ```@example coords @@ -161,7 +164,7 @@ implot(HIcube[Y=45], cmap=:turbo, aspectratio=0.3) ## Custom Dimensions -```julia +```julia-repl julia> img = load("img.fits",1,(Y=1:1600,Z=1:1600)) 1600×1600 AstroImage{Float32,2} with dimensions: Y Sampled 1:1600 ForwardOrdered Regular Points, @@ -173,7 +176,7 @@ These are tracked the same was as the automatic dimension names and interact smo Often times we have images or cubes that we want to index with physical coordinates where setting up a full WCS transform is overkill. In these cases, it's easier to leverage custom dimensions. For example, one may wish to -```julia +```julia-repl julia> img = load("img.fits",1,(X=801:2400,Y=1:2:3200)) 1600×1600 AstroImage{Float32,2} with dimensions: X Sampled 801:2400 ForwardOrdered Regular Points, @@ -183,7 +186,7 @@ julia> img = load("img.fits",1,(X=801:2400,Y=1:2:3200)) Unlike OffsetArrays, the usual indexing remains so `img[1,1]` is still the bottom left of the image; however, data can be looked up according to the offset dimensions using specifiers: -```julia +```julia-repl julia> img[X=Near(2000),Y=1..100] 50-element AstroImage{Float32,1} with dimensions: Y Sampled 1:2:99 ForwardOrdered Regular Points @@ -198,7 +201,7 @@ You can adjust the center of an image's dimensions using [`recenter`](@ref recen eagle_cen = recenter(eagle, 801, 801); ``` -Unlike an OffsetArray, `eagle_cen[1,1]` still refers to the bottom left of the image. This also has no effect on broadcasting, `eagle_cen .+ ones(1600,1600)` is perfectly valid. +Unlike an OffsetArray, `eagle_cen[1,1]` still refers to the bottom left of the image. This also has no effect on broadcasting; `eagle_cen .+ ones(1600,1600)` is perfectly valid. However, we see the new centered dimensions when we go to plot the image: ```@example coords implot(eagle_cen, wcsticks=false) diff --git a/docs/src/manual/loading-images.md b/docs/src/manual/loading-images.md index edb3d9a4..24a06c70 100644 --- a/docs/src/manual/loading-images.md +++ b/docs/src/manual/loading-images.md @@ -9,7 +9,7 @@ FileIO will import AstroImages automatically. Alternatively, you can use the `AstroImage` contructor instead of load. This will work on fits files with any file extension, including compressed files (e.g. ".fits.gz"). -```julia +```julia-repl julia> img = load("myfitsimg.fits") 1600×1600 AstroImage{Float32,2} with dimensions: X Sampled Base.OneTo(1600) ForwardOrdered Regular Points, @@ -29,7 +29,7 @@ rendered to images and displayed. You can see this plain text output by explicit `show(stdout, MIME("text/plain"), img)`. Or: -```julia +```julia-repl julia> img = AstroImage("myfitsimg.fits.gz") 1600×1600 AstroImage{Float32,2} with dimensions: X Sampled Base.OneTo(1600) ForwardOrdered Regular Points, @@ -49,7 +49,7 @@ When you call load or AstroImage with a file name and no other arguments, the pa and return the first image HDU. That is, it will skip any FITS tables or empty HDUs with only headers. You can also specify an HDU number explicitly: -```julia +```julia-repl julia> img = load("myfitsimg.fits",1) 1600×1600 AstroImage{Float32,2} with dimensions: X Sampled Base.OneTo(1600) ForwardOrdered Regular Points, @@ -60,7 +60,7 @@ This way, you can load specific images from multi-extension files. You can load all HDUs simultaneously by passing `:`: -```julia +```julia-repl julia> hdus = load("multiext.fits", :); julia> hdus[2] # Second HDU as an AstroImage 10×10 AstroImage{Float64,2} with dimensions: @@ -95,8 +95,8 @@ AstroImages are based on [Dimensional Data](https://github.com/rafaqz/Dimensiona and the indices are tracked. The automatic dimension names are `X`, `Y`, `Z`, `Dim{4}`, `Dim{5}`, and so on; however you can pass in other names or orders to the load function and/or AstroImage contructor: -```julia -julia> img = load("img.fits",1,(Y=1:1600,Z=1:1600)) +```julia-repl +julia> img = load("img.fits", 1, (Y=1:1600,Z=1:1600)) 1600×1600 AstroImage{Float32,2} with dimensions: Y Sampled 1:1600 ForwardOrdered Regular Points, Z Sampled 1:1600 ForwardOrdered Regular Points @@ -109,17 +109,17 @@ These will be further discussed in Dimensions and World Coordinates. ## Saving Images You can save one or more AstroImages and tables to a FITS file using the `save` function: -```julia +```julia-repl julia> save("abc.fits", astroimage1, astroimage2, table1) ``` You can also save individual images to traditional graphics formats by first rendering them with `imview` (for more on imview, see Displaying Images). -```julia +```julia-repl julia> save("abc.png", imview(astroimage1)) ``` You can save animated GIFs by saving a 3D datacube that has been rendered with imview: -```julia +```julia-repl julia> cube = imview(AstroImage(randn(100,100,10))); julia> save("abc.gif", cube, fps=10)