A CLI for generating synthetic Laguerre polycrystalline microstructures
Project description
SynthetMic-CLI
About
SynthetMic-CLI is a command line interface for generating 2D and 3D synthetic polycrystalline microstructures using Laguerre tessellations. It uses the fast algorithms (developed in this paper) for generating grains of prescribed volumes using optimal transport theory. It is built on top of SynthetMic package which is the Python implementation of the fast algorithms.
Installation
To install the latest version of the CLI via pip, run
pip install synthetmic-cli
If you are using
uvto manage your project, run the following command instead:
uv add synthetmic-cli
Usage
All the available commands in the CLI can be checked by running
sm --help
Each of these commands are explained as follows.
-
sample-seedssamples random seeds in a box with dimension specfied byBOX_SPECS. For instance, to sample 1000 random seeds in a unit cube (this means seeds will be generated in the domain [0, 1] x [0, 1] x [0, 1]) and save the results in the path ./mydir/seeds.csv, runsm sample-seeds 1 1 1 --n-grains 1000 --save-path ./mydir/seeds.csvYou can check all other options under this command by running
sm sample-seeds --help -
sample-spvolssamples single phase target volumes using box dimension given byBOX_SPECS. By default, this command generates constant target volumes, but users can choose from other distributions including uniform and log-normal distributions. For example, to generate constant target volumes for 1000 grains in a unit cube and save the results to ./mydir/vols.csv, one runssm sample-spvols 1 1 1 --n-grains 1000 --save-path ./mydir/spvols.csvOther options under this command can be checked by running
sm sample-vols --help -
sample-dpvolssamples dual phase targe volumes in a box specified byBOX_SPECS. This command allows specifying different volume distribution for each phase of the microstructure. For instance, one can specify uniform distribution on phase 1 and log-normal for phase 2 in a unit cube of 1000 grains:sm sample-dpvols 1 1 1 --n-grains 1000 --dist-params1 uniform 1 2 --dist-params2 lognormal 1 0.35 --save-path ./mydir/dpvols.csvNote:
--dist-params1 uniform 1 2means sample from uniform distribution with parameters a = 1 and b = 2 for phase 1;--dist-params2 lognormal 1 0.35means sample from lognormal distribution with parameters mean = 1 and std = 0.35 for phase 2.Other options under this command can be checked by running
sm sample-dpvols --help -
describeprints out information about seeds or target volumes saved inPATH. For instance, to print out information about seeds saved in ./mydir/seeds.csv, runsm describe ./mydir/seeds.csv -
generategenerates synthetic microstructure with box specsBOX_SPECS, seeds saved inSEEDS_PATH, and target volumes saved inTARGET_VOLS_PATH. For example, to generate microstructure in a unit cube with seeds in ./mydir/seeds.csv and target volumes in ./mydir/dpvols.csv; and save all results to ./mydir/results.zip, we runsm generate 1 1 1 ./mydir/seeds.csv ./mydir/dpvols.csv --save-path ./mydir/results.zipTo see all options under this command, run
sm generate --help
Build from source
If you would like to build this project from source either for development purposes or for any other reason, it is recommended to install uv. This is what is adopted in this project. To install uv, follow the instructions in this link.
If you don't want to use uv, you can use other alternatives like pip.
The following instructions use uv for set up.
-
Clone the repository by running
git clone https://github.com/synthetic-microstructures/synthetmic-cli -
Create a python virtual environment by running
uv venv .venv --python PYTHON_VERSIONHere, PYTHON_VERSION is the supported Python version. Note that this project requires version >=3.11
-
Activate the virtual environment by running
source .venv/bin/activate -
Prepare all modules and dependencies by running the following:
uv sync --all-extras
Authors and maintainers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file synthetmic_cli-0.1.0.tar.gz.
File metadata
- Download URL: synthetmic_cli-0.1.0.tar.gz
- Upload date:
- Size: 156.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edd5cd3e8ddd7945e7bc1f36c52c1652bf65b3110423bdc3d31abe8a86d7f3d1
|
|
| MD5 |
804cb00cbdb7d35cfe05f7078bdc4126
|
|
| BLAKE2b-256 |
cf7e92e546b30a1344ef0f93a8d3769b69b1717094d088f2044d4c0ed2372d8d
|
File details
Details for the file synthetmic_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: synthetmic_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a166d55c57a5c30d573cd2e2f5f243af8891999fb63b44a8652df51bf2cd340c
|
|
| MD5 |
d331550b708f1ba410b66937a3ca7037
|
|
| BLAKE2b-256 |
13d44f5e8c3e78044766c8de022b73b42f11d5554fccefe310f552750b1fac7d
|