Skip to content

Commit

Permalink
Applied various changes to support use by VCS team- see changelog for…
Browse files Browse the repository at this point in the history
… more info
  • Loading branch information
gsleap committed Aug 11, 2021
1 parent f52a390 commit 95b1dae
Show file tree
Hide file tree
Showing 18 changed files with 457 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Cargo.lock
/examples/sum-all-hdus
/examples/mwalib-print-context
/examples/mwalib-sum-all-hdus
/examples/mwalib-print-voltage-context
/examples/mwalib-print-volt-context
.vscode
/coverage
/tools/release
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Changes in each release are listed below.

## 0.9.0 09-Aug-2021 (Pre-release)
* Added mwa_version <Option<MWAVersion>> to MetafitsContext struct.
* When working only with a MetafitsContext, a None can be passed in lieu of an MWAVersion, and mwalib will attempt to determine the correct MWAVersion based on the MODE keyword from the metafits file.
* Added method get_expected_volt_filename() function to MetafitsContext.
* Added digital_gains, dipole_gains and dipole_delays to FFI rfinput struct.
* Added num_receivers, num_delays to MetafitsContext / metafits_metadata struct in FFI.
* Metafits metadata sched_start_utc and sched_end_utc are now typed as time_t and represent the Unix timestamp (which can be used by various time.h functions).

## 0.8.7 03-Aug-2021 (Pre-release)
* Updated some dependencies in Cargo.toml.
* Renamed metafits_context.metafits_fine_chan_freqs by adding _hz suffix to be consistent with other naming of attributes with units.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mwalib"
version = "0.8.7"
version = "0.9.0"
homepage = "https://github.com/MWATelescope/mwalib"
repository = "https://github.com/MWATelescope/mwalib"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions examples/build_c_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ gcc -O3 \
-lmwalib

gcc -O3 \
mwalib-print-voltage-context.c \
-o mwalib-print-voltage-context \
mwalib-print-volt-context.c \
-o mwalib-print-volt-context \
-I ../include \
-lm -lpthread -ldl \
-L../target/release/ \
Expand Down
20 changes: 20 additions & 0 deletions examples/mwalib-print-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Example code to print context info, given at least a metafits file and optionall
#include <stdlib.h>
#include <string.h>
#include "mwalib.h"
#include "time.h"

#define ERROR_MESSAGE_LEN 1024

Expand Down Expand Up @@ -195,6 +196,25 @@ int main(int argc, char *argv[])
// print a timestep
printf("Metafits Timestep index 2: GPS Time = %f (UNIX time: %f)\n", (double)metafits_metadata->metafits_timesteps[2].gps_time_ms / 1000., (double)metafits_metadata->metafits_timesteps[2].unix_time_ms / 1000.);

// print the start time UTC and sched start unix time
printf("Scheduled start time (UNIX): %f\n", metafits_metadata->sched_start_unix_time_ms / 1000.0);

// Print the UTC value
char utc_start_string[64];
time_t time_utc_start = metafits_metadata->sched_start_utc;
struct tm *utc_start_timeinfo = gmtime(&time_utc_start);
const char date_format[] = "%c %Z";

if (strftime(utc_start_string, sizeof(utc_start_string), date_format, utc_start_timeinfo) == 0)
{
printf("Error formatting sched_start_utc value.");
return -1;
}
else
{
printf("Scheduled start time UTC: %s\n", utc_start_string);
}

// Clean up metadata
mwalib_metafits_metadata_free(metafits_metadata);
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/coarse_channel/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub enum CoarseChannelError {
NoGpuboxOrVoltageTimeMapSupplied,
#[error("Gpubox AND voltage time_map supplied, which is not valid")]
BothGpuboxAndVoltageTimeMapSupplied,
#[error("Invalid MWA Version - 0 Unknown not allowed here")]
InvalidMWAVersionUnknown,

/// An error derived from `FitsError`.
#[error("{0}")]
Expand Down
3 changes: 3 additions & 0 deletions src/correlator_context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ impl CorrelatorContext {
// Do gpubox stuff only if we have gpubox files.
let gpubox_info = examine_gpubox_files(gpubox_filenames, metafits_context.obs_id)?;

// Update the metafits now that we know the mwa_version
metafits_context.mwa_version = Some(gpubox_info.mwa_version);

// Populate metafits coarse channels and timesteps now that we know what MWA Version we are dealing with
// Populate the coarse channels
metafits_context.populate_expected_coarse_channels(gpubox_info.mwa_version)?;
Expand Down
4 changes: 4 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ pub enum MwalibError {
#[error("{0}")]
CoarseChannel(#[from] crate::coarse_channel::error::CoarseChannelError),

/// An error dervied from `MetafitsError`.
#[error("{0}")]
Metafits(#[from] crate::metafits_context::error::MetafitsError),

/// An error derived from `RfinputError`.
#[error("{0}")]
Rfinput(#[from] crate::rfinput::error::RfinputError),
Expand Down
Loading

0 comments on commit 95b1dae

Please sign in to comment.