A Python package for Neutron Reflectivity data analysis using Machine Learning. Including Chi parameters prediction from SLD profile data and SLD profile prediction from NR curves.
NR-SCFT-ML is a PyPI package for efficient processing and analysis of Neutron Reflectivity (NR) data. It provides a streamlined pipeline for:
- Preprocessing NR datasets
- Predicting SLD Profile by training a CNN
- Predicting Chi parameters by training a combined Autoencoder and MLP model.
Conda
Python >=3.10
Prepare the Package Environment on HPC or Your Local Machine (Large Memory Required). The setup.sh creates a Jupyter kernel environment named PyreflectEnvironment.
run in cell:
!curl -fsSLo setup.sh https://raw.githubusercontent.com/williamQyq/pyreflect/main/setup.sh
!bash setup.sh
To install from TestPyPI, run:
%pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pyreflect==1.3.1To learn how to use it, check the example notebooks in pyreflect/example_notebooks or watch the tutorial video. Click below:
To initialize the default configuration for model path, hyperparameters, and data reading paths, run:
python -m pyreflect init --forceUse the --force flag if the configuration has already been created and you want to overwrite it.
Open settings.yml and update the file paths for your SLD profile data and Chi parameters
Generate training datasets using the example in example_notebook_autoencoder.ipynb.
The memory usage should be properly managed by controlling the number of curves generated for training, as it will consume a large amount of memory.
Train the model using the example in example_notebook_SLD_prediction.ipynb.
datasets contains processed experimental NR, its manual fit SLD profile data, and AE denoised experimental NR data.
python -m pyreflect run --enable-chi-predictionpython -m pyreflect run --enable-sld-predictionThis project builds on work by:
- Brian Qu (NR-SLD-CNN)
- Dr. Rajeev Kumar
- Prof. Miguel Fuentes-Cabrera NR-SCFT-ML
- Yuqing Qiao (William) – Maintainer and developer of this PyPI package