daplis-rtp


Namedaplis-rtp JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryData Analysis Package for LInoSpad - Real-Time Plotting
upload_time2025-01-26 11:20:08
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords timestamp analysis linospad2
VCS
bugtrack_url
requirements matplotlib numpy PyQt5 setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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/daplis)

![Tests](https://github.com/rngKomorebi/LinoSPAD2-app/actions/workflows/tests.yml/badge.svg)
![Documentation](https://github.com/rngKomorebi/LinoSPAD2-app/actions/workflows/documentation.yml/badge.svg)
![PyPI - Version](https://img.shields.io/pypi/v/daplis-rtp)
![PyPI - License](https://img.shields.io/pypi/l/daplis-rtp)

Full documentation (including all docstrings) can be found [here](https://rngkomorebi.github.io/daplis-rtp/).

## 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](https://github.com/rngKomorebi/daplis)
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](https://pyinstaller.org/en/stable/).

## 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](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)).

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](https://peps.python.org/pep-0008/) and
[PEP 257](https://peps.python.org/pep-0257/) 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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "daplis-rtp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "timestamp, analysis, LinoSPAD2",
    "author": null,
    "author_email": "Sergei Kulkov <sergei.kulkov23@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/6c/0e/d24e5dea14e1791f648d204b781c837f11cb020b776385977348217b2152/daplis_rtp-1.0.1.tar.gz",
    "platform": null,
    "description": "# Data Analysis Package for LInoSpad - Real-Time Plotting (DAPLIS-RTP).\r\n\r\nPackage with an application for real-time plotting of sensor population\r\nfor LinoSPAD2. A spin-off of the main data analysis package [daplis](https://github.com/rngKomorebi/daplis)\r\n\r\n![Tests](https://github.com/rngKomorebi/LinoSPAD2-app/actions/workflows/tests.yml/badge.svg)\r\n![Documentation](https://github.com/rngKomorebi/LinoSPAD2-app/actions/workflows/documentation.yml/badge.svg)\r\n![PyPI - Version](https://img.shields.io/pypi/v/daplis-rtp)\r\n![PyPI - License](https://img.shields.io/pypi/l/daplis-rtp)\r\n\r\nFull documentation (including all docstrings) can be found [here](https://rngkomorebi.github.io/daplis-rtp/).\r\n\r\n## Introduction\r\n\r\nThe main purpose of this application is real-time plotting of LinoSPAD2\r\nsensor population for easier handling of the setup. Given the detector \r\ndata acquisition is running and once a path to where data files should\r\nbe saved to, the program constantly checks for the latest saved file, then \r\nunpacks the data, and plots it as a number of photons detected in each pixel.\r\n\r\nAdditionally, a separate tab for checking the data quality by looking at \r\nthe distribution of timestamps across the whole acquisition cycle is provided: \r\nif the distribution is uniform, the data is ok. The third tab can be used\r\nfor plotting the number of photons from two pixels vs the data file as two \r\ncurves with primary application in Mach-Zehnder interferometer setup.\r\n\r\nThis repo was separated from the [main](https://github.com/rngKomorebi/daplis)\r\nlibrary of scripts for LinoSPAD2 data analysis. The reason is that\r\nthe app requires its own 'main.py' to run and having it as a standalone\r\nmakes it quite easy to generate an executable with [pyinstaller](https://pyinstaller.org/en/stable/).\r\n\r\n## Installation and usage\r\n\r\nTo start using the package, one can download the whole repo. The 'main.py'\r\nserves as the main hub for starting the app. \"requirements.txt\"\r\nlists all packages required for this project to run. One can create\r\nan environment for this project either using conda or install the\r\nnecessary packages using pip (for creating virtual environments using pip\r\nsee [this](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)).\r\n\r\nUsing pip:\r\n```\r\npip install virtualenv\r\npy -m venv NEW_ENVIRONMENT_NAME\r\nPATH/TO/NEW_ENVIRONMENT_NAME/Scripts/activate\r\ncd PATH/TO/THIS/PACKAGE\r\npip install -r requirements.txt\r\npip install -e .\r\n```\r\nUsing conda:\r\n```\r\nconda create --name NEW_ENVIRONMENT_NAME\r\nconda activate NEW_ENVIRONMENT NAME\r\ncd PATH/TO/THIS/PACKAGE\r\nconda install --file requirements.txt -c conda-forge\r\npip install -e .\r\n```\r\nFinally, to run the app, run the 'main.py' script.\r\n\r\n### Executable\r\n\r\nOn Windows, to create an executable, one can run the following: first,\r\na separate virtual environment is highly recommended for a faster and\r\nsmoother experience with the app, as pyinstaller packs everything it\r\nfinds in the virtual environment; using pip:\r\n\r\n```\r\npip install virtualenv\r\npy -m venv PATH/TO/NEW_ENVIRONMENT_NAME\r\nPATH/TO/NEW_ENVIRONMENT_NAME/Scripts/activate\r\n```\r\nwhere the last command activates the environment. Here, all the necessary\r\npackages along with the app package itself should be installed. To do\r\nthis, run from the environment (given the package was downloaded):\r\n```\r\ncd PATH/TO/THIS/PACKAGE/src/LinoSPAD2app\r\npip install -r requirements.txt\r\npip install -e .\r\n```\r\nwhere the latter command installs the package itself in the environment.\r\nTo create the executable, pyinstaller should be installed, too:\r\n```\r\npip install pyinstaller\r\n```\r\nThen, given the current directory is set to where the package is, run\r\n```\r\npyinstaller --clean --onedir --noconsole main.py\r\n```\r\nwhich packs everything in the package for the \"main.exe\" executable\r\nfor the app. Options '--onedir' for installing everything into a single\r\ndirectory and '--noconsole' for running the app without a console are\r\nrecommended. Additionally, in the '_tab.py' files, change the first\r\nlines in the '__init__' functions to the following: \r\n```\r\ndef __init__(self, parent=None):\r\n    super().__init__(parent)\r\n    os.chdir(r\"FULL\\PATH\\TO\\LinoSPAD2-app\\gui\\ui\")\r\n    uic.loadUi(\r\n        r\"LiveTimestamps_tab_c.ui\",\r\n        self,\r\n    )\r\n    os.chdir(\"../..\")\r\n```\r\nFull path to the '.ui' files should be provided as pyinstaller does not\r\nhandle relative paths, as it's implemented in the package. To run the app,\r\nrun 'main.exe' in the 'dist' folder.\r\n\r\nIf using conda, use the following chain of commands:\r\n```\r\nconda create --name NEW_ENVIRONMENT_NAME\r\nconda activate NEW_ENVIRONMENT NAME\r\ncd PATH/TO/THIS/PACKAGE\r\nconda install --file requirements.txt -c conda-forge\r\nconda install pyinstaller -c conda-forge\r\n```\r\nand the rest stay the same as for the installation using pip.\r\n\r\n## Dark theme app (Windows)\r\n\r\nFor 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\r\n```\r\npip install qdarkstyle\r\n```\r\nor, using conda\r\n```\r\nconda install qdarkstyle -c conda-forge\r\n```\r\nThen, in the 'main.py', import (uncomment) qdarkstyle and uncomment the 5th line in the following code block\r\n```\r\nif __name__ == \"__main__\":\r\n    app = QApplication(sys.argv)\r\n    window = MainWindow()\r\n    # For dark theme\r\n    # app.setStyleSheet(qdarkstyle.load_stylesheet())\r\n    window.show()\r\n    app.exec()\r\n```\r\nthat will run the app in dark mode. To apply dark theme for the\r\nmatplotlib canvases as well, uncomment the 'plt.style.use()\"dark_background\")' in the 'plot_figure.py'.\r\n\r\n## How to contribute\r\n\r\nThis repo consists of two branches: 'main' serves as the release version\r\nof the package, tested, and proved to be functional and ready to use, while\r\nthe 'develop' branch serves as the main hub for testing new stuff. To\r\ncontribute, the best way would be to fork the 'develop' branch and\r\nsubmit via pull requests. Everyone willing to contribute is kindly asked\r\nto follow the [PEP 8](https://peps.python.org/pep-0008/) and\r\n[PEP 257](https://peps.python.org/pep-0257/) conventions.\r\n\r\n## License and contact info\r\n\r\nThis package is available under the MIT license. See LICENSE for more\r\ninformation. If you'd like to contact me, the author, feel free to\r\nwrite at sergei.kulkov23@gmail.com.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Data Analysis Package for LInoSpad - Real-Time Plotting",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/rngKomorebi/daplis-rtp"
    },
    "split_keywords": [
        "timestamp",
        " analysis",
        " linospad2"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4e46f6f4853d2b528bef4397b26f918177ff7502786ab9511f683f7291d22f47",
                "md5": "d1f61b038500ccc165e70833fdebae0e",
                "sha256": "2f0835ac79ca2371092bebbb3ef879e97a128e021458ff1e05590560c590f509"
            },
            "downloads": -1,
            "filename": "daplis_rtp-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d1f61b038500ccc165e70833fdebae0e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 37554,
            "upload_time": "2025-01-26T11:20:07",
            "upload_time_iso_8601": "2025-01-26T11:20:07.038833Z",
            "url": "https://files.pythonhosted.org/packages/4e/46/f6f4853d2b528bef4397b26f918177ff7502786ab9511f683f7291d22f47/daplis_rtp-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6c0ed24e5dea14e1791f648d204b781c837f11cb020b776385977348217b2152",
                "md5": "f149dd44fd7f09685661ac3581c843a2",
                "sha256": "524e59e4ebd86597de793a9d0a77725828ba35785b17f15f0780fa7e3bc95f99"
            },
            "downloads": -1,
            "filename": "daplis_rtp-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f149dd44fd7f09685661ac3581c843a2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 28085,
            "upload_time": "2025-01-26T11:20:08",
            "upload_time_iso_8601": "2025-01-26T11:20:08.576705Z",
            "url": "https://files.pythonhosted.org/packages/6c/0e/d24e5dea14e1791f648d204b781c837f11cb020b776385977348217b2152/daplis_rtp-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-26 11:20:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rngKomorebi",
    "github_project": "daplis-rtp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.6.2"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.23.5"
                ]
            ]
        },
        {
            "name": "PyQt5",
            "specs": [
                [
                    ">=",
                    "5.15.7"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "70.0"
                ]
            ]
        }
    ],
    "lcname": "daplis-rtp"
}
        
Elapsed time: 1.09807s