Self-mixing interferometry (SMI) offers a cost-effective and optically simple alternative to Michelson interferometry. However, adapting SMI for standard vibrometry remains challenging because analytical signal processing is brittle and sensitive to laser feedback conditions. Furthermore, achieving true portability for field deployment is limited by severe phase noise introduced in optical fibers.
This repository implements an optical and computational framework that overcomes these limitations, using a multispectral SMI array constructed from standard laboratory components. By leveraging convolutional neural networks, our signal processing pipeline reconstructs mechanical displacement with an RMSE below 200 nm directly through multimode fiber. This synergy of frugal optics and deep learning yields an accessible and precise vibrometry tool uniquely suited for hidden or physically constrained environments.
-
Clone the repository:
git clone https://github.com/username/your-project.git cd your-project -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the package with development dependencies:
pip install -e ".[dev]" -
Install pre-commit hooks:
pip install pre-commit nbstripout pre-commit install
-
Install the Marimo VSCode extension for interactive notebook support. Notebooks in
notebooks/are Marimo notebooks (.pyfiles) and can be opened withmarimo edit notebooks/<name>.pyor directly in VSCode with the extension. -
Create a new branch for your feature:
git checkout -b feature-name
-
Make your changes and run tasks:
# Run tests task test # Lint your code task lint # Format your code task format # Check spelling task spell # Run pre-commit hooks manually task precommit # Run format, lint and test in sequence task all
-
Commit and push your changes:
git add . git commit -m "Description of changes" git push origin feature-name
-
Open a Pull Request on GitHub
The main.py script provides two execution modes:
Train a neural network model using a YAML configuration file:
python main.py --config path/to/config.yamlArguments:
--config: Path to YAML configuration file (default:./analysis/configs/tcn-config.yaml)--verbosity: Set logging level (choices: DEBUG, INFO, WARNING, ERROR; default: INFO)
Example:
python main.py --config ./analysis/configs/tcn-config.yaml --verbosity DEBUGAcquire real experimental data from Red Pitaya hardware for training or testing:
python main.py --acquire_dataset --num_samples 5000 --dataset_name my-data.h5Arguments:
--acquire_dataset: Flag to enable dataset acquisition mode--num_samples: Number of samples to acquire (required with--acquire_dataset)--dataset_name: Filename for the acquired dataset (required with--acquire_dataset)
Example:
python main.py --acquire_dataset --num_samples 10000 --dataset_name experimental-data.h5 --verbosity INFONote: The Red Pitaya connection uses default settings configured in the RedPitayaManager. The acquired data will be saved to ./analysis/data/ directory.
To visualize predictions, residuals, and input gradient attributions from a trained checkpoint, use the interactive Marimo notebook:
marimo edit notebooks/predictions.pySet the checkpoint path and dataset path (or "synthetic") in the UI controls at the top of the notebook.