This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to create a plot for the spatstat class ‘fv’, combined with 'Quantum Plots' from: | |
# Esser, D. S., Leveau, J. H. J., Meyer, K. M., & Wiegand, K. (2014). Spatial scales of interactions among bacteria and between bacteria and the leaf surface. FEMS Microbiology Ecology, 91(3), fiu034. http://doi.org/10.1093/femsec/fiu034 | |
# The colored bands highlight the spatial scales at which the summary statistics deviate from the simulation envelopes. | |
quantumPlot <- function(x,colour=c("#d73027", "#ffffbf", "#91bfdb")){ | |
# load Packages | |
require(ggplot2) | |
require(ggthemes) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(raster) | |
nlm_raster <- nlm_gaussianfield(100, 100, 5) | |
setGeneric( | |
"splitRaster", | |
function(r, nx = 1, ny = 1, buffer = c(0, 0), path = file.path(getwd(), names(r)), cl) { | |
standardGeneric("splitRaster") | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create landscapes | |
set.seed(5) | |
percolation_landscape <- nlm_percolation(100,100,0.4, resolution = 10) | |
random_landscape <- nlm_random(100,100, resolution = 10) | |
distagrad_landscape <- nlm_distancegradient(100, 100, origin = c(10,15,10,15), resolution = 10) | |
edgegradient_landscape <- nlm_edgegradient(100,100, 90, resolution = 10) | |
planar_landscape <- nlm_planargradient(100,100, resolution = 10) | |
randomRecCluster_landscape <- nlm_randomrectangularcluster(100, 100, minL = 8, maxL = 16, rescale = FALSE, resolution = 10) | |
randomElement_landscape <- nlm_randomelement(100,100, n = 90, resolution = 10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ncol <- 100 | |
nrow <- 100 | |
germs <- 50 | |
# bounding box placing germs and clipping ---- | |
bounding_box <- sf::st_sfc(sf::st_polygon(list(rbind(c(0, 0), | |
c(ncol, 0), | |
c(ncol, nrow), | |
c(0, nrow), | |
c(0, 0))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Specify remote worker | |
login <- tweak(remote, workers = "SERVER IP", user = 'USERNAME') | |
# Specify future topology | |
## login node -> { multiple cores } | |
plan(list( | |
login, | |
multiprocess | |
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "???? <html><div style='float:left'></div><hr color='#EB811B' size=1px width=796px></html>" | |
author: "Marco Sciaini" | |
date: "`r Sys.Date()`" | |
output: | |
xaringan::moon_reader: | |
css: [default, metropolis, metropolis-fonts] | |
nature: | |
beforeInit: "macros.js" | |
highlightStyle: github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
landscape_padded <- pad_raster(landscape) | |
# landscape_padded <- landscape | |
adjacent_cells <- raster::adjacent( | |
landscape_padded, | |
cells = seq_len(raster::ncell(landscape_padded)), | |
directions = 4, | |
pairs = TRUE | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(NLMR) | |
library(sf) | |
library(purrr) | |
library(rcartocolor) | |
library(gganimate) | |
library(classInt) | |
landscape <- NLMR::nlm_fbm(50, 100, fract_dim = 1.2) | |
breaks <- landscape %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
future_results <- list.files("/home/uni08/msciain/.future", pattern = glob2rx("*1.rds"), recursive = T, full.names = TRUE) %>% map_dfr(readRDS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Step1: Create a nl obejct: | |
nl <- nl(nlversion = "6.0.4", | |
nlpath = "/home/marco/nlrx_usecase/1_Helper/NetLogo 6.0.4/", | |
modelpath = "/home/marco/nlrx_usecase/1_Helper/NetLogo 6.0.4/app/models/Sample Models/Networks/Team Assembly.nlogo", | |
jvmmem = 1024) | |
## Step2: Add Experiment | |
# Inspect the model available model parameters: | |
nl@experiment <- experiment(expname = "links_team", |
OlderNewer