SASNets is a Python program for determining the shape that a SANS (Small Angle Neutron Scattering) dataset of Q and I(Q) comes from. It currently contains two nets: a traditional MLP of 9 layers, and a 1D convolutional network of 11 layers.
SASNets makes use of datafiles generated by a fork of SASModels, found at pkienzle/sasmodels.
Basic flow:
# Grab sasnets repo, and sasmodels repo to generate data.
git clone https://github.com/scattering/sasnets
git clone https://github.com/pkienzle/sasmodels
# Create the conda environment.
# ... probably missing some packages here...
conda create -n sasnets python numpy scipy matplotlib scikit-learn pandas
conda activate sasnets
pip install columnize # ... for pretty output columns [optional]
# Add tensorflow or tensorflow-gpu, depending on whether you have nvidia
# hardware (and drivers for cuda 10.0 for tensorflow 2.x).
#conda install -y tensorflow-gpu
conda install -y tensorflow
# Need sasmodels for data generation. This requires pycuda, pyopencl
# or a C compiler to run.
conda install -y pybind11 appdirs decorator mako
pip install pyopencl
#pip install pycuda
#pip install tinycc # small C compiler for windows, if you need it.
# Work from the sasnets directory
cd sasnets
# Generate the table "train" in sasnets.db. In this case we are
# only selecting the different types of sphere models.
bin/sasgen --count=2000 --mono=true *sphere | tee generate.log
# Use 'all' for the full dataset (600 MB at 2000 items per model).
# Train on the dataset (you will want to use more epochs...)
bin/sasnet -v --epochs=10
# Show training results
bin/sasanal
# Show dendrogram
bin/sasanal -c
On windows, use python bin/sasgen
, etc.