cdiutils


Namecdiutils JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryA Python package for (Bragg) Coherent X-ray Diffraction Imaging processing, analysis and visualisation workflows.
upload_time2025-08-05 08:46:00
maintainerNone
docs_urlNone
authorCorentin Chatelier, David Simonne, Matthieu Deschamps, Kyle Olson
requires_python>=3.10
licenseNone
keywords reconstruction coherent x-ray imaging bragg pipeline synchrotron radiation quantitative analysis
VCS
bugtrack_url
requirements colorcet h5py hdf5plugin ipykernel matplotlib numpy pandas scikit-image scikit-learn scipy seaborn silx tabulate xrayutilities ipyvolume ipython_genutils bokeh panel tornado sphinx pydata-sphinx-theme
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cdiutils

[![DOI](https://zenodo.org/badge/360442527.svg)](https://zenodo.org/badge/latestdoi/360442527)

[![License](https://img.shields.io/github/license/clatlan/cdiutils)](https://github.com/clatlan/cdiutils/blob/main/LICENSE)

My python package to help X-ray Bragg Coherent Diffraction Imaging (BCDI) practitioners in their analysis and visualisation workflows. I developed the package during my PhD.

The package is designed to handle the three primary stages of a BCDI data processing workflow:

* **Pre-processing** (data centering and cropping)
* **Phase retrieval**: utilises  PyNX for accurate phasing (refer to [PyNX documentation](https://pynx.esrf.fr/en/latest/)).
* **Post-processing** (orthogonalisation, phase manipulation, strain computation etc.)

It is assumed that the phase retrieval is conducted using the PyNX package. The `BcdiPipeline` class runs all three stages and can manage connections to different machines, especially for GPU-based phase retrieval.

Some features of this package include:

* **Flexibility in Hardware:** While the phase retrieval stage may leverage GPUs, pre- and post-processing can be executed without GPU support.
* **Utility Functions:** The package provides utility functions to analyse processed data and generate plots suitable for potential publications.

For a visual wrap-up, see the associated poster presented at [XTOP24](https://xtop2024.sciencesconf.org/):
![xtop_poster](https://github.com/clatlan/cdiutils/blob/master/images/XTOP_24_cdiutils_poster_200_dpi.png)


## Installation

### Using conda (recommended)

Create a new conda environment with all dependencies:

```bash
# Clone the repository first
git clone https://github.com/clatlan/cdiutils.git
cd cdiutils

# Create conda environment from environment.yml
conda env create -f environment.yml

# Activate the environment
conda activate cdiutils

# Install cdiutils in development mode
pip install -e .
```

For development (includes documentation and testing tools):

```bash
# Create development environment
conda env create -f environment-dev.yml
conda activate cdiutils-dev
pip install -e .
```

### Using pip (from PyPI - coming soon)

Once published on PyPI, you'll be able to install directly:

```bash
pip install cdiutils
```

### Using pip (from GitHub - current method)

You can install the package directly from GitHub:

```bash
pip install git+https://github.com/clatlan/cdiutils.git
```

To update your environment with the latest commits:

```bash
pip install -I --no-deps git+https://github.com/clatlan/cdiutils.git
```

_Note: Check out the dev branch for the latest features and bug fixes. The dev branch is not guaranteed to be stable._

Upgrade your environment with a new version of the package:

```bash
pip install -U git+https://github.com/clatlan/cdiutils.git
```

## Getting started

Once the package is installed, you can try it right away using the notebook template directly accessible with the command:

```bash
prepare_bcdi_notebook [path_to_destination]
```

This will generate a notebook template at the given destination.

## Processing BCDI data

Once data are processed, the `BcdiPipeline` instance saves the data in .npz, .cxi and .vti files following the CXI file format convention (see [https://www.cxidb.org/cxi.html]()). It also plots summary and debug figures such as:

* **Summary Slice Plot**
  ![summary](https://github.com/clatlan/cdiutils/blob/master/images/cdiutils_S311_summary_slice_plot.png)
* **Isosurface determination**
  ![isosurface](https://github.com/clatlan/cdiutils/blob/master/images/cdiutils_S311_amplitude_distribution_plot.png)
* **Different strain computation methods**
  ![strain](https://github.com/clatlan/cdiutils/blob/master/images/cdiutils_S311_different_strain_methods.png)

## BCDI reconstruction analysis
If want to analyse and compare your reconstructions, check out the example notebook [bcdi_reconstruction_analysis.ipynb](https://github.com/clatlan/cdiutils/blob/master/examples/bcdi_reconstruction_analysis.ipynb) in the `examples` folder. This notebook provides a comprehensive overview of the analysis process, including:
* **Slice plots of any quantity you like (here phase) across different conditions:**
  ![](https://github.com/clatlan/cdiutils/blob/master/images/multi_slice_plots_phase.png)


* **Reciprocal space plots in the orthogonal frame (lab frame)**
  ![](https://github.com/clatlan/cdiutils/blob/master/images/reciprocal_space_q_lab.png)

* **Histogram plots of any quantity you like across different conditions:**
  ![](https://github.com/clatlan/cdiutils/blob/master/images/strain_histograms.png)


## Cross section quiver
The cross section quiver is nice tool for visualising the strain and displacement fields and their relationship in BCDI data. 

* The cross section quiver allows to plot cross section of strain and displacement field on the same plot.
  ![Cross Section Quiver](https://github.com/clatlan/cdiutils/blob/master/images/cross_section_quiver.png)
* For different conditions
  ![Quivers](https://github.com/clatlan/cdiutils/blob/master/images/multi_cross_sections.png)

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## Support

If you encounter any issues or have questions, please open an issue on the [GitHub repository](https://github.com/clatlan/cdiutils/issues).


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cdiutils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Clement Atlan <clement.atlan@esrf.fr>",
    "keywords": "reconstruction, coherent X-ray imaging, Bragg, pipeline, synchrotron radiation, quantitative analysis",
    "author": "Corentin Chatelier, David Simonne, Matthieu Deschamps, Kyle Olson",
    "author_email": "Clement Atlan <clement.atlan@esrf.fr>",
    "download_url": "https://files.pythonhosted.org/packages/b6/9b/b53eefab3534888a010ec650c3dfb77d479d2b99852c83586bc999df81a4/cdiutils-0.2.0.tar.gz",
    "platform": null,
    "description": "# cdiutils\n\n[![DOI](https://zenodo.org/badge/360442527.svg)](https://zenodo.org/badge/latestdoi/360442527)\n\n[![License](https://img.shields.io/github/license/clatlan/cdiutils)](https://github.com/clatlan/cdiutils/blob/main/LICENSE)\n\nMy python package to help X-ray Bragg Coherent Diffraction Imaging (BCDI) practitioners in their analysis and visualisation workflows. I developed the package during my PhD.\n\nThe package is designed to handle the three primary stages of a BCDI data processing workflow:\n\n* **Pre-processing** (data centering and cropping)\n* **Phase retrieval**: utilises  PyNX for accurate phasing (refer to [PyNX documentation](https://pynx.esrf.fr/en/latest/)).\n* **Post-processing** (orthogonalisation, phase manipulation, strain computation etc.)\n\nIt is assumed that the phase retrieval is conducted using the PyNX package. The `BcdiPipeline` class runs all three stages and can manage connections to different machines, especially for GPU-based phase retrieval.\n\nSome features of this package include:\n\n* **Flexibility in Hardware:** While the phase retrieval stage may leverage GPUs, pre- and post-processing can be executed without GPU support.\n* **Utility Functions:** The package provides utility functions to analyse processed data and generate plots suitable for potential publications.\n\nFor a visual wrap-up, see the associated poster presented at [XTOP24](https://xtop2024.sciencesconf.org/):\n![xtop_poster](https://github.com/clatlan/cdiutils/blob/master/images/XTOP_24_cdiutils_poster_200_dpi.png)\n\n\n## Installation\n\n### Using conda (recommended)\n\nCreate a new conda environment with all dependencies:\n\n```bash\n# Clone the repository first\ngit clone https://github.com/clatlan/cdiutils.git\ncd cdiutils\n\n# Create conda environment from environment.yml\nconda env create -f environment.yml\n\n# Activate the environment\nconda activate cdiutils\n\n# Install cdiutils in development mode\npip install -e .\n```\n\nFor development (includes documentation and testing tools):\n\n```bash\n# Create development environment\nconda env create -f environment-dev.yml\nconda activate cdiutils-dev\npip install -e .\n```\n\n### Using pip (from PyPI - coming soon)\n\nOnce published on PyPI, you'll be able to install directly:\n\n```bash\npip install cdiutils\n```\n\n### Using pip (from GitHub - current method)\n\nYou can install the package directly from GitHub:\n\n```bash\npip install git+https://github.com/clatlan/cdiutils.git\n```\n\nTo update your environment with the latest commits:\n\n```bash\npip install -I --no-deps git+https://github.com/clatlan/cdiutils.git\n```\n\n_Note: Check out the dev branch for the latest features and bug fixes. The dev branch is not guaranteed to be stable._\n\nUpgrade your environment with a new version of the package:\n\n```bash\npip install -U git+https://github.com/clatlan/cdiutils.git\n```\n\n## Getting started\n\nOnce the package is installed, you can try it right away using the notebook template directly accessible with the command:\n\n```bash\nprepare_bcdi_notebook [path_to_destination]\n```\n\nThis will generate a notebook template at the given destination.\n\n## Processing BCDI data\n\nOnce data are processed, the `BcdiPipeline` instance saves the data in .npz, .cxi and .vti files following the CXI file format convention (see [https://www.cxidb.org/cxi.html]()). It also plots summary and debug figures such as:\n\n* **Summary Slice Plot**\n  ![summary](https://github.com/clatlan/cdiutils/blob/master/images/cdiutils_S311_summary_slice_plot.png)\n* **Isosurface determination**\n  ![isosurface](https://github.com/clatlan/cdiutils/blob/master/images/cdiutils_S311_amplitude_distribution_plot.png)\n* **Different strain computation methods**\n  ![strain](https://github.com/clatlan/cdiutils/blob/master/images/cdiutils_S311_different_strain_methods.png)\n\n## BCDI reconstruction analysis\nIf want to analyse and compare your reconstructions, check out the example notebook [bcdi_reconstruction_analysis.ipynb](https://github.com/clatlan/cdiutils/blob/master/examples/bcdi_reconstruction_analysis.ipynb) in the `examples` folder. This notebook provides a comprehensive overview of the analysis process, including:\n* **Slice plots of any quantity you like (here phase) across different conditions:**\n  ![](https://github.com/clatlan/cdiutils/blob/master/images/multi_slice_plots_phase.png)\n\n\n* **Reciprocal space plots in the orthogonal frame (lab frame)**\n  ![](https://github.com/clatlan/cdiutils/blob/master/images/reciprocal_space_q_lab.png)\n\n* **Histogram plots of any quantity you like across different conditions:**\n  ![](https://github.com/clatlan/cdiutils/blob/master/images/strain_histograms.png)\n\n\n## Cross section quiver\nThe cross section quiver is nice tool for visualising the strain and displacement fields and their relationship in BCDI data. \n\n* The cross section quiver allows to plot cross section of strain and displacement field on the same plot.\n  ![Cross Section Quiver](https://github.com/clatlan/cdiutils/blob/master/images/cross_section_quiver.png)\n* For different conditions\n  ![Quivers](https://github.com/clatlan/cdiutils/blob/master/images/multi_cross_sections.png)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Support\n\nIf you encounter any issues or have questions, please open an issue on the [GitHub repository](https://github.com/clatlan/cdiutils/issues).\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python package for (Bragg) Coherent X-ray Diffraction Imaging processing, analysis and visualisation workflows.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/clatlan/cdiutils"
    },
    "split_keywords": [
        "reconstruction",
        " coherent x-ray imaging",
        " bragg",
        " pipeline",
        " synchrotron radiation",
        " quantitative analysis"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f7998dcd98707583f85d3e746dadc82833a261c492cfa609fa261a44075695b2",
                "md5": "31129edaf2cd65278343ebe923c55f1c",
                "sha256": "6e4b8228ebfe0119df28f53d65af614060bb9615e728dbaa95fa50fbdc95fa56"
            },
            "downloads": -1,
            "filename": "cdiutils-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "31129edaf2cd65278343ebe923c55f1c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 206316,
            "upload_time": "2025-08-05T08:45:58",
            "upload_time_iso_8601": "2025-08-05T08:45:58.541483Z",
            "url": "https://files.pythonhosted.org/packages/f7/99/8dcd98707583f85d3e746dadc82833a261c492cfa609fa261a44075695b2/cdiutils-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b69bb53eefab3534888a010ec650c3dfb77d479d2b99852c83586bc999df81a4",
                "md5": "3742c8de29cd006a43dd772facf28309",
                "sha256": "9b3200a7918e017f439665c17b255bac183734036e804a7a7ee57ddfe8c9297b"
            },
            "downloads": -1,
            "filename": "cdiutils-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3742c8de29cd006a43dd772facf28309",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 2520089,
            "upload_time": "2025-08-05T08:46:00",
            "upload_time_iso_8601": "2025-08-05T08:46:00.672960Z",
            "url": "https://files.pythonhosted.org/packages/b6/9b/b53eefab3534888a010ec650c3dfb77d479d2b99852c83586bc999df81a4/cdiutils-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-05 08:46:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "clatlan",
    "github_project": "cdiutils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "colorcet",
            "specs": [
                [
                    ">=",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "h5py",
            "specs": [
                [
                    ">=",
                    "3.6.0"
                ]
            ]
        },
        {
            "name": "hdf5plugin",
            "specs": [
                [
                    ">=",
                    "3.2.0"
                ]
            ]
        },
        {
            "name": "ipykernel",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.8"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.4.2"
                ]
            ]
        },
        {
            "name": "scikit-image",
            "specs": [
                [
                    ">=",
                    "0.19.2"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    ">=",
                    "1.1.3"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.8.0"
                ]
            ]
        },
        {
            "name": "seaborn",
            "specs": [
                [
                    ">=",
                    "0.12.1"
                ]
            ]
        },
        {
            "name": "silx",
            "specs": []
        },
        {
            "name": "tabulate",
            "specs": []
        },
        {
            "name": "xrayutilities",
            "specs": [
                [
                    ">=",
                    "1.7.3"
                ]
            ]
        },
        {
            "name": "ipyvolume",
            "specs": []
        },
        {
            "name": "ipython_genutils",
            "specs": []
        },
        {
            "name": "bokeh",
            "specs": []
        },
        {
            "name": "panel",
            "specs": []
        },
        {
            "name": "tornado",
            "specs": []
        },
        {
            "name": "sphinx",
            "specs": [
                [
                    ">=",
                    "4.0"
                ]
            ]
        },
        {
            "name": "pydata-sphinx-theme",
            "specs": []
        }
    ],
    "lcname": "cdiutils"
}
        
Elapsed time: 1.22116s