-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The FFI interface has the biggest API changes. It is now allowing errors to be propagated to the caller, and is overall a better C API. Examples have been updated to demonstrate this new API. The biggest change to the Rust API is returning a Vec instead of Array1 from the calc_jones*_array functions. I'm not sure why I wanted Array1 in the first place; Vec is much more useful here. The Python API now allows the same calc_jones or calc_jones_array functions to be used with either 16 or 32 dipole gains. Move FEE tests into their own file. Also move the FFI code under the FEE directory, as it's all FEE-related anyway. Add a binary "verify-beam-file". It attempts to detect defects in a user's HDF5 files by calculating beam responses, which trigger calculating m_accums and n_accums. If there are problems in generating those, errors should appear. Add a function to "fix" dipole gains ("amps"). Tests are also included. In calc_sigmas and calc_jones_direct, using the for_each iterator method *could* be faster than using a for loop, so why not. Using get_unchecked appears to remove boundary checks when accessing J_POWER_TABLE; it's totally safe to do this and apparently makes things a little faster. Elsewhere, using an iterator instead of accessing Jones matrix elements directly might have the same effect. Make the freqs member of FEEBeam private. This prevents unintentional modifications and problems. Access to the freqs is given instead by a get_freqs method. Using to_bits on a float is better than converting a float to an int for hashing purposes. Small changes elsewhere, like tidying documentation.
- Loading branch information
Showing
20 changed files
with
1,605 additions
and
1,349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// 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/. | ||
|
||
//! This program calculates the "m_accum" and "n_accum" for all frequencies | ||
//! specified in the given HDF5 file to verify the file's data. hyperbeam used | ||
//! to have runtime checks for this, but it's much easier on the computer to not | ||
//! check something that likely never happens. | ||
|
||
use mwa_hyperbeam::fee::{FEEBeam, InitFEEBeamError}; | ||
|
||
fn main() { | ||
// Test each input file. | ||
for beam_file in std::env::args().skip(1) { | ||
// If this threw an error, it was during initialisation. | ||
if let Err(e) = test_file(&beam_file) { | ||
println!("File '{}' failed to create an FEEBeam: {}", &beam_file, e); | ||
} | ||
} | ||
} | ||
|
||
fn test_file(beam_file: &str) -> Result<(), InitFEEBeamError> { | ||
println!("Testing file '{}'", beam_file); | ||
let beam = FEEBeam::new(&beam_file)?; | ||
// It does not matter what the direction, delays or amps are, the m_accum | ||
// and n_accum that we're interested in testing depend only on the | ||
// frequency. (Frequency determined the number of dipole coeffs, which | ||
// determines which m_accum and n_accum values are used.) | ||
for &file_freq in beam.get_freqs() { | ||
println!("Testing freq {}", file_freq); | ||
// If this blows up, we know there's a problem... | ||
beam.calc_jones_eng(0.0, 0.0, file_freq, &[0; 16], &[1.0; 16], false) | ||
.unwrap(); | ||
} | ||
|
||
println!("File '{}' is all good!", beam_file); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.