JWST

Adapted from ADASS 2024 workshop.

In this example, we show how to use ASDF.jl to load and view some astronomical data taken from the James Webb Space Telescope (JWST).

Data availability

The sample data for this example can be downloaded here from the data repository of the Space Telescope Science Institute (STScI). Note: it is a moderately large file (~100 MB).

Load

julia> fpath = let
           data_dir = joinpath("..", "..", "data")
           mkpath(data_dir)
           joinpath(data_dir, "jwst.asdf")
       end;
julia> if !isfile(fpath) using Downloads: download download("https://data.science.stsci.edu/redirect/Roman/Roman_Data_Workshop/ADASS2024/jwst.asdf", fpath) end"../../data/jwst.asdf"
julia> using ASDF
julia> af = load(fpath; extensions = true)┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:gwcs/wcs-1.2.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:gwcs/step-1.1.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:gwcs/frame2d-1.0.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/unit/unit-1.0.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/transform/compose-1.2.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/transform/property/bounding_box-1.0.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/transform/concatenate-1.2.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/transform/shift-1.2.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/transform/affine-1.3.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/transform/scale-1.2.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/transform/gnomonic-1.2.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:asdf/transform/rotate3d-1.3.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:stsci.edu:gwcs/celestial_frame-1.0.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 ┌ Warning: Unrecognized tag encountered while loading; falling back to a generic representation tag = "tag:astropy.org:astropy/coordinates/frames/icrs-1.1.0" @ ASDF ~/work/ASDF.jl/ASDF.jl/src/ASDF.jl:1481 jwst.asdf ├─ asdf_library::TaggedMapping │ ├─ author::String | The ASDF Developers │ ├─ homepage::String | http://github.com/asdf-format/asdf │ ├─ name::String | asdf │ └─ version::String | 3.2.0 ├─ history::OrderedDict │ └─ extensions::Vector{TaggedMapping} | shape = (6,) ├─ _fits_hash::String | 93cf4256596bd7a6d20913c3d0f6e1ab9d3a8647c02771c5c752b2311efd9456 ├─ data::NDArray | shape = [4159, 6353], datatype = Float32 └─ meta::OrderedDict ├─ aperture::OrderedDict │ ├─ name::String | NRCA5_FULL │ ├─ position_angle::Float64 | 251.53592358473648 │ └─ pps_name::String | NRCALL_FULL ├─ asn::OrderedDict │ ├─ exptype::String | science │ ├─ pool_name::String | jw01611_20240910t150659_pool.csv │ └─ table_name::String | jw01611-o002_20240910t150659_image3_00001_asn.json ├─ background::OrderedDict ⋮ (325) more rows

Plot

using CairoMakie

img_sci = let
    img = af["data"][]
    img[img .< 0] .= 1
    img
end

fig, ax, hm = heatmap(img_sci;
    colorrange = (1, 1e3),
    colorscale = log10,
    colormap = :cividis,
    nan_color = :limegreen, # NaNs are handled automatically
)

Colorbar(fig[1, 2], hm)

fig
Example block output