From b8391e8b533ccb5929a4803435ec49cf92c55f77 Mon Sep 17 00:00:00 2001 From: alconley Date: Thu, 16 Jan 2025 14:20:41 -0500 Subject: [PATCH 1/4] new file: src/evb/archivist.rs modified: src/evb/mod.rs modified: src/ui/app.rs --- src/evb/archivist.rs | 209 +++++++++++++++++++++++++++++++++++++++++++ src/evb/mod.rs | 1 + src/ui/app.rs | 11 +++ 3 files changed, 221 insertions(+) create mode 100644 src/evb/archivist.rs diff --git a/src/evb/archivist.rs b/src/evb/archivist.rs new file mode 100644 index 0000000..d52b000 --- /dev/null +++ b/src/evb/archivist.rs @@ -0,0 +1,209 @@ +use std::path::PathBuf; +use std::process::Command; + +#[derive(serde::Deserialize, serde::Serialize, Debug)] +pub struct SSH { + pub enabled: bool, + pub user: String, + pub host: String, + pub password: String, +} + +impl Default for SSH { + fn default() -> Self { + Self { + enabled: false, + user: "spieker-group".to_string(), + host: "spiekerlab.physics.fsu.edu".to_string(), + password: String::new(), + } + } +} + +#[derive(serde::Deserialize, serde::Serialize, Debug, Default)] +pub struct Archivist { + pub compass_path: String, + pub output_path: String, + pub min_run: u32, + pub max_run: u32, + pub multiple_runs: bool, + pub ssh: SSH, +} + +impl Archivist { + pub fn run_archive(&self, run_no: u32) -> Result<(), String> { + let binary_dir = format!("{}/run_{}/UNFILTERED", self.compass_path, run_no); + let archive_path = format!("{}/run_{}.tar.gz", self.output_path, run_no); + + // Convert paths to PathBuf for proper handling + let binary_dir = PathBuf::from(&binary_dir); + let archive_path = PathBuf::from(&archive_path); + + // Check if binary_dir exists + if !binary_dir.exists() { + return Err(format!("Binary data directory {:?} does not exist", binary_dir)); + } + + println!( + "Running archivist for binary data in {:?} to archive {:?}...", + binary_dir, archive_path + ); + + let output = Command::new("bash") + .arg("-c") + .arg(format!( + "cd {:?} && tar -cvzf {:?} ./*.BIN && cd -", + binary_dir.display(), + archive_path.display() + )) + .output(); + + match output { + Ok(output) => { + if output.status.success() { + println!("Archive complete."); + Ok(()) + } else { + Err(format!( + "Error during archiving: {}", + String::from_utf8_lossy(&output.stderr) + )) + } + } + Err(e) => Err(format!("Failed to run command: {}", e)), + } + } + + pub fn run_archive_ssh(&self, run_no: u32) -> Result<(), String> { + if !self.ssh.enabled { + return Err("SSH is not enabled.".to_string()); + } + + let remote_binary_dir = format!("{}/run_{}/UNFILTERED", self.compass_path, run_no); + let local_archive_path = format!("{}/run_{}.tar.gz", self.output_path, run_no); + + // Ensure the local archive path is valid + let local_archive_path = PathBuf::from(&local_archive_path); + + println!( + "Archiving files from remote: {}@{}:{} to local: {:?}", + self.ssh.user, self.ssh.host, remote_binary_dir, local_archive_path + ); + + // SSH command to tar files on the remote server + let tar_command = format!( + "sshpass -p {} {}@{} cd {}; tar -czf - ./*.BIN'", + self.ssh.password, self.ssh.user, self.ssh.host, remote_binary_dir + ); + + // SCP command to send the tarball locally + let scp_command = format!( + "{} > {:?}", + tar_command, + local_archive_path.display() + ); + + // Execute the tar and transfer command + let output = Command::new("bash") + .arg("-c") + .arg(&scp_command) + .output(); + + match output { + Ok(output) => { + if output.status.success() { + println!("Archive successfully transferred to local machine."); + Ok(()) + } else { + Err(format!( + "Error during SSH tar/scp operation: {}", + String::from_utf8_lossy(&output.stderr) + )) + } + } + Err(e) => Err(format!("Failed to execute SSH tar/scp command: {}", e)), + } + } + + pub fn ui(&mut self, ui: &mut egui::Ui) { + ui.horizontal(|ui| { + ui.label( + egui::RichText::new("Archivist") + .color(egui::Color32::LIGHT_BLUE) + .size(18.0), + ); + ui.checkbox(&mut self.ssh.enabled, "SSH enabled"); + }); + + ui.horizontal(|ui| { + if self.ssh.enabled { + ui.horizontal(|ui| { + ui.label("SSH:"); + ui.add(egui::TextEdit::singleline(&mut self.ssh.user).hint_text("User")); + }); + ui.label("@"); + ui.add(egui::TextEdit::singleline(&mut self.ssh.host).hint_text("Host")); + ui.label(":"); + } + }); + + if self.ssh.enabled { + ui.add(egui::TextEdit::singleline(&mut self.ssh.password).hint_text("SSH password").password(true)); + } + + ui.horizontal(|ui| { + ui.label("Compass DAQ Folder"); + ui.add( + egui::TextEdit::singleline(&mut self.compass_path) + .clip_text(false), + ); + }); + + + ui.horizontal(|ui| { + ui.label("Local Output Folder"); + ui.add( + egui::TextEdit::singleline(&mut self.output_path) + .clip_text(false), + ); + }); + + ui.horizontal(|ui| { + ui.add(egui::DragValue::new(&mut self.min_run).prefix("Min run: ")); + ui.add_enabled( + self.multiple_runs, + egui::DragValue::new(&mut self.max_run).prefix("Max run: "), + ); + ui.checkbox(&mut self.multiple_runs, "Multiple runs"); + }); + + + if ui.button("Archive").clicked() { + if self.ssh.enabled { + if self.multiple_runs { + for run_no in self.min_run..=self.max_run { + if let Err(e) = self.run_archive_ssh(run_no) { + eprintln!("Error archiving run {}: {}", run_no, e); + } + } + } else { + if let Err(e) = self.run_archive_ssh(self.min_run) { + eprintln!("Error archiving run {}: {}", self.min_run, e); + } + } + } else { + if self.multiple_runs { + for run_no in self.min_run..=self.max_run { + if let Err(e) = self.run_archive(run_no) { + eprintln!("Error archiving run {}: {}", run_no, e); + } + } + } else { + if let Err(e) = self.run_archive(self.min_run) { + eprintln!("Error archiving run {}: {}", self.min_run, e); + } + } + } + } + } +} diff --git a/src/evb/mod.rs b/src/evb/mod.rs index 30bc4d4..e0bb77f 100644 --- a/src/evb/mod.rs +++ b/src/evb/mod.rs @@ -1,3 +1,4 @@ +pub mod archivist; pub mod channel_data; pub mod channel_map; pub mod compass_data; diff --git a/src/ui/app.rs b/src/ui/app.rs index 96bff32..789e7b4 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -12,6 +12,7 @@ use eframe::egui::{self, Color32, RichText}; use eframe::App; use super::ws::{Workspace, WorkspaceError}; +use crate::evb::archivist::Archivist; use crate::evb::channel_map::Board; use crate::evb::compass_run::{process_runs, ProcessParams}; use crate::evb::error::EVBError; @@ -49,6 +50,7 @@ impl Default for EvbAppParams { #[derive(Debug, PartialEq, Serialize, Deserialize)] enum ActiveTab { + Archivist, MainTab, Kinematics, ChannelMap, @@ -68,6 +70,7 @@ pub struct EVBApp { progress: Arc>, parameters: EvbAppParams, + archivist: Archivist, rxn_eqn: String, active_tab: ActiveTab, @@ -89,6 +92,7 @@ impl EVBApp { EVBApp { progress: Arc::new(Mutex::new(0.0)), parameters: EvbAppParams::default(), + archivist: Archivist::default(), active_tab: ActiveTab::MainTab, rxn_eqn: String::from("None"), mass_map: MassMap::new().expect("Could not open amdc data, shutting down!"), @@ -403,6 +407,12 @@ impl EVBApp { fn ui_tabs(&mut self, ui: &mut egui::Ui) { egui::TopBottomPanel::top("cebra_sps_top_panel").show_inside(ui, |ui| { ui.horizontal(|ui| { + if ui + .selectable_label(matches!(self.active_tab, ActiveTab::Archivist), "Archivist") + .clicked() + { + self.active_tab = ActiveTab::Archivist; + } if ui .selectable_label( matches!(self.active_tab, ActiveTab::MainTab), @@ -449,6 +459,7 @@ impl EVBApp { }); egui::ScrollArea::both().show(ui, |ui| match self.active_tab { + ActiveTab::Archivist => self.archivist.ui(ui), ActiveTab::MainTab => self.main_tab_ui(ui), ActiveTab::Kinematics => self.kinematics_ui(ui), ActiveTab::ChannelMap => self.channel_map_ui(ui), From 8c1f9eb895d460380dca8912c499c84cca2e6cf7 Mon Sep 17 00:00:00 2001 From: alconley Date: Fri, 17 Jan 2025 10:27:01 -0500 Subject: [PATCH 2/4] modified: etc/archivist.sh modified: src/evb/archivist.rs --- etc/archivist.sh | 4 +- src/evb/archivist.rs | 176 +++++++++++++++++-------------------------- 2 files changed, 72 insertions(+), 108 deletions(-) diff --git a/etc/archivist.sh b/etc/archivist.sh index fa6fcd0..f0a02f6 100755 --- a/etc/archivist.sh +++ b/etc/archivist.sh @@ -1,9 +1,9 @@ #!/bin/bash RUNNO=$1 -BINARYDIR=/Users/alconley/Projects/CatrinaTests/DAQ/run_$RUNNO/UNFILTERED +BINARYDIR=/home/alconley/Projects/January_2025_207Bi/DAQ/run_$RUNNO/UNFILTERED -ARCHIVE=/Users/alconley/Projects/CatrinaTests/WorkingDir/raw_binary/run_$RUNNO.tar.gz +ARCHIVE=/home/alconley/Projects/January_2025_207Bi/WorkingDir/raw_binary/run_$RUNNO.tar.gz echo "Running archivist for binary data in $BINARYDIR to archive $ARCHIVE..." diff --git a/src/evb/archivist.rs b/src/evb/archivist.rs index d52b000..2cc53f7 100644 --- a/src/evb/archivist.rs +++ b/src/evb/archivist.rs @@ -15,7 +15,7 @@ impl Default for SSH { enabled: false, user: "spieker-group".to_string(), host: "spiekerlab.physics.fsu.edu".to_string(), - password: String::new(), + password: "$PIEKER#_group".to_string(), } } } @@ -31,24 +31,28 @@ pub struct Archivist { } impl Archivist { - pub fn run_archive(&self, run_no: u32) -> Result<(), String> { - let binary_dir = format!("{}/run_{}/UNFILTERED", self.compass_path, run_no); + pub fn run_archive(&self, run_no: u32) { + let output_path = PathBuf::from(&self.output_path); + if !output_path.exists() { + log::error!("Output path {:?} does not exist", output_path); + return; + } + let archive_path = format!("{}/run_{}.tar.gz", self.output_path, run_no); - - // Convert paths to PathBuf for proper handling - let binary_dir = PathBuf::from(&binary_dir); let archive_path = PathBuf::from(&archive_path); - - // Check if binary_dir exists + + let binary_dir = format!("{}/DAQ/run_{}/UNFILTERED", self.compass_path, run_no); + let binary_dir = PathBuf::from(&binary_dir); if !binary_dir.exists() { - return Err(format!("Binary data directory {:?} does not exist", binary_dir)); + log::error!("Binary data directory {:?} does not exist", binary_dir); + return; } - + println!( "Running archivist for binary data in {:?} to archive {:?}...", binary_dir, archive_path ); - + let output = Command::new("bash") .arg("-c") .arg(format!( @@ -57,74 +61,30 @@ impl Archivist { archive_path.display() )) .output(); - - match output { - Ok(output) => { - if output.status.success() { - println!("Archive complete."); - Ok(()) - } else { - Err(format!( - "Error during archiving: {}", - String::from_utf8_lossy(&output.stderr) - )) - } - } - Err(e) => Err(format!("Failed to run command: {}", e)), - } - } - pub fn run_archive_ssh(&self, run_no: u32) -> Result<(), String> { - if !self.ssh.enabled { - return Err("SSH is not enabled.".to_string()); + if let Err(e) = output { + log::error!("Failed to run command: {}", e); + return; } - let remote_binary_dir = format!("{}/run_{}/UNFILTERED", self.compass_path, run_no); - let local_archive_path = format!("{}/run_{}.tar.gz", self.output_path, run_no); - - // Ensure the local archive path is valid - let local_archive_path = PathBuf::from(&local_archive_path); - - println!( - "Archiving files from remote: {}@{}:{} to local: {:?}", - self.ssh.user, self.ssh.host, remote_binary_dir, local_archive_path - ); - - // SSH command to tar files on the remote server - let tar_command = format!( - "sshpass -p {} {}@{} cd {}; tar -czf - ./*.BIN'", - self.ssh.password, self.ssh.user, self.ssh.host, remote_binary_dir - ); - - // SCP command to send the tarball locally - let scp_command = format!( - "{} > {:?}", - tar_command, - local_archive_path.display() - ); - - // Execute the tar and transfer command - let output = Command::new("bash") - .arg("-c") - .arg(&scp_command) - .output(); - - match output { - Ok(output) => { - if output.status.success() { - println!("Archive successfully transferred to local machine."); - Ok(()) - } else { - Err(format!( - "Error during SSH tar/scp operation: {}", - String::from_utf8_lossy(&output.stderr) - )) - } - } - Err(e) => Err(format!("Failed to execute SSH tar/scp command: {}", e)), + let output = output.unwrap(); + if !output.status.success() { + log::error!( + "Error during archiving: {}", + String::from_utf8_lossy(&output.stderr) + ); + } else { + // print the stdout + println!("{}", String::from_utf8_lossy(&output.stdout)); } } + // pub fn run_archive_ssh(&self, run_no: u32) { + // let password = self.ssh.password.clone(); + // let user = self.ssh.user.clone(); + // let host = self.ssh.host.clone(); + // } + pub fn ui(&mut self, ui: &mut egui::Ui) { ui.horizontal(|ui| { ui.label( @@ -148,24 +108,22 @@ impl Archivist { }); if self.ssh.enabled { - ui.add(egui::TextEdit::singleline(&mut self.ssh.password).hint_text("SSH password").password(true)); + ui.add( + egui::TextEdit::singleline(&mut self.ssh.password) + .hint_text("SSH password") + .password(true), + ); } ui.horizontal(|ui| { ui.label("Compass DAQ Folder"); - ui.add( - egui::TextEdit::singleline(&mut self.compass_path) - .clip_text(false), - ); + ui.add(egui::TextEdit::singleline(&mut self.compass_path).clip_text(false)); + ui.label("/DAQ/run_#/UNFLITERED/*.BIN"); }); - ui.horizontal(|ui| { ui.label("Local Output Folder"); - ui.add( - egui::TextEdit::singleline(&mut self.output_path) - .clip_text(false), - ); + ui.add(egui::TextEdit::singleline(&mut self.output_path).clip_text(false)); }); ui.horizontal(|ui| { @@ -177,33 +135,39 @@ impl Archivist { ui.checkbox(&mut self.multiple_runs, "Multiple runs"); }); - if ui.button("Archive").clicked() { - if self.ssh.enabled { - if self.multiple_runs { - for run_no in self.min_run..=self.max_run { - if let Err(e) = self.run_archive_ssh(run_no) { - eprintln!("Error archiving run {}: {}", run_no, e); - } - } - } else { - if let Err(e) = self.run_archive_ssh(self.min_run) { - eprintln!("Error archiving run {}: {}", self.min_run, e); - } + if self.multiple_runs { + for run in self.min_run..=self.max_run { + self.run_archive(run); } } else { - if self.multiple_runs { - for run_no in self.min_run..=self.max_run { - if let Err(e) = self.run_archive(run_no) { - eprintln!("Error archiving run {}: {}", run_no, e); - } - } - } else { - if let Err(e) = self.run_archive(self.min_run) { - eprintln!("Error archiving run {}: {}", self.min_run, e); - } - } + self.run_archive(self.min_run); } + // if self.ssh.enabled { + // if self.multiple_runs { + // for run_no in self.min_run..=self.max_run { + // if let Err(e) = self.run_archive_ssh(run_no) { + // eprintln!("Error archiving run {}: {}", run_no, e); + // } + // } + // } else { + // if let Err(e) = self.run_archive_ssh(self.min_run) { + // eprintln!("Error archiving run {}: {}", self.min_run, e); + // } + // } + // } else { + // if self.multiple_runs { + // for run_no in self.min_run..=self.max_run { + // if let Err(e) = self.run_archive(run_no) { + // eprintln!("Error archiving run {}: {}", run_no, e); + // } + // } + // } else { + // if let Err(e) = self.run_archive(self.min_run) { + // eprintln!("Error archiving run {}: {}", self.min_run, e); + // } + // } + // } } } } From d92de0aa078b885eadab090717310fd8abc3496c Mon Sep 17 00:00:00 2001 From: alconley Date: Fri, 17 Jan 2025 14:35:39 -0500 Subject: [PATCH 3/4] modified: README.md modified: src/evb/archivist.rs modified: src/evb/kinematics.rs modified: src/ui/app.rs --- README.md | 2 +- src/evb/archivist.rs | 153 ++++++++++++++++++++++++++++++++---------- src/evb/kinematics.rs | 32 +++------ src/ui/app.rs | 3 + 4 files changed, 131 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 609f909..8e24d34 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Make sure you are using the latest version of stable rust by running `rustup upd On Linux you need to first run: -`sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libgtk-3-dev` +`sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libgtk-3-dev sshpass` On Fedora Rawhide you need to run: diff --git a/src/evb/archivist.rs b/src/evb/archivist.rs index 2cc53f7..7b722ef 100644 --- a/src/evb/archivist.rs +++ b/src/evb/archivist.rs @@ -79,11 +79,121 @@ impl Archivist { } } - // pub fn run_archive_ssh(&self, run_no: u32) { - // let password = self.ssh.password.clone(); - // let user = self.ssh.user.clone(); - // let host = self.ssh.host.clone(); - // } + pub fn run_archive_ssh(&self, run_no: u32) { + if !self.ssh.enabled { + log::error!("SSH is not enabled in the configuration."); + return; + } + + let archive_path = format!("{}/run_{}.tar.gz", self.output_path, run_no); + let binary_dir = format!("{}/DAQ/run_{}/UNFILTERED", self.compass_path, run_no); + + println!( + "Running archivist over SSH for binary data in {:?} to create archive {:?}...", + binary_dir, archive_path + ); + + // Step 1: Tar the files on the remote server + let remote_archive_path = format!("/tmp/run_{}.tar.gz", run_no); + let ssh_tar_command = format!( + "sshpass -p '{}' ssh {}@{} \"cd {} && tar -cvzf {} ./*.BIN\"", + self.ssh.password, self.ssh.user, self.ssh.host, binary_dir, remote_archive_path + ); + + let tar_output = Command::new("bash") + .arg("-c") + .arg(&ssh_tar_command) + .output(); + + if let Err(e) = tar_output { + log::error!("Failed to run SSH tar command: {}", e); + return; + } + + let tar_output = tar_output.unwrap(); + if !tar_output.status.success() { + log::error!( + "Error during remote tar creation: {}", + String::from_utf8_lossy(&tar_output.stderr) + ); + return; + } + + println!( + "\tRemote tarball created successfully at {:?}.", + remote_archive_path + ); + + // Step 2: Copy the tarball from the remote server to the local machine + let scp_command = format!( + "sshpass -p '{}' scp {}@{}:{} {}", + self.ssh.password, self.ssh.user, self.ssh.host, remote_archive_path, archive_path + ); + + let scp_output = Command::new("bash").arg("-c").arg(&scp_command).output(); + + if let Err(e) = scp_output { + log::error!("Failed to run SCP command: {}", e); + return; + } + + let scp_output = scp_output.unwrap(); + if !scp_output.status.success() { + log::error!( + "Error during SCP: {}", + String::from_utf8_lossy(&scp_output.stderr) + ); + return; + } + + println!( + "\tTarball successfully copied to local path {:?}.", + archive_path + ); + + // Step 3: Optionally clean up the remote tarball + let ssh_cleanup_command = format!( + "sshpass -p '{}' ssh {}@{} \"rm -f {}\"", + self.ssh.password, self.ssh.user, self.ssh.host, remote_archive_path + ); + + let cleanup_output = Command::new("bash") + .arg("-c") + .arg(&ssh_cleanup_command) + .output(); + + if let Err(e) = cleanup_output { + log::warn!("Failed to clean up remote tarball: {}", e); + } else { + let cleanup_output = cleanup_output.unwrap(); + if !cleanup_output.status.success() { + log::warn!( + "Error during remote cleanup: {}", + String::from_utf8_lossy(&cleanup_output.stderr) + ); + } else { + println!("\tRemote tarball cleaned up successfully."); + } + } + } + + fn archive(&self) { + if self.ssh.enabled { + if self.multiple_runs { + for run_no in self.min_run..=self.max_run { + self.run_archive_ssh(run_no); + } + } else { + self.run_archive_ssh(self.min_run); + } + } else if self.multiple_runs { + for run_no in self.min_run..=self.max_run { + self.run_archive(run_no); + } + } else { + self.run_archive(self.min_run); + } + } pub fn ui(&mut self, ui: &mut egui::Ui) { ui.horizontal(|ui| { @@ -136,38 +246,7 @@ impl Archivist { }); if ui.button("Archive").clicked() { - if self.multiple_runs { - for run in self.min_run..=self.max_run { - self.run_archive(run); - } - } else { - self.run_archive(self.min_run); - } - // if self.ssh.enabled { - // if self.multiple_runs { - // for run_no in self.min_run..=self.max_run { - // if let Err(e) = self.run_archive_ssh(run_no) { - // eprintln!("Error archiving run {}: {}", run_no, e); - // } - // } - // } else { - // if let Err(e) = self.run_archive_ssh(self.min_run) { - // eprintln!("Error archiving run {}: {}", self.min_run, e); - // } - // } - // } else { - // if self.multiple_runs { - // for run_no in self.min_run..=self.max_run { - // if let Err(e) = self.run_archive(run_no) { - // eprintln!("Error archiving run {}: {}", run_no, e); - // } - // } - // } else { - // if let Err(e) = self.run_archive(self.min_run) { - // eprintln!("Error archiving run {}: {}", self.min_run, e); - // } - // } - // } + self.archive(); } } } diff --git a/src/evb/kinematics.rs b/src/evb/kinematics.rs index 45fd341..61f9e77 100644 --- a/src/evb/kinematics.rs +++ b/src/evb/kinematics.rs @@ -103,24 +103,17 @@ impl KineParameters { //Returns z-offset of focal plane in cm fn calculate_z_offset(params: &KineParameters, nuc_map: &MassMap) -> Option { - let target = match nuc_map.get_data(¶ms.target_z, ¶ms.target_a) { - Some(data) => data, - None => return None, - }; - + let target = nuc_map.get_data(¶ms.target_z, ¶ms.target_a)?; info!("Target: {:?}", target); - let projectile = match nuc_map.get_data(¶ms.projectile_z, ¶ms.projectile_a) { - Some(data) => data, - None => return None, - }; - let ejectile = match nuc_map.get_data(¶ms.ejectile_z, ¶ms.ejectile_a) { - Some(data) => data, - None => return None, - }; - let residual = match nuc_map.get_data(¶ms.get_residual_z(), ¶ms.get_residual_a()) { - Some(data) => data, - None => return None, - }; + + let projectile = nuc_map.get_data(¶ms.projectile_z, ¶ms.projectile_a)?; + info!("Projectile: {:?}", projectile); + + let ejectile = nuc_map.get_data(¶ms.ejectile_z, ¶ms.ejectile_a)?; + info!("Ejectile: {:?}", ejectile); + + let residual = nuc_map.get_data(¶ms.get_residual_z(), ¶ms.get_residual_a())?; + info!("Residual: {:?}", residual); let angle_rads = params.sps_angle.to_radians(); let q_val = target.mass + projectile.mass - ejectile.mass - residual.mass; @@ -150,10 +143,7 @@ fn calculate_z_offset(params: &KineParameters, nuc_map: &MassMap) -> Option //Calculate weights for correcting focal plane position for kinematic shift //Returns tuple of weights where should be used like xavg = x1 * result.0 + x2 * result.1 pub fn calculate_weights(params: &KineParameters, nuc_map: &MassMap) -> Option<(f64, f64)> { - let z_offset = match calculate_z_offset(params, nuc_map) { - Some(z) => z, - None => return None, - }; + let z_offset = calculate_z_offset(params, nuc_map)?; let w1 = 0.5 - z_offset / SPS_DETECTOR_WIRE_DIST; let w2 = 1.0 - w1; Some((w1, w2)) diff --git a/src/ui/app.rs b/src/ui/app.rs index 789e7b4..534037c 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -469,6 +469,9 @@ impl EVBApp { } fn progress_ui(&mut self, ui: &mut egui::Ui) { + if self.active_tab == ActiveTab::Archivist { + return; + } egui::TopBottomPanel::bottom("cebra_sps_bottom_panel").show_inside(ui, |ui| { ui.add( egui::widgets::ProgressBar::new(match self.progress.lock() { From 93a591b8cb45e05cbae240db61c06f0ce5017411 Mon Sep 17 00:00:00 2001 From: alconley Date: Fri, 17 Jan 2025 14:37:45 -0500 Subject: [PATCH 4/4] modified: src/evb/archivist.rs --- src/evb/archivist.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evb/archivist.rs b/src/evb/archivist.rs index 7b722ef..e207b3c 100644 --- a/src/evb/archivist.rs +++ b/src/evb/archivist.rs @@ -15,7 +15,7 @@ impl Default for SSH { enabled: false, user: "spieker-group".to_string(), host: "spiekerlab.physics.fsu.edu".to_string(), - password: "$PIEKER#_group".to_string(), + password: "".to_string(), } } }