You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -219,249 +219,43 @@ This architecture ensures both interactive visualization and programmatic access
219
219
- `--output`: Output file for results (JSON)
220
220
- `--window-size`: Analysis window size in samples (default: 4096)
221
221
- `--averages`: Number of spectra to average (default: 10)
222
-
223
-
## Noise Generator Utility
224
-
225
-
The project includes a standalone noise signal generator utility, located at `src/utility/noise_generator.rs` and available as a binary target. This tool is useful for generating synthetic white noise signals or simulated photoacoustic signals for testing and calibration of the signal processing pipeline.
226
-
227
-
### Usage
228
-
229
-
You can run the noise generator from the command line:
230
-
231
-
```bash
232
-
cargo run --bin noise_generator [OPTIONS]
233
-
```
234
-
235
-
### Command Line Options
236
-
237
-
- `--output <FILE>`: Specify the output WAV file for the generated noise (required).
238
-
- `--duration <SECONDS>`: Duration of the generated noise in seconds (default: 5).
239
-
- `--sample-rate <HZ>`: Sampling rate of the output file (default: 48000).
240
-
- `--channels <N>`: Number of audio channels (default: 2).
241
-
- `--correlated`: Set to true to use correlations between channels (default is independent)
242
-
- `--correlation <VALUE>`: Correlation coefficient between channels (-1.0 to 1.0) (default: 0)
243
-
- `--amplitude <VALUE>`: Amplitude of the noise signal (default: 0.3).
244
-
- `--noise-type <TYPE>`: Type of noise to generate (default: "white"):
245
-
- `white`: Pure Gaussian white noise
246
-
- `mock`: Mock photoacoustic signal with pulses over white noise
247
-
- `--pulse-frequency <HZ>`: Frequency of pulses for mock signals (default: 2000.0).
248
-
- `--pulse-width <SECONDS>`: Width of each pulse in seconds (default: 0.04).
249
-
- `--min-pulse-amplitude <VALUE>`: Minimum amplitude of pulses (default: 0.8).
250
-
- `--max-pulse-amplitude <VALUE>`: Maximum amplitude of pulses (default: 1.0).
cargo run --bin noise_generator -- --output correlated_mock.wav --noise-type mock \
268
-
--correlated --correlation 0.8
269
-
```
270
-
271
-
### Mock Photoacoustic Signals
272
-
273
-
The mock signal generator creates synthetic signals that mimic real photoacoustic measurements:
274
-
275
-
- Base white noise represents background noise in the measurement environment
276
-
- Pulsed sinusoidal signals simulate the photoacoustic response from water vapor
277
-
- Random amplitude variations simulate fluctuations in absorption strength
278
-
- Configurable parameters allow for testing under different conditions
279
-
280
-
These signals are particularly useful for:
281
-
282
-
- Testing and validating signal processing algorithms
283
-
- Calibrating system performance
284
-
- Developing and refining filtering techniques
285
-
- Evaluating correlation effects in differential measurements
286
-
- Benchmarking detection limits under controlled noise conditions
287
-
288
-
## Differential Signal Utility
289
-
290
-
The project includes a differential signal processing utility, located at `src/bin/differential.rs`. This tool enables you to create differential signals from WAV files in several ways:
291
-
292
-
1. Process a stereo WAV file to output the difference between left and right channels (L-R or R-L)
293
-
2. Process two mono WAV files to output their difference (file1-file2)
294
-
295
-
### Usage
296
-
297
-
You can run the differential processor from the command line:
222
+
- `--server`: Start in server mode (default: true)
223
+
- `--web-port`, `-p`: Web server port (default: 8080)
224
+
- `--web-address`: Web server address (default: localhost)
225
+
- `--hmac-secret`: HMAC secret for JWT signing
226
+
- `--config`: Path to configuration file (YAML format)
227
+
- `--show-config-schema`: Output the configuration schema as JSON and exit
This utility is particularly useful for testing the differential signal processing algorithms or preparing test files.
325
-
326
-
## Audio Filter Utility
253
+
The logging levels are:
327
254
328
-
The project includes a standalone audio filter utility, located at `src/bin/filters.rs`. This tool allows for the application of different digital filters to WAV files for signal processing and analysis.
329
-
330
-
### Usage
331
-
332
-
You can run the filter processor from the command line:
333
-
334
-
```bash
335
-
cargo run --bin filters [OPTIONS]
336
-
```
337
-
338
-
### Command Line Options
339
-
340
-
- `--input`, `-i <FILE>`: Input WAV file.
341
-
- `--output`, `-o <FILE>`: Output WAV file.
342
-
- `--filter-type`, `-t <TYPE>`: Filter type to apply (default: bandpass):
343
-
- `bandpass`: Bandpass filter around a center frequency
344
-
- `lowpass`: Lowpass filter with specific cutoff
345
-
- `--center-freq`, `-f <HZ>`: Center frequency in Hz for bandpass filter (default: 2000.0).
346
-
- `--bandwidth`, `-b <HZ>`: Bandwidth in Hz for bandpass filter (default: 100.0).
347
-
- `--cutoff-freq`, `-c <HZ>`: Cutoff frequency in Hz for lowpass filter (default: 5000.0).
348
-
- `--order`, `-n <ORDER>`: Filter order for bandpass filter, must be even (default: 4).
349
-
- `--channel`, `-l <NUMBER>`: Apply filter to specific channel only (default: all channels).
350
-
- `--gain`, `-g <VALUE>`: Gain to apply to the output signal (default: 1.0).
351
-
352
-
### Examples
353
-
354
-
```bash
355
-
# Apply a bandpass filter centered at 1000 Hz with 50 Hz bandwidth
This utility is useful for isolating specific frequency components in your audio signals or removing unwanted noise before analysis.
369
-
370
-
## Continuous Integration
371
-
372
-
This project uses GitHub Actions for continuous integration. The CI pipeline automatically builds and tests the code on multiple platforms:
373
-
374
-
- Windows (x86_64)
375
-
- Ubuntu Linux (x86_64 and ARM64)
376
-
- macOS (x86_64 and ARM64)
377
-
378
-
The CI workflow includes:
379
-
380
-
- Building the project for all target platforms
381
-
- Running tests
382
-
- Special handling for tests that require specific timeouts (like introspection tests)
383
-
- Code quality checks (formatting and linting)
384
-
385
-
You can see the workflow status in the GitHub repository under the Actions tab.
386
-
387
-
## Modbus Client Utility
388
-
389
-
The project includes a Modbus client utility located at `src/bin/modbus_client.rs`. This tool allows you to interact with the Modbus TCP server component of the photoacoustic analyzer, reading sensor values and configuration parameters via the Modbus protocol.
390
-
391
-
### Usage
392
-
393
-
You can run the Modbus client from the command line:
394
-
395
-
```bash
396
-
cargo run --bin modbus_client [OPTIONS]
397
-
```
398
-
399
-
### Command Line Options
400
-
401
-
- `--address <IP>`: The IP address of the Modbus server (default: 127.0.0.1)
402
-
- `--port <PORT>`: The port number of the Modbus server (default: 502)
403
-
- `--input-register <ADDRESS>`: Starting input register address to read from (default: 0)
404
-
- `--quantity <NUMBER>`: Number of registers to read (default: 6)
405
-
406
-
### Example Usage
407
-
408
-
```bash
409
-
# Read the default registers from a local Modbus server
410
-
cargo run --bin modbus_client
411
-
412
-
# Connect to a remote server on a non-standard port
413
-
cargo run --bin modbus_client -- --address 192.168.1.100 --port 1502
414
-
415
-
# Read a specific range of registers
416
-
cargo run --bin modbus_client -- --input-register 2 --quantity 3
417
-
```
418
-
419
-
### Understanding Register Values
420
-
421
-
The raw register values may need interpretation according to the Modbus server's register map:
422
-
423
-
- Register 0: Resonance frequency (Hz × 10, divide by 10.0 for actual value)
424
-
- Register 1: Signal amplitude (× 1000, divide by 1000.0 for actual value)
425
-
- Register 2: Water vapor concentration (ppm × 10, divide by 10.0 for actual value)
426
-
- Registers 3-4: Timestamp as low and high words of a 32-bit UNIX timestamp
427
-
- Register 5: Status code (0=normal, 1=warning, 2=error)
428
-
429
-
For more comprehensive interaction with the Modbus server, refer to the example at `examples/modbus_client.rs`.
430
-
431
-
## Utility Functions
432
-
433
-
### Certificate Utilities
434
-
435
-
The project includes a utility module for generating self-signed SSL certificates at `src/utility/certificate_utilities.rs`. This can be used programmatically:
436
-
437
-
```rust
438
-
use rust_photoacoustic::utility::certificate_utilities;
439
-
440
-
// Generate a self-signed certificate
441
-
certificate_utilities::create_self_signed_cert(
442
-
365, // Valid for 365 days
443
-
"path/to/cert.pem", // Certificate output path
444
-
"path/to/cert.key", // Private key output path
445
-
"localhost", // Common name for the certificate
446
-
None, // Optional key length (default: 2048)
447
-
Some(vec![ // Optional subject alternative names
448
-
"localhost".to_string(),
449
-
"127.0.0.1".to_string(),
450
-
"::1".to_string()
451
-
])
452
-
)?;
453
-
```
454
-
455
-
This utility is used by the build process to automatically generate development certificates, but can also be used in your own code when needed.
456
-
457
-
### Running Tests Locally
458
-
459
-
To run the tests locally:
460
-
461
-
```bash
462
-
# Run all tests
463
-
cargo test
464
-
465
-
# Run a specific test with output displayed
466
-
cargo test --test introspection_test -- --nocapture
467
-
```
261
+
You can also control logging using the `RUST_LOG` environment variable, which will be respected in addition to these command line options.
0 commit comments