A Python toolkit to analzye photon timetrace data from qubit sensors
Project description
Qudi Hira Analysis
This toolkit automates a large portion of the work surrounding data analysis on quantum sensing experiments where the primary raw data extracted is photon counts.
The high level interface is abstracted, and provides a set of functions to automate data import, handling and analysis. It is designed to be exposed through Jupyter Notebooks, although the abstract interface allows it to be integrated into larger, more general frameworks as well (with only some pain). Using the toolkit itself should only require a beginner-level understanding of Python.
It also aims to improve transparency and reproducibility in experimental data analysis. In an ideal scenario, two lines of code are sufficient to recreate all output data.
Python offers some very handy features like dataclasses, which are heavily used by this toolkit. Dataclasses offer a full OOP (object-oriented programming) experience while analyzing complex data sets. They provide a solid and transparent structure to the data to reduce errors arising from data fragmentation. This generally comes at a large performance cost, but this is (largely) sidestepped by lazy loading data and storing metadata instead wherever possible.
Installation
pip install qudi-hira-analysis
Update to latest version
pip install --upgrade qudi-hira-analysis
Citation
If you are publishing scientific results using this code, you should cite this work as: https://doi.org/10.5281/zenodo.7604670
Features
- Modular architecture (use only what you need)
- Automated data import and handling
- Works natively with data from Qudi and Qudi-Hira
- Supports all fitting routines and file formats used in NV magnetometry, AFM, MFM and NV-SPM
- Uses a Dataclass-centered design for easy access to data and metadata
Usage
from pathlib import Path
from qudi_hira_analysis import DataHandler
dh = DataHandler(
data_folder=Path("C:\\", "Data"),
figure_folder=Path("C:\\", "QudiHiraAnalysis"),
measurement_folder=Path("20230101_NV1")
)
# Load all ODMR measurements
odmr_measurements = dh.load_measurements("odmr")
Documentation
The full documentation is available here
Dataclass Schema
flowchart LR
subgraph Standard Data
MeasurementDataclass --o filepath1[filepath: Path];
MeasurementDataclass --o data1[data: DataFrame];
MeasurementDataclass --o params1[params: dict];
MeasurementDataclass --o timestamp1[timestamp: datetime.datetime];
MeasurementDataclass --o methods1[get_param_from_filename: Callable];
MeasurementDataclass --o methods2[set_datetime_index: Callable];
end
subgraph Pulsed Data
MeasurementDataclass -- pulsed --> PulsedMeasurementDataclass;
PulsedMeasurementDataclass -- measurement --> PulsedMeasurement;
PulsedMeasurement --o filepath2[filepath: Path];
PulsedMeasurement --o data2[data: DataFrame];
PulsedMeasurement --o params2[params: dict];
PulsedMeasurementDataclass -- laser_pulses --> LaserPulses;
LaserPulses --o filepath3[filepath: Path];
LaserPulses --o data3[data: DataFrame];
LaserPulses --o params3[params: dict];
PulsedMeasurementDataclass -- timetrace --> RawTimetrace;
RawTimetrace --o filepath4[filepath: Path];
RawTimetrace --o data4[data: DataFrame];
RawTimetrace --o params4[params: dict];
end
Overall Schema
flowchart TD
IOHandler <-- Handle IO operations --> DataLoader;
DataLoader <-- Map IO callables --> DataHandler;
Qudi[Qudi FitLogic] --> AnalysisLogic;
AnalysisLogic -- Inject fit functions --> DataHandler;
DataHandler -- Fit data --> Plot;
DataHandler -- Structure data --> MeasurementDataclass;
MeasurementDataclass -- Plot data --> Plot[JupyterLab Notebook];
Plot -- Save plotted data --> DataHandler;
style MeasurementDataclass fill: #bbf, stroke: #f66, stroke-width: 2px, color: #fff, stroke-dasharray: 5 5
License
This license of this project is located in the top level folder under LICENSE
. Some specific files contain their
individual licenses in the file header docstring.
Build
Prerequisites
Clone the repository
git clone https://github.com/dineshpinto/qudi-hira-analysis.git
Installing dependencies with Poetry
poetry install
Add Poetry environment to Jupyter kernel
poetry run python -m ipykernel install --user --name=qudi-hira-analysis
Start the analysis
poetry run jupyter lab
Don't forget to switch to the qudi-hira-analysis
kernel in JupyterLab.
Makefile
The Makefile located in notebooks/
is configured to generate a variety of outputs:
make pdf
: Converts all notebooks to PDF (requires LaTeX backend)make html
: Converts all notebooks to HTMLmake py
: Converts all notebooks to Python (can be useful for VCS)make all
: Sequentially runs all the notebooks in folder
To use the make
command on Windows you can install Chocolatey, then
install make with choco install make
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
File details
Details for the file qudi_hira_analysis-1.5.1.tar.gz
.
File metadata
- Download URL: qudi_hira_analysis-1.5.1.tar.gz
- Upload date:
- Size: 64.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.2 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 466bac4d5c238a92085e48a463e7a0aff3ebd22beb83bb1baac52f65219598e8 |
|
MD5 | 21da73e8bed10d0d49c1f31732abfa36 |
|
BLAKE2b-256 | 352c725577c41e1cd85a6d2ec1323bb8b827c3118293c4c6d18d9976ddbc28b7 |
File details
Details for the file qudi_hira_analysis-1.5.1-py3-none-any.whl
.
File metadata
- Download URL: qudi_hira_analysis-1.5.1-py3-none-any.whl
- Upload date:
- Size: 77.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.2 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20ddf9559048d8965873894c2987dcc5abdaf7c669bb1a57fae7031aaa23035e |
|
MD5 | 07f6e31107b8894a5584ab48e7567899 |
|
BLAKE2b-256 | bc42433a9f6e28d91d0ef3492c4c518ec86929d626e060976beceb33f9bea176 |