lauenn

LaueNN- neural network training and prediction routine to index single and polycrystalline Laue diffraction patterns

https://github.com/bm32esrf/lauenn

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: wiley.com
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.8%) to scientific vocabulary

Keywords

diffraction laue neuralnetwork polycrystal
Last synced: 6 months ago · JSON representation ·

Repository

LaueNN- neural network training and prediction routine to index single and polycrystalline Laue diffraction patterns

Basic Info
Statistics
  • Stars: 6
  • Watchers: 2
  • Forks: 4
  • Open Issues: 0
  • Releases: 31
Topics
diffraction laue neuralnetwork polycrystal
Created over 3 years ago · Last pushed 8 months ago
Metadata Files
Readme License Citation Codemeta

README.md

til

Conda GitHub tag (latest by date)

Lint, test, build, and publish PyPI PyPI pyversions

Anaconda-Server Badge Conda

contributions welcome

lauetoolsnn/LaueNN

An autonomous feed-forward neural network (FFNN) model to predict the HKL in single/multi-grain/multi-phase Laue patterns with high efficiency and accuracy is introduced.

Laue diffraction indexation (especially Laue images comprising of diffraction signal from several polycrystals/multi phase materials) can be a very tedious and CPU intensive process. To takle this, LaueNN or LauetoolsNN was developed employing the power of neural network to speed up a part of the indexation process. In the LaueNNpresentation (https://github.com/BM32ESRF/LaueNN/tree/main/presentations/LaueNNpresentation.pdf), several steps of Laue pattern indexation with classical approach is described. We have replaced the most CPU intensive step with the Neural Networks. The step where the Laue indices hkl of each spot os now determined with the Neural networks, alongside the spot hkl index, the neural network also predicts the Material that spot belongs to. This can be useful incase of Laue images comprising of diffraction signal from multi-phases. LaueNN uses the existing modules of Lauetools to generate simulated Laue patterns. The whole workflow and the application of this tool is illustrated in this article (https://onlinelibrary.wiley.com/iucr/doi/10.1107/S1600576722004198)

For classical indexation of Laue pattern (GUI and scripts), check out the sister package: https://github.com/BM32ESRF/lauetools

Video tutorial


  • Video 1: Working with jupyter notebook scripts : https://cloud.esrf.fr/s/6q4DJfAn7K46BGN
  • Video 2: Working with lauetoolsnn GUI : https://cloud.esrf.fr/s/AeGow4CoqZRJiyx

Requirements: (latest version of each libraries accessed on 03/04/2022)


  • PyQt5 (GUI)
  • matplotlib
  • Keras
  • tensorflow
  • numpy
  • scipy (scipy transform rotation is used)
  • h5py (required for writing neural network model files)
  • scikit-learn (required for generating trained model classification reports)
  • fabio (used for opening raw Laue tiff images)
  • networkx (to be replaced with numpy in the future)
  • scikit-image (used for hough based analysis of Laue patterns)
  • tqdm (required only for notebook scripts)
  • opencv (for LOG based peak search)
  • pandas and pytables (for writing pickle to h5)

Installation


Lauetoolsnn can be installed either via PYPI usiing the following command in terminal (this installs all dependencies automatically):

https://pypi.org/project/lauetoolsnn/

https://anaconda.org/bm32esrf/lauetoolsnn

bash $ pip install lauetoolsnn $ or $conda install -c bm32esrf lauetoolsnn -c conda-forge For macOS user, please use the conda installation to avoid build errors or can be compiled and installed locally via the setup.py file. Download the Github repository and type the following in terminal. In this case, the dependencies has to be installed manually. The latest version of each dependency works as of (01/04/2022). bash $ python setup.py install

See procedureusagelauetoolsnn.pdf for installation and how to write the configuration file to be used with GUI. This project is also hosted on sourceforge.net https://lauetoolsnn.sourceforge.io

Documentation


Documentation (under construction) for lauetoolsnn/lauenn is on the following webpage https://lauenn.readthedocs.io/en/latest/

Example case


Two example case studies are included in the lauetoolsnn\examples folder. Run the GUI by either launching directly from the terminal using the 'lauetoolsnn' command or by running it locally with python lauetoolsneuralnetwork.py command.

First step is to load the config.txt from the example folder, it sets all the values of the GUI to the case study. In the GUI: - Step1: File --> load config . Select the config file from the example directory. - Step1a: If config file is not available, one can set parameters in the configure parameters window directly. - Step2: Press the configure parameters button and press Accept button at the end (the values are loaded from the config file). - Step3: Press Generate Training dataset button. This will generate the training and validation dataset for neural network. - Step4: Press Train Neural network button. This will start the training process and once finished will save the trained model. - Step5: Press the Live prediction with IPF map to start the prediction on predefined experimental dataset. Example datafile is included in the examples folder. - Step6: Once analyzed, the results can be saved using the save results button.

In addition, all the above mentioned steps can be done without the GUI and are detailed in the lauetoolsnn\examplenotebookscripts folder. Jupyter notebook scripts are provided to run all the steps sequentially.

The indexed orientation matrix is also written in ".ctf" format, which can then be opened with channel 5 Aztec or MTEX software to do post processing related to orientations analysis. MTEX post processing script is also included in the lauetoolsnn\utilscript\MTEXplot.m

Citation


If you use this software, please cite it using the metadata available in the citation_bibtex.cff file in root. bash Purushottam Raj Purohit, R. R. P., Tardif, S., Castelnau, O., Eymery, J., Guinebretiere, R., Robach, O., Ors, T. & Micha, J.-S. (2022). J. Appl. Cryst. 55, 737-750.

Known Issues


So far, there is a issue with H5py and HDF5 version in the windows installation with conda. If error with H5py version mismatch exist after conda installation, please try "pip install lauetoolsnn" on windows as this should not have this problem. The other possibility is to install the H5py with pip before or after installing lauetoolsnn with conda.

Support


Do not hesitate to contact the development team at purushot@esrf.fr or micha@esrf.fr.

Funding


This code was developed as a result of French-German project funded respectively by the ANR and DFG (HoTMiX project reference number ANR-19-CE09-0035-01): https://www.bam.de/Content/EN/Projects/HoTMiX/hotmix.html

Maintainer(s)


Owner

  • Name: BM32 ESRF Beamline
  • Login: BM32ESRF
  • Kind: user
  • Company: ESRF

Collection of tools used for Laue diffraction analysis of data recorded at BM32 beamline

Citation (citation_bibtex.cff)

@article{PurushottamRajPurohit:nb5322,
author = "Purushottam Raj Purohit, Ravi Raj Purohit and Tardif, Samuel and Castelnau, Olivier and Eymery, Joel and Guinebreti{\`{e}}re, Ren{\'{e}} and Robach, Odile and Ors, Taylan and Micha, Jean-S{\'{e}}bastien",
title = "{LaueNN: neural-network-based {\it hkl} recognition of Laue spots and its application to polycrystalline materials}",
journal = "Journal of Applied Crystallography",
year = "2022",
volume = "55",
number = "4",
pages = "737--750",
month = "Aug",
doi = {10.1107/S1600576722004198},
url = {https://doi.org/10.1107/S1600576722004198},
abstract = {A feed-forward neural-network-based model is presented to index, in real time, the diffraction spots recorded during synchrotron X-ray Laue microdiffraction experiments. Data dimensionality reduction is applied to extract physical 1D features from the 2D X-ray diffraction Laue images, thereby making it possible to train a neural network on the fly for any crystal system. The capabilities of the LaueNN model are illustrated through three examples: a two-phase nano{\-}structure, a textured high-symmetry specimen deformed {\it in situ} and a polycrystalline low-symmetry material. This work provides a novel way to efficiently index Laue spots in simple and complex recorded images in <1s, thereby opening up avenues for the realization of real-time analysis of synchrotron Laue diffraction data.},
keywords = {synchrotron X-ray Laue microdiffraction, neural networks, hkl recognition},
}

CodeMeta (codemeta.json)

{
  "@context": "https://w3id.org/codemeta/3.0",
  "type": "SoftwareSourceCode",
  "applicationCategory": "Crystallography",
  "author": [
    {
      "id": "https://orcid.org/0000-0002-1232-6716",
      "type": "Person",
      "affiliation": {
        "type": "Organization",
        "name": "CEA-Grenoble/IRIG/MEM/NRX"
      },
      "email": "rpurushottam@xnovotech.com",
      "familyName": "Purushottam Raj Purohit",
      "givenName": "Ravi Raj Purohit"
    },
    {
      "type": "Role",
      "schema:author": "https://orcid.org/0000-0002-1232-6716"
    },
    {
      "id": "https://orcid.org/ 0000-0002-2027-8283",
      "type": "Person",
      "affiliation": {
        "type": "Organization",
        "name": "UMR SyMMES CNRS/CEA-Grenoble/IRIG"
      },
      "email": "micha@esrf.fr",
      "familyName": "MICHA",
      "givenName": "Jean-Sbastien"
    },
    {
      "id": "https://orcid.org/0000-0003-2738-7279",
      "type": "Person",
      "affiliation": {
        "type": "Organization",
        "name": "CEA-Grenoble/IRIG/MEM/NRX"
      },
      "email": "odile.robach@esrf.fr",
      "familyName": "Robach",
      "givenName": "Odile"
    },
    {
      "id": "https://orcid.org/0000-0002-1786-8581",
      "type": "Person",
      "affiliation": {
        "type": "Organization",
        "name": "CEA-Grenoble/IRIG/MEM/NRX"
      },
      "email": "samuel.tardif@cea.fr",
      "familyName": "Tardif",
      "givenName": "Samuel"
    }
  ],
  "codeRepository": "https://github.com/BM32ESRF/LaueNN",
  "dateCreated": "2021-08-15",
  "dateModified": "2023-03-24",
  "datePublished": "2021-10-18",
  "description": "LaueNN allows the crystallographic indexing of data from X-ray Laue microdiffraction using Neural Network Classifier.",
  "identifier": "https://doi.org/10.1107/S1600576722004198  ",
  "isPartOf": "https://github.com/BM32ESRF/",
  "keywords": [
    "X-ray scattering",
    "Laue diffraction",
    "Laue microscopy",
    "microstructure",
    "crystal orientation",
    "crystal strain",
    "crystallography",
    "crystal lattice parameters",
    "Machine Learning",
    "Deep Learning",
    "Neural Network"
  ],
  "license": "https://spdx.org/licenses/CECILL-B",
  "name": "LaueNN",
  "operatingSystem": [
    "Linux",
    "MacOS",
    "windows"
  ],
  "programmingLanguage": "Python 3",
  "relatedLink": "https://github.com/BM32ESRF/LaueTools",
  "version": "3.1.19"
}

GitHub Events

Total
  • Watch event: 2
  • Push event: 3
  • Fork event: 1
  • Create event: 2
Last Year
  • Watch event: 2
  • Push event: 3
  • Fork event: 1
  • Create event: 2

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 183
  • Total Committers: 2
  • Avg Commits per committer: 91.5
  • Development Distribution Score (DDS): 0.022
Top Committers
Name Email Commits
Ravi 1****F@u****m 179
Ravi 4****1@u****m 4

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 2
  • Total pull requests: 1
  • Average time to close issues: 4 days
  • Average time to close pull requests: 8 minutes
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • xxPLxx (2)
Pull Request Authors
  • STardif (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels
test (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 137 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 124
  • Total maintainers: 1
pypi.org: lauetoolsnn

LaueNN- neural network training and prediction routine to index single and polycrystalline Laue diffraction patterns

  • Versions: 124
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 137 Last month
Rankings
Dependent packages count: 10.0%
Downloads: 10.9%
Forks count: 16.8%
Average: 16.9%
Dependent repos count: 21.7%
Stargazers count: 25.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • Keras *
  • PyQt5 *
  • fabio *
  • h5py *
  • matplotlib *
  • networkx *
  • numpy *
  • scikit-image *
  • scikit-learn *
  • scipy *
  • tensorflow *
  • tqdm *
setup.py pypi
  • Keras >=2.7.0
  • PyQt5 >=5.9
  • fabio >=0.11.0
  • h5py >=3.1
  • matplotlib >=3.4.2
  • networkx >=2.6.3
  • numpy >=1.18.5
  • scikit-image >=0.18.0
  • scikit-learn >=0.24.2
  • scipy >=1.7.0
  • tensorflow >=2.7.0
  • tqdm >=4.60.0
.github/workflows/complete_workflow.yml actions
  • actions/checkout v3 composite
  • actions/checkout v2 composite
  • actions/setup-python v3 composite
  • actions/setup-python v2 composite
  • ravipurohit1991/conda-package-publish-action v2.0 composite
  • ravipurohit1991/conda-package-publish-action v1.9 composite