Skip to content

Commit

Permalink
Merge branch 'small_updates' into optional_metafits
Browse files Browse the repository at this point in the history
  • Loading branch information
gsleap committed Nov 22, 2022
2 parents 0aa028a + 41e1d1c commit d169eb5
Show file tree
Hide file tree
Showing 39 changed files with 184 additions and 239 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ Changes in each release are listed below.
* FFI/C: `MetafitsMetadata`->`ra_phase_center_deg` is now NaN not 0 when missing from metafits file
* FFI/C: `MetafitsMetadata`->`dec_phase_center_deg` is now NaN not 0 when missing from metafits file

## 0.16.0 (unreleased)
* Update module docs.
* Update dependencies.
* Fixed a bunch of clippy lints.

## 0.15.1 09-Aug-2022 (Pre-release)
* mwalib now requires Rust version 1.57 or newer
* Speed up conversion of legacy -> MWAX visibility ordering
* Expose all mwalib error types

## 0.15.0 23-Jun-2022 (Pre-release)
* Provide DUT1 in the metafits context
* API tweaks surrounding generic types
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ examples = ["anyhow", "clap", "env_logger"]

[dependencies]
chrono = "0.4.1"
fitsio = "0.19.0"
fitsio = "0.20.0"
fitsio-sys = "0.4.0"
lazy_static = "1.4.0"
libc = "0.2.69"
Expand Down
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::env;
// (https://github.com/rust-lang/pkg-config-rs).
fn infer_static(name: &str) -> bool {
#[allow(clippy::if_same_then_else, clippy::needless_bool)]
if env::var(&format!("{}_STATIC", name.to_uppercase())).is_ok() {
if env::var(format!("{}_STATIC", name.to_uppercase())).is_ok() {
true
} else if env::var(&format!("{}_DYNAMIC", name.to_uppercase())).is_ok() {
} else if env::var(format!("{}_DYNAMIC", name.to_uppercase())).is_ok() {
false
} else if env::var("PKG_CONFIG_ALL_STATIC").is_ok() {
true
Expand Down
5 changes: 2 additions & 3 deletions src/antenna/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Structs and helper methods for antenna metadata
*/
//! Structs and helper methods for antenna metadata
use crate::rfinput::*;
use std::fmt;

Expand Down
5 changes: 2 additions & 3 deletions src/antenna/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Unit tests for antenna metadata
*/
//! Unit tests for antenna metadata
#[cfg(test)]
use super::*;
use float_cmp::*;
Expand Down
5 changes: 2 additions & 3 deletions src/baseline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Structs and helper methods for baseline metadata
*/
//! Structs and helper methods for baseline metadata
use crate::misc;
use std::fmt;

Expand Down
5 changes: 2 additions & 3 deletions src/baseline/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Unit tests for baseline metadata
*/
//! Unit tests for baseline metadata
#[cfg(test)]
use super::*;

Expand Down
4 changes: 1 addition & 3 deletions src/coarse_channel/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Errors associated with coarse channels.
*/
//! Errors associated with coarse channels.
use thiserror::Error;

Expand Down
5 changes: 2 additions & 3 deletions src/coarse_channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Structs and helper methods for coarse channel metadata
*/
//! Structs and helper methods for coarse channel metadata
use crate::gpubox_files::GpuboxTimeMap;
use crate::voltage_files::VoltageFileTimeMap;
pub mod error;
Expand Down
5 changes: 2 additions & 3 deletions src/coarse_channel/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Unit tests for coarse channel metadata
*/
//! Unit tests for coarse channel metadata
#[cfg(test)]
use super::*;
use float_cmp::*;
Expand Down
16 changes: 7 additions & 9 deletions src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Structs and helper methods for coverting Legacy MWA data into a sensible ordering/format.
//! Structs and helper methods for coverting Legacy MWA data into a sensible
//! ordering/format.
//!
//! Major contributor: Brian Crosse (Curtin Institute for Radio Astronomy)
Major contributor: Brian Crosse (Curtin Institute for Radio Astronomy)
*/
use crate::misc::*;
use crate::rfinput::*;
use log::trace;
Expand Down Expand Up @@ -253,8 +252,7 @@ pub(crate) fn generate_conversion_array(rf_inputs: &[Rfinput]) -> Vec<LegacyConv
// Create an output vector so we can lookup where to get data from the legacy HDU, given a baseline/ant1/ant2
let baseline_count = get_baseline_count(128);

let mut conversion_table: Vec<LegacyConversionBaseline> =
Vec::with_capacity(baseline_count as usize);
let mut conversion_table: Vec<LegacyConversionBaseline> = Vec::with_capacity(baseline_count);

// Our row tile and column tile. Now 2 pols each so only 128 in legacy obs
for row_tile in 0..128 {
Expand All @@ -276,8 +274,8 @@ pub(crate) fn generate_conversion_array(rf_inputs: &[Rfinput]) -> Vec<LegacyConv
}

// Ensure we processed all baselines
assert_eq!(baseline, baseline_count as usize);
assert_eq!(conversion_table.len(), baseline_count as usize);
assert_eq!(baseline, baseline_count);
assert_eq!(conversion_table.len(), baseline_count);

trace!("legacy_conversion_table: {:?}", conversion_table);

Expand Down
35 changes: 8 additions & 27 deletions src/convert/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Unit tests for code dealing with conversion from legacy to mwax format
*/
//! Unit tests for code dealing with conversion from legacy to mwax format
#[cfg(test)]
use super::*;
use crate::*;
Expand Down Expand Up @@ -242,18 +241,12 @@ fn test_conversion_of_legacy_hdu_to_mwax_baseline_ordervs_pyuvdata() {
} else {
// We are at the end of a baseline
// Get value from mwa_lib
let good: u8 = if approx_eq!(
let good = u8::from(approx_eq!(
f64,
mwalib_sum_of_baseline,
pyuvdata_sum_of_baseline,
F64Margin::default()
) {
// match
1
} else {
// no match
0
};
));

assert_eq!(
good,
Expand Down Expand Up @@ -406,18 +399,12 @@ fn test_conversion_of_legacy_hdu_to_mwax_frequency_order_vs_pyuvdata() {
} else {
// We are at the end of a fine channel
// Get value from mwa_lib
let good: u8 = if approx_eq!(
let good = u8::from(approx_eq!(
f64,
mwalib_sum_of_fine_chan,
pyuvdata_sum_of_fine_chan,
F64Margin::default()
) {
// match
1
} else {
// no match
0
};
));

assert_eq!(
good,
Expand Down Expand Up @@ -570,18 +557,12 @@ fn test_conversion_of_legacy_hdu_to_mwax_baseline_order_vs_cotter() {
} else {
// We are at the end of a baseline
// Get value from mwa_lib
let good: u8 = if approx_eq!(
let good = u8::from(approx_eq!(
f64,
mwalib_sum_of_baseline,
cotter_sum_of_baseline,
F64Margin::default()
) {
// match
1
} else {
// no match
0
};
));

assert_eq!(
good,
Expand Down
5 changes: 2 additions & 3 deletions src/correlator_context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
The main interface to MWA data.
*/
//! The main interface to MWA data.
use std::collections::BTreeMap;
use std::fmt;
use std::path::Path;
Expand Down
5 changes: 2 additions & 3 deletions src/correlator_context/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

/*!
Unit tests for correlator context
*/
//! Unit tests for correlator context
use super::*;
use float_cmp::*;
use std::path::PathBuf;
Expand Down
5 changes: 2 additions & 3 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
/*!
Structs and helper methods for Error handling
*/

//! Structs and helper methods for Error handling
use thiserror::Error;

Expand Down
Loading

0 comments on commit d169eb5

Please sign in to comment.