Skip to content

Commit

Permalink
Added three different switchable stack reduction algorithms: Average,…
Browse files Browse the repository at this point in the history
… Median, and Minimum
  • Loading branch information
kmgill committed May 22, 2024
1 parent 2368ba3 commit 15cb13a
Show file tree
Hide file tree
Showing 10 changed files with 591 additions and 146 deletions.
2 changes: 1 addition & 1 deletion 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
@@ -1,6 +1,6 @@
[package]
name = "solhat"
version = "0.6.0"
version = "0.7.0"
authors = ["Kevin M. Gill <[email protected]>"]
edition = "2021"
description = "Solar Hydrogen Alpha Telescope: A set of utilities and a pipeline for processing raw hydrogen-alpha solar imaging using lucky imaging"
Expand Down
2 changes: 2 additions & 0 deletions bin/subs/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use solhat::calibrationframe::CalibrationImage;
use solhat::calibrationframe::ComputeMethod;
use solhat::context::*;
use solhat::drizzle::Scale;
use solhat::drizzle::StackAlgorithm;
use solhat::ser::SerFile;
use solhat::target::Target;

Expand Down Expand Up @@ -131,6 +132,7 @@ impl RunnableSubcommand for PreProcess {
max_sigma: self.maxsigma,
top_percentage: self.percentofmax,
drizzle_scale: Scale::from(&self.drizzle.to_owned().unwrap_or("1.0".to_owned()))?,
algorithm: StackAlgorithm::Average,
initial_rotation: self.rotation.unwrap_or(0.0),
flat_inputs: self.flat.to_owned(),
dark_inputs: self.dark.to_owned(),
Expand Down
7 changes: 3 additions & 4 deletions bin/subs/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use solhat::calibrationframe::CalibrationImage;
use solhat::calibrationframe::ComputeMethod;
use solhat::context::*;
use solhat::drizzle::Scale;
use solhat::drizzle::StackAlgorithm;
use solhat::limiting::frame_limit_determinate;
use solhat::offsetting::frame_offset_analysis;
use solhat::rotation::frame_rotation_analysis;
Expand Down Expand Up @@ -139,6 +140,7 @@ impl RunnableSubcommand for Process {
max_sigma: self.maxsigma,
top_percentage: self.percentofmax,
drizzle_scale: Scale::from(&self.drizzle.to_owned().unwrap_or("1.0".to_owned()))?,
algorithm: StackAlgorithm::Average,
initial_rotation: self.rotation.unwrap_or(0.0),
flat_inputs: self.flat.to_owned(),
dark_inputs: self.dark.to_owned(),
Expand Down Expand Up @@ -202,13 +204,10 @@ impl RunnableSubcommand for Process {
pb_zero!();
pb_set_prefix!("Stacking Frames");
pb_set_length!(context.frame_records.len());
let drizzle_output = process_frame_stacking(&context, |_fr| {
let mut stacked_buffer = process_frame_stacking(&context, |_fr| {
pb_inc!();
})?;

info!("Finalizing and saving");
let mut stacked_buffer = drizzle_output.get_finalized().unwrap();

// Zero would indicate that the user did not ask for cropping since that's not a valid crop dimension anyway
let crop_width = context.parameters.crop_width.unwrap_or(0);
let crop_height = context.parameters.crop_height.unwrap_or(0);
Expand Down
2 changes: 2 additions & 0 deletions bin/subs/threshtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use solhat::calibrationframe::CalibrationImage;
use solhat::calibrationframe::ComputeMethod;
use solhat::context::*;
use solhat::drizzle::Scale;
use solhat::drizzle::StackAlgorithm;
use solhat::ser::SerFile;
use solhat::target::Target;
use solhat::threshtest::compute_threshtest_image;
Expand Down Expand Up @@ -81,6 +82,7 @@ impl RunnableSubcommand for ThreshTest {
max_sigma: None,
top_percentage: None,
drizzle_scale: Scale::Scale1_0,
algorithm: StackAlgorithm::Average,
initial_rotation: 0.0,
flat_inputs: self.flat.to_owned(),
dark_inputs: self.dark.to_owned(),
Expand Down
3 changes: 2 additions & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sciimg::prelude::ImageBuffer;

use crate::calibrationframe::CalibrationImage;
use crate::datasource::DataSource;
use crate::drizzle::Scale;
use crate::drizzle::{Scale, StackAlgorithm};
use crate::fpmap::FpMap;
use crate::framerecord::FrameRecord;
use crate::hotpixel;
Expand All @@ -26,6 +26,7 @@ pub struct ProcessParameters {
pub max_sigma: Option<f64>,
pub top_percentage: Option<f64>,
pub drizzle_scale: Scale,
pub algorithm: StackAlgorithm,
pub initial_rotation: f64,
pub flat_inputs: Option<String>,
pub dark_inputs: Option<String>,
Expand Down
Loading

0 comments on commit 15cb13a

Please sign in to comment.