From 1b41d88946a29e20b1d982767399b70ad1f8e719 Mon Sep 17 00:00:00 2001 From: d3v-null Date: Thu, 24 Oct 2024 12:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20upgrade=20mwalib=201.7.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 12 ++--- README.md | 17 +++---- RELEASES.md | 7 ++- src/io/uvfits.rs | 116 +++++++++++++++++++++++++---------------------- 4 files changed, 83 insertions(+), 69 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7840cca..043cd2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "marlu" -version = "0.14.0" +version = "0.15.0" authors = [ "Christopher H. Jordan ", "Dev Null ", ] edition = "2021" -rust-version = "1.64" +rust-version = "1.65" license = "MPL-2.0" readme = "README.md" description = "Convenience Rust code that handles coordinate transformations, Jones matrices, I/O. for the Murchison Widefield Array (MWA) radio telescope. Previously known as mwa_rust_core" @@ -43,7 +43,7 @@ cfg-if = "1.0.0" erfa = "0.2.1" hifitime = "3.6.0" itertools = "0.10.0" -lazy_static = "1.4.0" +lazy_static = "~1.5" log = "0.4.14" ndarray = { version = "0.16.0", features = ["rayon"] } num-complex = "0.4.1" @@ -53,11 +53,11 @@ tar = "0.4.15" thiserror = "1.0.0" # "cfitsio" feature -fitsio = { version = "0.20.0", optional = true } -fitsio-sys = { version = "0.4.0", optional = true } +fitsio = { version = "~0.21", optional = true } +fitsio-sys = { version = "~0.5", optional = true } # "mwalib" feature -mwalib = { version = "1.5.0", optional = true } +mwalib = { version = "1.7.1", optional = true } # "ms" feature flate2 = { version = "1.0.13", optional = true } diff --git a/README.md b/README.md index dcf0e04..d552a1b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Marlu +
marlu logo
@@ -7,8 +8,8 @@ docs Cross-platform%20tests - - + codecov +rustc
@@ -17,14 +18,14 @@ etc. ## Prerequisites -- A Rust compiler with a version >= 1.64.0 +- Cargo version >= 1.65.0 - ```bash - $ rustc -V - rustc 1.63.0 (4b91a6ea7 2022-08-08) - ``` +```bash +$ cargo -V +cargo 1.65.0 (4bc8f24d3 2022-10-20) +``` - https://www.rust-lang.org/tools/install + ### Optional prerequisites diff --git a/RELEASES.md b/RELEASES.md index 8614dca..419be15 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,8 +1,13 @@ +# Version 0.14.0 (2024-10-24) + +- update mwalib 1.7.0, which uses newer lazy_static, fitsio, fitsio-sys, msrv +- msrv 1.65 + # Version 0.14.0 (2024-09-20) -- update use mwalib 1.5.0 +- update mwalib 1.5.0 # Version 0.13.0 (2024-08-14) diff --git a/src/io/uvfits.rs b/src/io/uvfits.rs index a326d48..b40f100 100644 --- a/src/io/uvfits.rs +++ b/src/io/uvfits.rs @@ -62,10 +62,12 @@ fn deallocate_rust_c_strings(c_string_ptrs: Vec<*mut c_char>) { } } -/// Encode a baseline into the uvfits format. Use the miriad convention to -/// handle more than 255 antennas (up to 2048). This is backwards compatible -/// with the standard UVFITS convention. Antenna indices start at 1. -// Shamelessly copied from the RTS, originally written by Randall Wayth. +/// Encode a baseline into the uvfits format. +/// +/// Use the miriad convention to handle more than 255 antennas (up to 2048). +/// This is backwards compatible with the standard UVFITS convention. +/// Antenna indices start at 1. +/// Shamelessly copied from the RTS, originally written by Randall Wayth. pub const fn encode_uvfits_baseline(ant1: usize, ant2: usize) -> usize { if ant2 > 255 { ant1 * 2048 + ant2 + 65_536 @@ -1196,13 +1198,10 @@ mod tests { use std::io::Read; use approx::{abs_diff_eq, assert_abs_diff_eq}; - use fitsio::{ - hdu::{FitsHdu, HduInfo}, - FitsFile, - }; + use fitsio::hdu::{FitsHdu, HduInfo}; use mwalib::{ _get_fits_col, _get_required_fits_key, _open_fits, _open_hdu, fits_open, fits_open_hdu, - get_fits_col, get_required_fits_key, CorrelatorContext, + get_fits_col, get_required_fits_key, CorrelatorContext, MWAFitsFile, }; use ndarray::Array3; use tempfile::NamedTempFile; @@ -1370,7 +1369,7 @@ mod tests { for row_idx in 0..$row_len { unsafe { fitsio_sys::ffgcvd( - $left_fptr.as_raw(), + $left_fptr.fits_file.as_raw(), (col_num + 1) as _, (row_idx + 1) as _, 1, @@ -1382,7 +1381,7 @@ mod tests { ); fits_check_status(status).unwrap(); fitsio_sys::ffgcvd( - $right_fptr.as_raw(), + $right_fptr.fits_file.as_raw(), (col_num + 1) as _, (row_idx + 1) as _, 1, @@ -1414,8 +1413,8 @@ mod tests { #[allow(dead_code)] pub(crate) fn assert_uvfits_primary_header_eq( - left_fptr: &mut FitsFile, - right_fptr: &mut FitsFile, + left_fptr: &mut MWAFitsFile, + right_fptr: &mut MWAFitsFile, ) { let left_primary_hdu = fits_open_hdu!(left_fptr, 0).unwrap(); let right_primary_hdu = fits_open_hdu!(right_fptr, 0).unwrap(); @@ -1461,7 +1460,10 @@ mod tests { } #[allow(dead_code)] - pub(crate) fn assert_uvfits_ant_header_eq(left_fptr: &mut FitsFile, right_fptr: &mut FitsFile) { + pub(crate) fn assert_uvfits_ant_header_eq( + left_fptr: &mut MWAFitsFile, + right_fptr: &mut MWAFitsFile, + ) { let left_ant_hdu = fits_open_hdu!(left_fptr, 1).unwrap(); let right_ant_hdu = fits_open_hdu!(right_fptr, 1).unwrap(); @@ -1497,7 +1499,7 @@ mod tests { #[allow(dead_code)] pub(crate) fn get_group_column_description( - fptr: &mut FitsFile, + fptr: &mut MWAFitsFile, hdu: &FitsHdu, ) -> Result, mwalib::FitsError> { let pcount: usize = get_required_fits_key!(fptr, hdu, "PCOUNT")?; @@ -1537,7 +1539,10 @@ mod tests { } #[allow(dead_code)] - pub(crate) fn assert_uvfits_vis_table_eq(left_fptr: &mut FitsFile, right_fptr: &mut FitsFile) { + pub(crate) fn assert_uvfits_vis_table_eq( + left_fptr: &mut MWAFitsFile, + right_fptr: &mut MWAFitsFile, + ) { let left_vis_hdu = fits_open_hdu!(left_fptr, 0).unwrap(); let right_vis_hdu = fits_open_hdu!(right_fptr, 0).unwrap(); @@ -1578,20 +1583,20 @@ mod tests { unsafe { // ffggpe = fits_read_grppar_flt fitsio_sys::ffggpe( - left_fptr.as_raw(), /* I - FITS file pointer */ - 1 + row_idx as i64, /* I - group to read (1 = 1st group) */ - 1, /* I - first vector element to read (1 = 1st) */ - pcount as i64, /* I - number of values to read */ + left_fptr.fits_file.as_raw(), /* I - FITS file pointer */ + 1 + row_idx as i64, /* I - group to read (1 = 1st group) */ + 1, /* I - first vector element to read (1 = 1st) */ + pcount as i64, /* I - number of values to read */ left_group_params.as_mut_ptr(), /* O - array of values that are returned */ &mut status, /* IO - error status */ ); fits_check_status(status).unwrap(); // ffggpe = fits_read_grppar_flt fitsio_sys::ffggpe( - right_fptr.as_raw(), /* I - FITS file pointer */ - 1 + row_idx as i64, /* I - group to read (1 = 1st group) */ - 1, /* I - first vector element to read (1 = 1st) */ - pcount as i64, /* I - number of values to read */ + right_fptr.fits_file.as_raw(), /* I - FITS file pointer */ + 1 + row_idx as i64, /* I - group to read (1 = 1st group) */ + 1, /* I - first vector element to read (1 = 1st) */ + pcount as i64, /* I - number of values to read */ right_group_params.as_mut_ptr(), /* O - array of values that are returned */ &mut status, /* IO - error status */ ); @@ -1616,27 +1621,27 @@ mod tests { unsafe { // ffgpve = fits_read_sel_flt fitsio_sys::ffgpve( - left_fptr.as_raw(), /* I - FITS file pointer */ - 1 + row_idx as i64, /* I - group to read (1 = 1st group) */ - 1, /* I - first vector element to read (1 = 1st) */ - left_vis.len() as i64, /* I - number of values to read */ - 0.0, /* I - value for undefined pixels */ - left_vis.as_mut_ptr(), /* O - array of values that are returned */ - &mut 0, /* O - set to 1 if any values are null; else 0 */ - &mut status, /* IO - error status */ + left_fptr.fits_file.as_raw(), /* I - FITS file pointer */ + 1 + row_idx as i64, /* I - group to read (1 = 1st group) */ + 1, /* I - first vector element to read (1 = 1st) */ + left_vis.len() as i64, /* I - number of values to read */ + 0.0, /* I - value for undefined pixels */ + left_vis.as_mut_ptr(), /* O - array of values that are returned */ + &mut 0, /* O - set to 1 if any values are null; else 0 */ + &mut status, /* IO - error status */ ); fits_check_status(status).unwrap(); // ffgpve = fits_read_sel_flt fitsio_sys::ffgpve( - right_fptr.as_raw(), /* I - FITS file pointer */ - 1 + row_idx as i64, /* I - group to read (1 = 1st group) */ - 1, /* I - first vector element to read (1 = 1st) */ - right_vis.len() as i64, /* I - number of values to read */ - 0.0, /* I - value for undefined pixels */ - right_vis.as_mut_ptr(), /* O - array of values that are returned */ - &mut 0, /* O - set to 1 if any values are null; else 0 */ - &mut status, /* IO - error status */ + right_fptr.fits_file.as_raw(), /* I - FITS file pointer */ + 1 + row_idx as i64, /* I - group to read (1 = 1st group) */ + 1, /* I - first vector element to read (1 = 1st) */ + right_vis.len() as i64, /* I - number of values to read */ + 0.0, /* I - value for undefined pixels */ + right_vis.as_mut_ptr(), /* O - array of values that are returned */ + &mut 0, /* O - set to 1 if any values are null; else 0 */ + &mut status, /* IO - error status */ ); fits_check_status(status).unwrap(); } @@ -1655,7 +1660,10 @@ mod tests { } #[allow(dead_code)] - pub(crate) fn assert_uvfits_ant_table_eq(left_fptr: &mut FitsFile, right_fptr: &mut FitsFile) { + pub(crate) fn assert_uvfits_ant_table_eq( + left_fptr: &mut MWAFitsFile, + right_fptr: &mut MWAFitsFile, + ) { let left_ant_hdu = fits_open_hdu!(left_fptr, 1).unwrap(); let right_ant_hdu = fits_open_hdu!(right_fptr, 1).unwrap(); @@ -2658,9 +2666,9 @@ mod tests { unsafe { // ffggpe = fits_read_grppar_flt fitsio_sys::ffggpe( - no_inttim.as_raw(), /* I - FITS file pointer */ - 1, /* I - group to read (1 = 1st group) */ - 1, /* I - first vector element to read (1 = 1st) */ + no_inttim.fits_file.as_raw(), /* I - FITS file pointer */ + 1, /* I - group to read (1 = 1st group) */ + 1, /* I - first vector element to read (1 = 1st) */ no_inttim_group_params.len() as i64, /* I - number of values to read */ no_inttim_group_params.as_mut_ptr(), /* O - array of values that are returned */ &mut status, /* IO - error status */ @@ -2668,12 +2676,12 @@ mod tests { fits_check_status(status).unwrap(); // ffggpe = fits_read_grppar_flt fitsio_sys::ffggpe( - inttim.as_raw(), /* I - FITS file pointer */ - 1, /* I - group to read (1 = 1st group) */ - 1, /* I - first vector element to read (1 = 1st) */ + inttim.fits_file.as_raw(), /* I - FITS file pointer */ + 1, /* I - group to read (1 = 1st group) */ + 1, /* I - first vector element to read (1 = 1st) */ inttim_group_params.len() as i64, /* I - number of values to read */ inttim_group_params.as_mut_ptr(), /* O - array of values that are returned */ - &mut status, /* IO - error status */ + &mut status, /* IO - error status */ ); fits_check_status(status).unwrap(); } @@ -2793,9 +2801,9 @@ mod tests { unsafe { // ffggpe = fits_read_grppar_flt fitsio_sys::ffggpe( - precession.as_raw(), /* I - FITS file pointer */ - 2, /* I - group to read (1 = 1st group) */ - 1, /* I - first vector element to read (1 = 1st) */ + precession.fits_file.as_raw(), /* I - FITS file pointer */ + 2, /* I - group to read (1 = 1st group) */ + 1, /* I - first vector element to read (1 = 1st) */ precession_group_params.len() as i64, /* I - number of values to read */ precession_group_params.as_mut_ptr(), /* O - array of values that are returned */ &mut status, /* IO - error status */ @@ -2803,9 +2811,9 @@ mod tests { fits_check_status(status).unwrap(); // ffggpe = fits_read_grppar_flt fitsio_sys::ffggpe( - no_precession.as_raw(), /* I - FITS file pointer */ - 2, /* I - group to read (1 = 1st group) */ - 1, /* I - first vector element to read (1 = 1st) */ + no_precession.fits_file.as_raw(), /* I - FITS file pointer */ + 2, /* I - group to read (1 = 1st group) */ + 1, /* I - first vector element to read (1 = 1st) */ no_precession_group_params.len() as i64, /* I - number of values to read */ no_precession_group_params.as_mut_ptr(), /* O - array of values that are returned */ &mut status, /* IO - error status */