Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tom-draper/nlmrs
A Rust crate for building Neutral Landscape Models.
https://github.com/tom-draper/nlmrs
data-visualization environment landscape landscapes landscaping matplotlib model modeling models neutral-landscape-model nlm nlm-api patterns rust rust-lang simulation visualization world-building
Last synced: 27 days ago
JSON representation
A Rust crate for building Neutral Landscape Models.
- Host: GitHub
- URL: https://github.com/tom-draper/nlmrs
- Owner: tom-draper
- Created: 2023-01-04T19:34:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-22T10:10:56.000Z (12 months ago)
- Last Synced: 2024-09-15T07:51:20.668Z (about 2 months ago)
- Topics: data-visualization, environment, landscape, landscapes, landscaping, matplotlib, model, modeling, models, neutral-landscape-model, nlm, nlm-api, patterns, rust, rust-lang, simulation, visualization, world-building
- Language: Rust
- Homepage:
- Size: 3.64 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NLMrs
A Rust crate for building Neutral Landscape Models.
Inspired by [nlmpy](https://pypi.org/project/nlmpy/) and [nlmr](https://github.com/ropensci/NLMR).
## Installation
```bash
cargo add nlmrs
```## Example
```rs
use nlmrs;fn main() {
let arr: Vec> = nlmrs::midpoint_displacement(10, 10, 1.);
println!("{:?}", arr);
}
```### Export
The `export` module holds a collection of user-friendly functions to export your 2D NLM vector.
```rs
use nlmrs::{distance_gradient, export};fn main() {
let arr: Vec> = distance_gradient(50, 50);
export::write_to_csv(arr, "./data/data.csv");
}
```### Visualization
Running `scripts/visualize.py` will read any contents of `data/data.csv` and render them as a matplotlib plot.
## Algorithms
### Random
`random(rows: 100, cols: 100)`
### Random Element
`random_element(rows: 100, cols: 100, n: 50000.)`
### Planar Gradient
`planar_gradient(rows: 100, cols: 100, direction: Some(60.))`
### Edge Gradient
`edge_gradient(rows: 100, cols: 100, direction: Some(140.))`
### Distance Gradient
`distance_gradient(rows: 100, cols: 100)`
### Wave Gradient
`wave_gradient(rows: 100, cols: 100, period: 2.5, direction: Some(90.))`
### Midpoint Displacement
`midpoint_displacement(rows: 100, cols: 100, h: 1.)`
### Hill Grow
`hill_grow(rows: 100, cols: 100, n: 10000, runaway: true, kernel: None, only_grow: false)`
## Contributions
Contributions, issues and feature requests are welcome.
- Fork it (https://github.com/tom-draper/nlmrs)
- Create your feature branch (`git checkout -b my-new-feature`)
- Commit your changes (`git commit -am 'Add some feature'`)
- Push to the branch (`git push origin my-new-feature`)
- Create a new Pull Request