Macro mwalib::get_required_fits_key
source · macro_rules! get_required_fits_key { ($fptr:expr, $hdu:expr, $keyword:expr) => { ... }; }
Expand description
Given a FITS file pointer, a HDU that belongs to it, and a keyword, pull out the value of the keyword, parsing it into the desired type.
§Arguments
-
fits_fptr
- A reference to theFITSFile
object. -
hdu
- A reference to the HDU you want to findkeyword
in the header of. -
keyword
- String containing the keyword to read.
§Returns
- A Result containing the value read or an error.
§Examples
let metafits = "test_files/1101503312_1_timestep/1101503312.metafits";
let mut fptr = fits_open!(&metafits)?;
let hdu = fits_open_hdu!(&mut fptr, 0)?;
let freq_centre: f64 = get_required_fits_key!(&mut fptr, &hdu, "FREQCENT")?;
assert_eq!(freq_centre, 154.24);