Port of the AITW microstructure generation code from Matlab to Python.
Check the EESSI documentation to see on which version of EESSI the package is available.
Run on a system with EESSI pre-installed or install EESSI on your own system
Load the package from EESSI:
# Follow instructions of your system to initialize EESSI
# For a local/native installation:
# source /cvmfs/software.eessi.io/versions/2023.06/init/lmod/bash
module load EESSI/2023.06 # Or the latest version that has the package available
module load AITW-microstructurespip install AITW_wood_microstructureDownload the source code and install it using pip.
cd <PATH to folder with pyproject.toml>
pip install .Example for birch microstructure generation.
from wood_microstructure import BirchMicrostructure, BirchParams
params = BirchParams.from_json('FILE_PATH.json')
for param in params:
birch = BirchMicrostructure(param)
birch.run()The installation will make available a wood_ms command line interface.
- Run
wood_ms --helpto see the available commands. - Run
wood_ms generate --helpto see all available options for generating microstructures. - Run
wood_ms generate WOOD_TYPE --config-file JSON_FILEto generate a microstructure of typeWOOD_TYPEusing the parameters inJSON_FILE.WOOD_TYPEcan be one of:birch,spruce.JSON_FILEis a path to a json file with the parameters for the microstructure generation.
- Run
wood_ms postproc --helpflag to see all available commands for postprocessing. - Run
wood_ms train --helpflag to see all available options for training a model.
Example for birch microstructure generation:
wood_ms generate birch --config-file examples/example_birch.jsonEnabling tab autocompletion https://click.palletsprojects.com/en/stable/shell-completion/
E.G for bash run the command
eval "$(_WOOD_MS_COMPLETE=bash_source wood_ms)"You can also add it to either ~/.bashrc or, if you are using a virtual environment, to bin/activate of the virtual environment to avoid running the command for every new shell.
- W.R.T the matlab code,
saveSlicein the json file can be alist[int]instead of just anintor"all"to work-on/save all slices. - Most functions have been optimized to have the loop over the Z slices as the outermost one. Since the Z slices are almost always treated independently, we can than run the loops over only the slices of interest.