Skip to main content

A Python toolkit to analzye photon timetrace data from qubit sensors

Project description

DOI PyPi version Downloads codecov Cross-platform unittest

Qudi Hira Analysis

Analytics suite for qubit SPM using FPGA timetaggers

Installation

pip install qudi-hira-analysis

Update to latest version

pip install --upgrade qudi-hira-analysis

Citation

If you are publishing scientific results that use this code, as good scientific practice you should cite this work.

Features

  • Easy-to-use modular architecture
  • 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
  • Fast and robust curve fitting for 2D ODMR data
  • Uses a Dataclass-centered design for easy access to data and metadata

Usage

from pathlib import Path
import seaborn as sns

from qudi_hira_analysis import DataHandler

dh = DataHandler(
    data_folder=Path("C:\\Data"), # Path to data folder
    figure_folder=Path("C:\\QudiHiraAnalysis"), # Path to figure folder
    measurement_folder=Path("20230101_NV1") # Measurement folder name (optional)
)

# Lazy-load all measurements with "odmr" in the path into a Dataclass
odmr_measurements = dh.load_measurements("odmr")

# Extract ODMR data into a pandas DataFrame and fit with a double Lorentzian
odmr = odmr_measurements["20230101-0420-00"]
x_fit, y_fit, result = dh.fit(x="Controlled variable(Hz)", y="Signal", 
                              fit_function=dh.fit_function.doublelorentzian, data=odmr.data)

# Plot the data and fit, label with measurement timestamp
ax = sns.scatterplot(x="Controlled variable(Hz)", y="Signal", data=odmr.data, label=odmr.timestamp)
sns.lineplot(x=x_fit, y=y_fit, ax=ax, label="Fit")

# Generate fit report
print(result.fit_report())

# Save figure
dh.save_figures(filepath=Path("odmr_fit"), fig=ax.get_figure())

Documentation

The full documentation is available here.

Schema

Overall

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

Dataclass

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

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 repo, install deps and add environment to Jupyter

git clone https://github.com/dineshpinto/qudi-hira-analysis.git
cd qudi-hira-analysis
poetry install
poetry run python -m ipykernel install --user --name=qudi-hira-analysis
poetry run jupyter lab

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 HTML
  • make 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qudi_hira_analysis-1.5.2.tar.gz (68.0 kB view details)

Uploaded Source

Built Distribution

qudi_hira_analysis-1.5.2-py3-none-any.whl (81.2 kB view details)

Uploaded Python 3

File details

Details for the file qudi_hira_analysis-1.5.2.tar.gz.

File metadata

  • Download URL: qudi_hira_analysis-1.5.2.tar.gz
  • Upload date:
  • Size: 68.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Darwin/22.6.0

File hashes

Hashes for qudi_hira_analysis-1.5.2.tar.gz
Algorithm Hash digest
SHA256 17bda32485d059f06537538080fa0f1d90467278ffc8c752fda313c4508c6156
MD5 49fb019a8d6b269e366b3f9b4059ca10
BLAKE2b-256 538f03a0a98fd0142d8225288733d50a10ffa9e54e2cf746c2715eef18708377

See more details on using hashes here.

File details

Details for the file qudi_hira_analysis-1.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for qudi_hira_analysis-1.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba3da15c62685e1587ae0e8340628a6690b73823d749312c44533741b33155e1
MD5 06dac2ef420b7699c3cbadc8d5c7ed7f
BLAKE2b-256 8332f781f5aee67c790e850673706c940af3283d29500d97c05e42c0df209e01

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page