Data Analysis Package for LInoSpad - Real-Time Plotting
Project description
Data Analysis Package for LInoSpad - Real-Time Plotting (DAPLIS-RTP).
Package with an application for real-time plotting of sensor population for LinoSPAD2. A spin-off of the main data analysis package [daplis][https://github.com/rngKomorebi/LinoSPAD2]
Full documentation (including all docstrings) can be found here.
Introduction
The main purpose of this application is real-time plotting of LinoSPAD2 sensor population for easier handling of the setup. Given the detector data acquisition is running and once a path to where data files should be saved to, the program constantly checks for the latest saved file, then unpacks the data, and plots it as a number of photons detected in each pixel.
Additionally, a separate tab for checking the data quality by looking at the distribution of timestamps across the whole acquisition cycle is provided: if the distribution is uniform, the data is ok. The third tab can be used for plotting the number of photons from two pixels vs the data file as two curves with primary application in Mach-Zehnder interferometer setup.
This repo was separated from the main library of scripts for LinoSPAD2 data analysis. The reason is that the app requires its own 'main.py' to run and having it as a standalone makes it quite easy to generate an executable with pyinstaller.
Installation and usage
To start using the package, one can download the whole repo. The 'main.py' serves as the main hub for starting the app. "requirements.txt" lists all packages required for this project to run. One can create an environment for this project either using conda or install the necessary packages using pip (for creating virtual environments using pip see this).
Using pip:
pip install virtualenv
py -m venv NEW_ENVIRONMENT_NAME
PATH/TO/NEW_ENVIRONMENT_NAME/Scripts/activate
cd PATH/TO/THIS/PACKAGE
pip install -r requirements.txt
pip install -e .
Using conda:
conda create --name NEW_ENVIRONMENT_NAME
conda activate NEW_ENVIRONMENT NAME
cd PATH/TO/THIS/PACKAGE
conda install --file requirements.txt -c conda-forge
pip install -e .
Finally, to run the app, run the 'main.py' script.
Executable
On Windows, to create an executable, one can run the following: first, a separate virtual environment is highly recommended for a faster and smoother experience with the app, as pyinstaller packs everything it finds in the virtual environment; using pip:
pip install virtualenv
py -m venv PATH/TO/NEW_ENVIRONMENT_NAME
PATH/TO/NEW_ENVIRONMENT_NAME/Scripts/activate
where the last command activates the environment. Here, all the necessary packages along with the app package itself should be installed. To do this, run from the environment (given the package was downloaded):
cd PATH/TO/THIS/PACKAGE/src/LinoSPAD2app
pip install -r requirements.txt
pip install -e .
where the latter command installs the package itself in the environment. To create the executable, pyinstaller should be installed, too:
pip install pyinstaller
Then, given the current directory is set to where the package is, run
pyinstaller --clean --onedir --noconsole main.py
which packs everything in the package for the "main.exe" executable for the app. Options '--onedir' for installing everything into a single directory and '--noconsole' for running the app without a console are recommended. Additionally, in the '_tab.py' files, change the first lines in the 'init' functions to the following:
def __init__(self, parent=None):
super().__init__(parent)
os.chdir(r"FULL\PATH\TO\LinoSPAD2-app\gui\ui")
uic.loadUi(
r"LiveTimestamps_tab_c.ui",
self,
)
os.chdir("../..")
Full path to the '.ui' files should be provided as pyinstaller does not handle relative paths, as it's implemented in the package. To run the app, run 'main.exe' in the 'dist' folder.
If using conda, use the following chain of commands:
conda create --name NEW_ENVIRONMENT_NAME
conda activate NEW_ENVIRONMENT NAME
cd PATH/TO/THIS/PACKAGE
conda install --file requirements.txt -c conda-forge
conda install pyinstaller -c conda-forge
and the rest stay the same as for the installation using pip.
Dark theme app (Windows)
For dark theme enthusiasts, there is an option to run the app in dark mode (tested on Windows only). To do that, in the environment where the app is running, install qdarkstyle
pip install qdarkstyle
or, using conda
conda install qdarkstyle -c conda-forge
Then, in the 'main.py', import (uncomment) qdarkstyle and uncomment the 5th line in the following code block
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
# For dark theme
# app.setStyleSheet(qdarkstyle.load_stylesheet())
window.show()
app.exec()
that will run the app in dark mode. To apply dark theme for the matplotlib canvases as well, uncomment the 'plt.style.use()"dark_background")' in the 'plot_figure.py'.
How to contribute
This repo consists of two branches: 'main' serves as the release version of the package, tested, and proved to be functional and ready to use, while the 'develop' branch serves as the main hub for testing new stuff. To contribute, the best way would be to fork the 'develop' branch and submit via pull requests. Everyone willing to contribute is kindly asked to follow the PEP 8 and PEP 257 conventions.
License and contact info
This package is available under the MIT license. See LICENSE for more information. If you'd like to contact me, the author, feel free to write at sergei.kulkov23@gmail.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file daplis_rtp-0.9.0.tar.gz.
File metadata
- Download URL: daplis_rtp-0.9.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e513233dfe1857e38963229c7a49dc3f5db0d4093a1144e4fcbc492d4d796c2
|
|
| MD5 |
dc0d62acba70795546fb1af6d2016d3e
|
|
| BLAKE2b-256 |
f8a0d57443b6afb273eee670503747723b5f854f09de11b80385dcc3aaf4c2b1
|
File details
Details for the file daplis_rtp-0.9.0-py3-none-any.whl.
File metadata
- Download URL: daplis_rtp-0.9.0-py3-none-any.whl
- Upload date:
- Size: 37.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33bce2f5a1d87ef9e24eec1602813baa1ccf82c81b98adf6dc43ebd2d4af2157
|
|
| MD5 |
ac5af2fd304dbf8480424e777645e364
|
|
| BLAKE2b-256 |
c75075e5f1560c2bae44ccdb1c50aa3927600c5bcbc78636c9114899a8cbb16b
|