nlmrs

Crates.ionlmrs
lib.rsnlmrs
version0.1.7
sourcesrc
created_at2023-01-06 16:23:54.696088
updated_at2023-01-18 20:05:44.786261
descriptionA Rust crate for building Neutral Landscape Models.
homepage
repositoryhttps://github.com/tom-draper/nlmrs
max_upload_size
id752397
size223,397
Tom Draper (tom-draper)

documentation

README

NLMrs

A Rust crate for building Neutral Landscape Models.

Inspired by nlmpy and nlmr.

Installation

cargo add nlmrs

Example

use nlmrs;

fn main() {
    let arr: Vec<Vec<f64>> = 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.

use nlmrs::{distance_gradient, export::write_to_csv};

fn main() {
    let arr: Vec<Vec<f64>> = distance_gradient(50, 50);
    write_to_csv(arr, "./data/data.csv");
}

Visualization

Running script/viz.py will read any contents of data/data.csv and render them as a matplotlib plot.

Algorithms

Random

random(100, 100)

Random Element

random_element(100, 100, 50000.)

Planar Gradient

planar_gradient(100, 100, Some(60.))

Edge Gradient

edge_gradient(100, 100, Some(140.))

Distance Gradient

distance_gradient(100, 100)

Wave Gradient

wave_gradient(100, 100, 2.5, Some(90.))

Midpoint Displacement

midpoint_displacement(100, 100, 1.)

Hill Grow

hill_grow(100, 100, 10000, true)

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
Commit count: 52

cargo fmt