Roman
Adapted from STScI Roman Notebooks.
In this example, we show how to use ASDF.jl to load and view some simulated astronomical data created in preparation for the future (Nancy Grace Roman Space Telescope) mission.
Simulated data products are currently provided by STScI via AWS S3 buckets. Note: The data product used for this example is a moderately large file (~300 MB).
Load
julia> fpath = let data_dir = joinpath("..", "..", "data") mkpath(data_dir) joinpath(data_dir, "roman.asdf") end;julia> if !isfile(fpath) using AWSS3, AWS aws_config = AWS.AWSConfig(; creds = nothing, region = "us-east-1") AWSConfig(nothing, "us-east-1", "json", 3) # This is a large file, will take some time to download s3_get_file( aws_config, "stpubdata", "roman/nexus/soc_simulations/tutorial_data/r0003201001001001004_0001_wfi01_f106_cal.asdf", fpath ) end
julia> using ASDFjulia> af = load(fpath; extensions = true, validate_checksum = false)roman.asdf ├─ asdf_library::String │ ├─ author::String | The ASDF Developers │ ├─ homepage::String | http://github.com/asdf-format/asdf │ ├─ name::String | asdf │ └─ version::String | 4.1.0 ├─ history::String │ └─ extensions::Vector{OrderedCollections.OrderedDict{Any, Any}} | shape = (7,) └─ roman::String ├─ amp33::ASDF.NDArray | shape = [5, 4096, 128] ├─ border_ref_pix_bottom::ASDF.NDArray | shape = [5, 4, 4096] ├─ border_ref_pix_left::ASDF.NDArray | shape = [5, 4096, 4] ├─ border_ref_pix_right::ASDF.NDArray | shape = [5, 4096, 4] ├─ border_ref_pix_top::ASDF.NDArray | shape = [5, 4, 4096] ├─ data::ASDF.NDArray | shape = [4088, 4088] ├─ dq::ASDF.NDArray | shape = [4088, 4088] ├─ dq_border_ref_pix_bottom::ASDF.NDArray | shape = [4, 4096] ├─ dq_border_ref_pix_left::ASDF.NDArray | shape = [4096, 4] ├─ dq_border_ref_pix_right::ASDF.NDArray | shape = [4096, 4] ├─ dq_border_ref_pix_top::ASDF.NDArray | shape = [4, 4096] ⋮ (198) more rows
Plot
using CairoMakie
img = af["roman"]["data"][]
fig, ax, hm = heatmap(img[begin:1000, begin:1000]; colorscale = asinh, colorrange = (0.5, 4))
Colorbar(fig[1, 2], hm)
fig
Some ASDF files produced by the Python implementation of ASDF may save a checksum in its header block computed from the original decompressed file. This will cause ASDF.jl to fail because in constrast, it computes the checksum based on the compressed (i.e., "used data"), as per the current specification for ASDF. To handle this potenial failure mode, we pass validate_checksum = false to avoid running the default checksum.