Skip to content

Commit fbd5e1d

Browse files
committed
code quality
1 parent e5e4a42 commit fbd5e1d

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

src/bin/noise_generator.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,28 +121,28 @@ struct Args {
121121
/// - "mock": mock photoacoustic signal with pulses over white noise
122122
#[arg(long, default_value = "white")]
123123
noise_type: String,
124-
124+
125125
/// Pulse frequency in Hz for mock signal (only used with --noise-type=mock)
126126
///
127127
/// Frequency of the pulsed sinusoidal signal to add to the white noise.
128128
/// This simulates the fundamental frequency of a photoacoustic excitation signal.
129129
#[arg(long, default_value_t = 2000.0)]
130130
pulse_frequency: f32,
131-
131+
132132
/// Pulse width in seconds for mock signal (only used with --noise-type=mock)
133133
///
134134
/// Duration of each pulse in the mock signal, specified in seconds.
135135
/// Controls how long each pulse lasts within a signal cycle.
136136
#[arg(long, default_value_t = 0.04)]
137137
pulse_width: f32,
138-
138+
139139
/// Minimum pulse amplitude for mock signal (only used with --noise-type=mock)
140140
///
141141
/// The minimum amplitude of the random pulse signal, in the range [0.0, 1.0].
142142
/// Together with max_pulse_amplitude, this defines the range for random pulse amplitudes.
143143
#[arg(long, default_value_t = 0.8)]
144144
min_pulse_amplitude: f32,
145-
145+
146146
/// Maximum pulse amplitude for mock signal (only used with --noise-type=mock)
147147
///
148148
/// The maximum amplitude of the random pulse signal, in the range [0.0, 1.0].
@@ -202,29 +202,29 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
202202
eprintln!("Error: Noise type must be 'white' or 'mock'");
203203
std::process::exit(1);
204204
}
205-
205+
206206
// Validate pulse parameters if using mock signal
207207
if args.noise_type == "mock" {
208208
if args.min_pulse_amplitude < 0.0 || args.min_pulse_amplitude > 1.0 {
209209
eprintln!("Error: Minimum pulse amplitude must be between 0.0 and 1.0");
210210
std::process::exit(1);
211211
}
212-
212+
213213
if args.max_pulse_amplitude < 0.0 || args.max_pulse_amplitude > 1.0 {
214214
eprintln!("Error: Maximum pulse amplitude must be between 0.0 and 1.0");
215215
std::process::exit(1);
216216
}
217-
217+
218218
if args.min_pulse_amplitude > args.max_pulse_amplitude {
219219
eprintln!("Error: Minimum pulse amplitude must be less than or equal to maximum pulse amplitude");
220220
std::process::exit(1);
221221
}
222-
222+
223223
if args.pulse_width <= 0.0 {
224224
eprintln!("Error: Pulse width must be greater than 0");
225225
std::process::exit(1);
226226
}
227-
227+
228228
if args.pulse_frequency <= 0.0 {
229229
eprintln!("Error: Pulse frequency must be greater than 0");
230230
std::process::exit(1);
@@ -242,16 +242,22 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
242242
if args.noise_type == "white" {
243243
println!("Generating {} seconds of white noise...", args.duration);
244244
} else {
245-
println!("Generating {} seconds of mock photoacoustic signal...", args.duration);
245+
println!(
246+
"Generating {} seconds of mock photoacoustic signal...",
247+
args.duration
248+
);
246249
println!("Pulse frequency: {} Hz", args.pulse_frequency);
247250
println!("Pulse width: {} ms", args.pulse_width * 1000.0);
248-
println!("Pulse amplitude range: {:.1} to {:.1}", args.min_pulse_amplitude, args.max_pulse_amplitude);
251+
println!(
252+
"Pulse amplitude range: {:.1} to {:.1}",
253+
args.min_pulse_amplitude, args.max_pulse_amplitude
254+
);
249255
}
250-
256+
251257
println!("Sample rate: {} Hz", args.sample_rate);
252258
println!("Channels: {}", args.channels);
253259
println!("Background noise amplitude: {}", args.amplitude);
254-
260+
255261
if (args.channels == 2 && args.correlated) {
256262
println!("Channel correlation: {}", args.correlation);
257263
}
@@ -279,13 +285,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
279285
// Mock photoacoustic signal generation
280286
if args.channels == 1 {
281287
generator.generate_mock_photoacoustic_mono(
282-
num_samples,
288+
num_samples,
283289
args.sample_rate,
284290
args.amplitude,
285291
args.pulse_frequency,
286292
args.pulse_width,
287293
args.min_pulse_amplitude,
288-
args.max_pulse_amplitude
294+
args.max_pulse_amplitude,
289295
)
290296
} else if args.correlated && args.correlation != 0.0 {
291297
generator.generate_mock_photoacoustic_correlated(
@@ -296,7 +302,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
296302
args.pulse_width,
297303
args.min_pulse_amplitude,
298304
args.max_pulse_amplitude,
299-
args.correlation
305+
args.correlation,
300306
)
301307
} else {
302308
generator.generate_mock_photoacoustic_stereo(
@@ -306,7 +312,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
306312
args.pulse_frequency,
307313
args.pulse_width,
308314
args.min_pulse_amplitude,
309-
args.max_pulse_amplitude
315+
args.max_pulse_amplitude,
310316
)
311317
}
312318
};

src/daemon/launch_daemon.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl Daemon {
280280
// Perform data acquisition
281281
// This would integrate with our acquisition module
282282
debug!("Acquiring data... currently nothing");
283-
time::sleep(Duration::from_millis(1000*60)).await;
283+
time::sleep(Duration::from_millis(1000 * 60)).await;
284284
}
285285
Ok(())
286286
});

0 commit comments

Comments
 (0)