Skip to content

Commit

Permalink
⬆️ upgrade mwalib 1.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v-null committed Oct 24, 2024
1 parent 545c65c commit 1b41d88
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 69 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "marlu"
version = "0.14.0"
version = "0.15.0"
authors = [
"Christopher H. Jordan <[email protected]>",
"Dev Null <[email protected]>",
]
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"
Expand Down Expand Up @@ -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"
Expand All @@ -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 }
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Marlu

<!-- markdownlint-disable MD033 -->
<div class="bg-gray-dark" align="center" style="background-color:#24292e">
<img src="img/marlu_logo.png" alt="marlu logo" height="200px"/>
<br/>
<br/>
<a href="https://docs.rs/crate/marlu"><img src="https://docs.rs/marlu/badge.svg" alt="docs"></a>
<img src="https://github.com/MWATelescope/Marlu/workflows/Cross-platform%20tests/badge.svg" alt="Cross-platform%20tests">
<a href="https://codecov.io/gh/MWATelescope/Marlu">
<img src="https://codecov.io/gh/MWATelescope/Marlu/branch/main/graph/badge.svg?token=CYMROMUKRI"/>
<a href="https://crates.io/crates/marlu"><img src="https://img.shields.io/badge/rustc-1.60-orange.svg"/></a>
<img src="https://codecov.io/gh/MWATelescope/Marlu/branch/main/graph/badge.svg?token=CYMROMUKRI" alt="codecov"/>
<a href="https://crates.io/crates/marlu"><img src="https://img.shields.io/badge/rustc-1.65-orange.svg" alt="rustc"/></a>
</a>
</div>

Expand All @@ -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
<https://www.rust-lang.org/tools/install>

### Optional prerequisites

Expand Down
7 changes: 6 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<!-- markdownlint-disable=MD025 -->

# 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)

Expand Down
116 changes: 62 additions & 54 deletions src/io/uvfits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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<Vec<String>, mwalib::FitsError> {
let pcount: usize = get_required_fits_key!(fptr, hdu, "PCOUNT")?;
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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 */
);
Expand All @@ -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();
}
Expand All @@ -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();

Expand Down Expand Up @@ -2658,22 +2666,22 @@ 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 */
);
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();
}
Expand Down Expand Up @@ -2793,19 +2801,19 @@ 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 */
);
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 */
Expand Down

0 comments on commit 1b41d88

Please sign in to comment.