Skip to content

Commit

Permalink
!PATCHED! testing mwalib PR 86 (1.8.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v-null committed Nov 11, 2024
1 parent 743aa3d commit 4cfad7a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 61 deletions.
8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ tar = "0.4.15"
thiserror = "1.0.0"

# "cfitsio" feature
fitsio = { version = "~0.21", optional = true }
fitsio = { version = "0.21.6", optional = true }
fitsio-sys = { version = "~0.5", optional = true }

# "mwalib" feature
mwalib = { version = "1.7.1", optional = true }
mwalib = { version = "1.8.0", optional = true }

# "ms" feature
flate2 = { version = "1.0.13", optional = true }
Expand Down Expand Up @@ -97,8 +97,6 @@ name = "bench_io"
harness = false

[patch.crates-io]
# TODO: get rid of this once MSRV >= 1.65
dashmap = { git = "https://github.com/xacrimon/dashmap", tag = "v5.5.2" } # v5.5.3 msrv is 1.65
regex = { git = "https://github.com/rust-lang/regex", tag = "regex-syntax-0.7.5" } # regex-syntax > 0.8 msrv is 1.65
mwalib = { git = "https://github.com/MWATelescope/mwalib", branch = "pyo3_stub_chrono_fix" }
# TODO: get rid of this once MSRV >= 1.70
ciborium = { git = "https://github.com/enarx/ciborium", tag = "v0.2.1" } # ciborium-ll v > 0.2.1 needs half ^2.2, half v > 2.3.x msrv is 1.70
106 changes: 50 additions & 56 deletions src/io/uvfits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,10 +1198,13 @@ mod tests {
use std::io::Read;

use approx::{abs_diff_eq, assert_abs_diff_eq};
use fitsio::hdu::{FitsHdu, HduInfo};
use fitsio::{
hdu::{FitsHdu, HduInfo},
FitsFile,
};
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, MWAFitsFile,
get_fits_col, get_required_fits_key, CorrelatorContext,
};
use ndarray::Array3;
use tempfile::NamedTempFile;
Expand Down Expand Up @@ -1369,7 +1372,7 @@ mod tests {
for row_idx in 0..$row_len {
unsafe {
fitsio_sys::ffgcvd(
$left_fptr.fits_file.as_raw(),
$left_fptr.as_raw(),
(col_num + 1) as _,
(row_idx + 1) as _,
1,
Expand All @@ -1381,7 +1384,7 @@ mod tests {
);
fits_check_status(status).unwrap();
fitsio_sys::ffgcvd(
$right_fptr.fits_file.as_raw(),
$right_fptr.as_raw(),
(col_num + 1) as _,
(row_idx + 1) as _,
1,
Expand Down Expand Up @@ -1413,8 +1416,8 @@ mod tests {

#[allow(dead_code)]
pub(crate) fn assert_uvfits_primary_header_eq(
left_fptr: &mut MWAFitsFile,
right_fptr: &mut MWAFitsFile,
left_fptr: &mut FitsFile,
right_fptr: &mut FitsFile,
) {
let left_primary_hdu = fits_open_hdu!(left_fptr, 0).unwrap();
let right_primary_hdu = fits_open_hdu!(right_fptr, 0).unwrap();
Expand Down Expand Up @@ -1460,10 +1463,7 @@ mod tests {
}

#[allow(dead_code)]
pub(crate) fn assert_uvfits_ant_header_eq(
left_fptr: &mut MWAFitsFile,
right_fptr: &mut MWAFitsFile,
) {
pub(crate) fn assert_uvfits_ant_header_eq(left_fptr: &mut FitsFile, right_fptr: &mut FitsFile) {
let left_ant_hdu = fits_open_hdu!(left_fptr, 1).unwrap();
let right_ant_hdu = fits_open_hdu!(right_fptr, 1).unwrap();

Expand Down Expand Up @@ -1499,7 +1499,7 @@ mod tests {

#[allow(dead_code)]
pub(crate) fn get_group_column_description(
fptr: &mut MWAFitsFile,
fptr: &mut FitsFile,
hdu: &FitsHdu,
) -> Result<Vec<String>, mwalib::FitsError> {
let pcount: usize = get_required_fits_key!(fptr, hdu, "PCOUNT")?;
Expand Down Expand Up @@ -1539,10 +1539,7 @@ mod tests {
}

#[allow(dead_code)]
pub(crate) fn assert_uvfits_vis_table_eq(
left_fptr: &mut MWAFitsFile,
right_fptr: &mut MWAFitsFile,
) {
pub(crate) fn assert_uvfits_vis_table_eq(left_fptr: &mut FitsFile, right_fptr: &mut FitsFile) {
let left_vis_hdu = fits_open_hdu!(left_fptr, 0).unwrap();
let right_vis_hdu = fits_open_hdu!(right_fptr, 0).unwrap();

Expand Down Expand Up @@ -1583,20 +1580,20 @@ mod tests {
unsafe {
// ffggpe = fits_read_grppar_flt
fitsio_sys::ffggpe(
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_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_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.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_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_group_params.as_mut_ptr(), /* O - array of values that are returned */
&mut status, /* IO - error status */
);
Expand All @@ -1621,27 +1618,27 @@ mod tests {
unsafe {
// ffgpve = fits_read_sel_flt
fitsio_sys::ffgpve(
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 */
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 */
);
fits_check_status(status).unwrap();

// ffgpve = fits_read_sel_flt
fitsio_sys::ffgpve(
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 */
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 */
);
fits_check_status(status).unwrap();
}
Expand All @@ -1660,10 +1657,7 @@ mod tests {
}

#[allow(dead_code)]
pub(crate) fn assert_uvfits_ant_table_eq(
left_fptr: &mut MWAFitsFile,
right_fptr: &mut MWAFitsFile,
) {
pub(crate) fn assert_uvfits_ant_table_eq(left_fptr: &mut FitsFile, right_fptr: &mut FitsFile) {
let left_ant_hdu = fits_open_hdu!(left_fptr, 1).unwrap();
let right_ant_hdu = fits_open_hdu!(right_fptr, 1).unwrap();

Expand Down Expand Up @@ -2666,22 +2660,22 @@ mod tests {
unsafe {
// ffggpe = fits_read_grppar_flt
fitsio_sys::ffggpe(
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.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 */
);
fits_check_status(status).unwrap();
// ffggpe = fits_read_grppar_flt
fitsio_sys::ffggpe(
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.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();
}
Expand Down Expand Up @@ -2801,19 +2795,19 @@ mod tests {
unsafe {
// ffggpe = fits_read_grppar_flt
fitsio_sys::ffggpe(
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.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 */
);
fits_check_status(status).unwrap();
// ffggpe = fits_read_grppar_flt
fitsio_sys::ffggpe(
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.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 */
Expand Down

0 comments on commit 4cfad7a

Please sign in to comment.