Skip to content

Commit

Permalink
Added filter before AM demodulation
Browse files Browse the repository at this point in the history
  • Loading branch information
martinber committed Sep 4, 2018
1 parent e23932a commit f800a52
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/noaa_apt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ pub fn decode(input_filename: &str, output_filename: &str) -> err::Result<()>{

let signal = dsp::demodulate(&signal, WORK_RATE, CARRIER_FREQ);

info!("Filtering");

let cutout: f32 = 4160. / WORK_RATE as f32;
let delta_w = cutout / 5.;
let lowpass = dsp::lowpass(cutout, 20., delta_w);
let signal = dsp::filter(&signal, &lowpass);

info!("Syncing");

// Get list of sync frames positions
Expand All @@ -143,9 +150,7 @@ pub fn decode(input_filename: &str, output_filename: &str) -> err::Result<()>{

debug!("Mapping samples from 0-{} to 0-255", max);

// TODO simplify to one line
let aligned: Signal = aligned.iter().map(|x| x/max).collect();
let aligned: Vec<u8> = aligned.iter().map(|x| (x*255.) as u8).collect();
let aligned: Vec<u8> = aligned.iter().map(|x| (x/max*255.) as u8).collect();

info!("Writing PNG to '{}'", output_filename);

Expand Down

0 comments on commit f800a52

Please sign in to comment.