qudi-hira-analysis


Namequdi-hira-analysis JSON
Version 1.6.3 PyPI version JSON
download
home_pagehttps://github.com/dineshpinto/qudi-hira-analysis
SummaryA Python toolkit to analzye photon timetrace data from qubit sensors
upload_time2024-03-31 18:05:27
maintainerNone
docs_urlNone
authordineshpinto
requires_python<3.13,>=3.10
licenseApache-2.0
keywords python qubit analysis nv centers photon timetrace
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![DOI](https://zenodo.org/badge/288670453.svg)](https://zenodo.org/badge/latestdoi/288670453)
[![PyPi version](https://img.shields.io/pypi/v/qudi-hira-analysis)](https://pypi.python.org/pypi/qudi-hira-analysis/)
[![Python 3.10](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/release/python-3100/)
[![Downloads](https://static.pepy.tech/badge/qudi-hira-analysis)](https://pepy.tech/project/qudi-hira-analysis)
[![codecov](https://codecov.io/gh/dineshpinto/qudi-hira-analysis/branch/main/graph/badge.svg?token=FMXDAYW8DW)](https://codecov.io/gh/dineshpinto/qudi-hira-analysis)
[![unittest](https://github.com/dineshpinto/qudi-hira-analysis/actions/workflows/unittest.yml/badge.svg)](https://github.com/dineshpinto/qudi-hira-analysis/actions/workflows/unittest.yml)

# Qudi Hira Analysis

Analytics suite for qubit SPM using FPGA timetaggers

## Installation

```bash
pip install qudi-hira-analysis
```

### Update to latest version

```bash
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](https://doi.org/10.5281/zenodo.7604670).

## Features

- Automated data import and handling
- Works natively with data from [Qudi](https://github.com/Ulm-IQO/qudi) and [Qudi-Hira](https://github.com/projecthira/qudi-hira)
- Fast and robust curve fitting for NV-ODMR 2D maps, Autocorrelation, Rabi, Ramsey, T1, T2 and more...
- Supports all file formats used in NV magnetometry, AFM, MFM and NV-SPM
- Uses a Dataclass-centered design for easy access to data and metadata

## Usage

```python
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 pulsed measurements with "odmr" in the path into a Dataclass
odmr_measurements = dh.load_measurements("odmr", pulsed=True)

# Fit ODMR data 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.lorentziandouble, data=odmr.data)

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

# Calculate the ODMR splitting
ax.axvline(result.best_values["l0_center"], ls="--", color="C1")
ax.axvline(result.best_values["l1_center"], ls="--", color="C1")
splitting = result.best_values["l1_center"] - result.best_values["l0_center"]
ax.set_title(f"ODMR splitting = {splitting / 1e6:.1f} MHz")

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

# Save figure
dh.save_figures(filepath=Path("odmr_fit"), fig=ax.get_figure())
```
![ODMR](https://github.com/dineshpinto/qudi-hira-analysis/blob/fb86a5321a15a6851803daa9af60abe52436b54d/docs/images/odmr.jpg)

## Documentation

The full documentation is available [here](https://dineshpinto.github.io/qudi-hira-analysis/).

## Schema

### Overall

```mermaid
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

```mermaid
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

- [Poetry](https://python-poetry.org)
- [git](https://git-scm.com/downloads)

### Clone repo, install deps and add environment to Jupyter

```shell
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](https://chocolatey.org/install), then
install make with `choco install make`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dineshpinto/qudi-hira-analysis",
    "name": "qudi-hira-analysis",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.10",
    "maintainer_email": null,
    "keywords": "python, qubit, analysis, nv centers, photon timetrace",
    "author": "dineshpinto",
    "author_email": "annual.fallout_0z@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/99/33/97740e6251c904cb6d554b6a036d0342f33e10c0bb067bc65dd549906a81/qudi_hira_analysis-1.6.3.tar.gz",
    "platform": null,
    "description": "[![DOI](https://zenodo.org/badge/288670453.svg)](https://zenodo.org/badge/latestdoi/288670453)\n[![PyPi version](https://img.shields.io/pypi/v/qudi-hira-analysis)](https://pypi.python.org/pypi/qudi-hira-analysis/)\n[![Python 3.10](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/release/python-3100/)\n[![Downloads](https://static.pepy.tech/badge/qudi-hira-analysis)](https://pepy.tech/project/qudi-hira-analysis)\n[![codecov](https://codecov.io/gh/dineshpinto/qudi-hira-analysis/branch/main/graph/badge.svg?token=FMXDAYW8DW)](https://codecov.io/gh/dineshpinto/qudi-hira-analysis)\n[![unittest](https://github.com/dineshpinto/qudi-hira-analysis/actions/workflows/unittest.yml/badge.svg)](https://github.com/dineshpinto/qudi-hira-analysis/actions/workflows/unittest.yml)\n\n# Qudi Hira Analysis\n\nAnalytics suite for qubit SPM using FPGA timetaggers\n\n## Installation\n\n```bash\npip install qudi-hira-analysis\n```\n\n### Update to latest version\n\n```bash\npip install --upgrade qudi-hira-analysis\n```\n\n## Citation\n\nIf you are publishing scientific results that use this code, as good scientific practice you\nshould cite [this work](https://doi.org/10.5281/zenodo.7604670).\n\n## Features\n\n- Automated data import and handling\n- Works natively with data from [Qudi](https://github.com/Ulm-IQO/qudi) and [Qudi-Hira](https://github.com/projecthira/qudi-hira)\n- Fast and robust curve fitting for NV-ODMR 2D maps, Autocorrelation, Rabi, Ramsey, T1, T2 and more...\n- Supports all file formats used in NV magnetometry, AFM, MFM and NV-SPM\n- Uses a Dataclass-centered design for easy access to data and metadata\n\n## Usage\n\n```python\nfrom pathlib import Path\nimport seaborn as sns\n\nfrom qudi_hira_analysis import DataHandler\n\ndh = DataHandler(\n    data_folder=Path(\"C:/Data\"),  # Path to data folder\n    figure_folder=Path(\"C:/QudiHiraAnalysis\"),  # Path to figure folder\n    measurement_folder=Path(\"20230101_NV1\")  # Measurement folder name (optional)\n)\n\n# Lazy-load all pulsed measurements with \"odmr\" in the path into a Dataclass\nodmr_measurements = dh.load_measurements(\"odmr\", pulsed=True)\n\n# Fit ODMR data with a double Lorentzian\nodmr = odmr_measurements[\"20230101-0420-00\"]\nx_fit, y_fit, result = dh.fit(x=\"Controlled variable(Hz)\", y=\"Signal\",\n                              fit_function=dh.fit_function.lorentziandouble, data=odmr.data)\n\n# Plot the data and the fit\nax = sns.scatterplot(x=\"Controlled variable(Hz)\", y=\"Signal\", data=odmr.data, label=\"Data\")\nsns.lineplot(x=x_fit, y=y_fit, ax=ax, label=\"Fit\")\n\n# Calculate the ODMR splitting\nax.axvline(result.best_values[\"l0_center\"], ls=\"--\", color=\"C1\")\nax.axvline(result.best_values[\"l1_center\"], ls=\"--\", color=\"C1\")\nsplitting = result.best_values[\"l1_center\"] - result.best_values[\"l0_center\"]\nax.set_title(f\"ODMR splitting = {splitting / 1e6:.1f} MHz\")\n\n# Generate fit report\nprint(result.fit_report())\n\n# Save figure\ndh.save_figures(filepath=Path(\"odmr_fit\"), fig=ax.get_figure())\n```\n![ODMR](https://github.com/dineshpinto/qudi-hira-analysis/blob/fb86a5321a15a6851803daa9af60abe52436b54d/docs/images/odmr.jpg)\n\n## Documentation\n\nThe full documentation is available [here](https://dineshpinto.github.io/qudi-hira-analysis/).\n\n## Schema\n\n### Overall\n\n```mermaid\nflowchart TD\n    IOHandler <-- Handle IO operations --> DataLoader;\n    DataLoader <-- Map IO callables --> DataHandler;\n    Qudi[Qudi FitLogic] --> AnalysisLogic;\n    AnalysisLogic -- Inject fit functions --> DataHandler;\n    DataHandler -- Fit data --> Plot;\n    DataHandler -- Structure data --> MeasurementDataclass;\n    MeasurementDataclass -- Plot data --> Plot[JupyterLab Notebook];\n    Plot -- Save plotted data --> DataHandler;\n    style MeasurementDataclass fill: #bbf, stroke: #f66, stroke-width: 2px, color: #fff, stroke-dasharray: 5 5\n```\n\n### Dataclass\n\n```mermaid\nflowchart LR\n    subgraph Standard Data\n        MeasurementDataclass --o filepath1[filepath: Path];\n        MeasurementDataclass --o data1[data: DataFrame];\n        MeasurementDataclass --o params1[params: dict];\n        MeasurementDataclass --o timestamp1[timestamp: datetime.datetime];\n        MeasurementDataclass --o methods1[get_param_from_filename: Callable];\n        MeasurementDataclass --o methods2[set_datetime_index: Callable];\n    end\n    subgraph Pulsed Data\n        MeasurementDataclass -- pulsed --> PulsedMeasurementDataclass;\n        PulsedMeasurementDataclass -- measurement --> PulsedMeasurement;\n        PulsedMeasurement --o filepath2[filepath: Path];\n        PulsedMeasurement --o data2[data: DataFrame];\n        PulsedMeasurement --o params2[params: dict];\n        PulsedMeasurementDataclass -- laser_pulses --> LaserPulses;\n        LaserPulses --o filepath3[filepath: Path];\n        LaserPulses --o data3[data: DataFrame];\n        LaserPulses --o params3[params: dict];\n        PulsedMeasurementDataclass -- timetrace --> RawTimetrace;\n        RawTimetrace --o filepath4[filepath: Path];\n        RawTimetrace --o data4[data: DataFrame];\n        RawTimetrace --o params4[params: dict];\n    end\n```\n\n## License\n\nThis license of this project is located in the top level folder under `LICENSE`. Some specific files contain their\nindividual licenses in the file header docstring.\n\n## Build\n\n### Prerequisites\n\n- [Poetry](https://python-poetry.org)\n- [git](https://git-scm.com/downloads)\n\n### Clone repo, install deps and add environment to Jupyter\n\n```shell\ngit clone https://github.com/dineshpinto/qudi-hira-analysis.git\ncd qudi-hira-analysis\npoetry install\npoetry run python -m ipykernel install --user --name=qudi-hira-analysis\npoetry run jupyter lab\n```\n\n## Makefile\n\nThe Makefile located in `notebooks/` is configured to generate a variety of outputs:\n\n+ `make pdf` : Converts all notebooks to PDF (requires LaTeX backend)\n+ `make html`: Converts all notebooks to HTML\n+ `make py`  : Converts all notebooks to Python (can be useful for VCS)\n+ `make all` : Sequentially runs all the notebooks in folder\n\nTo use the `make` command on Windows you can install [Chocolatey](https://chocolatey.org/install), then\ninstall make with `choco install make`\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A Python toolkit to analzye photon timetrace data from qubit sensors",
    "version": "1.6.3",
    "project_urls": {
        "Documentation": "https://dineshpinto.github.io/qudi-hira-analysis/qudi_hira_analysis/",
        "Homepage": "https://github.com/dineshpinto/qudi-hira-analysis",
        "Repository": "https://github.com/dineshpinto/qudi-hira-analysis"
    },
    "split_keywords": [
        "python",
        " qubit",
        " analysis",
        " nv centers",
        " photon timetrace"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "260602b303ba5dee51bd02a1508edef80837a0e8b0df4d20028481ae9a2b5793",
                "md5": "097120725906cf4fb5515f01c4a52554",
                "sha256": "456b5018aaccc5e941bf9dbb7da4c29c8ede99700047f6f3b04b9cc511c8f501"
            },
            "downloads": -1,
            "filename": "qudi_hira_analysis-1.6.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "097120725906cf4fb5515f01c4a52554",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.10",
            "size": 82831,
            "upload_time": "2024-03-31T18:05:24",
            "upload_time_iso_8601": "2024-03-31T18:05:24.319487Z",
            "url": "https://files.pythonhosted.org/packages/26/06/02b303ba5dee51bd02a1508edef80837a0e8b0df4d20028481ae9a2b5793/qudi_hira_analysis-1.6.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "993397740e6251c904cb6d554b6a036d0342f33e10c0bb067bc65dd549906a81",
                "md5": "764c9d9fafea082f0bdb5688f24b8183",
                "sha256": "28ec338825be21020d8dc8ac31773d5284c6e2c39c8f1a932f38208b5f33aa54"
            },
            "downloads": -1,
            "filename": "qudi_hira_analysis-1.6.3.tar.gz",
            "has_sig": false,
            "md5_digest": "764c9d9fafea082f0bdb5688f24b8183",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.10",
            "size": 69196,
            "upload_time": "2024-03-31T18:05:27",
            "upload_time_iso_8601": "2024-03-31T18:05:27.314272Z",
            "url": "https://files.pythonhosted.org/packages/99/33/97740e6251c904cb6d554b6a036d0342f33e10c0bb067bc65dd549906a81/qudi_hira_analysis-1.6.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-31 18:05:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dineshpinto",
    "github_project": "qudi-hira-analysis",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "qudi-hira-analysis"
}
        
Elapsed time: 0.20944s