Skip to content

Commit

Permalink
Merge pull request #76 from ATTPC/dev
Browse files Browse the repository at this point in the history
Fix bugs, Split format version from package
  • Loading branch information
gwm17 authored Oct 21, 2024
2 parents 441bdf9 + 87325a6 commit 459fd1d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = ["Gordon McCann"]
edition = "2021"
license = "MIT"
license-file = "LICENSE.txt"
version = "0.2.0"
version = "0.2.1"
repository = "https://github.com/ATTPC/attpc_merger"
readme = "README.md"

Expand Down
2 changes: 1 addition & 1 deletion libattpc_merger/src/event_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl EventBuilder {
/// Used at the end of processing a run.
/// Returns None if there were no frames left over.
pub fn flush_final_event(&mut self) -> Option<Event> {
if self.frame_stack.is_empty() {
if !self.frame_stack.is_empty() {
match Event::new(&self.pad_map, &self.frame_stack) {
Ok(event) => Some(event),
Err(_) => None,
Expand Down
4 changes: 3 additions & 1 deletion libattpc_merger/src/hdf_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const FRIB_PHYSICS_NAME: &str = "frib_physics";

// All event counters start from 0 by law
const START_EVENT_NUMBER: u32 = 0;
/// This is the version of the output format
const FORMAT_VERSION: &str = "1.0";

/// A simple struct which wraps around the hdf5-rust library.
///
Expand Down Expand Up @@ -54,7 +56,7 @@ impl HDFWriter {
let run_path = path.file_stem().unwrap();
let parent_file_path = stem.join(format!("{}.yml", run_path.to_string_lossy()));

let merger_version = format!("{}:{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
let merger_version = format!("{}:{}", env!("CARGO_PKG_NAME"), FORMAT_VERSION);

let events_group = file_handle.create_group(EVENTS_NAME)?;
events_group.new_attr::<u64>().create("min_event")?;
Expand Down
4 changes: 3 additions & 1 deletion libattpc_merger/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ fn flush_final_event(
) -> Result<(), ProcessorError> {
if let Some(event) = evb.flush_final_event() {
writer.write_event(event, event_counter)?;
writer.close()?;
} else {
spdlog::warn!("Last event was not flushed successfully!")
}
writer.close()?;
Ok(())
}

Expand Down

0 comments on commit 459fd1d

Please sign in to comment.