Skip to content

Instantly share code, notes, and snippets.

View djnavarro's full-sized avatar

Danielle Navarro djnavarro

View GitHub Profile
@djnavarro
djnavarro / rectgenerate_1.R
Created June 24, 2020 19:26
shepard / tenenbaum & griffiths model as art
# author: Danielle Navarro
# date: 2020-06-23
# packages
library(ggplot2)
library(dplyr)
library(scico)
library(here)
rectgenerate <- function(seed) {
@djnavarro
djnavarro / voronoi_tree_03.R
Created May 30, 2020 21:26
minimal voronoi tree
library(flametree) # github.com/djnavarro/flametree
library(voronoise) # github.com/djnavarro/voronoise
library(dplyr)
# set seed
seed <- 1
set.seed(seed)
# the "flametree" itself
ftree <- flametree_grow(
library(dplyr)
library(ambient)
intrusion <- function(filename, shade = "#b3b3ff", seed = 1,
frak_one = 3, frak_two = 2,
pixels_wide = 1000, pixels_high = 1000,
colors_used = 1000) {
# transformation functions ------------------------------------------------
library(flametree) # https://github.com/djnavarro/flametree
library(scopes) # https://github.com/djnavarro/scopes
library(ggforce)
library(ggplot2)
library(dplyr)
library(ambient)
# settings
pixels <- 1000
fname <- "~/Desktop/scopetree.png"
@djnavarro
djnavarro / bomrang.R
Last active April 20, 2020 07:29
Minimal use of bomrang and stars
library(tidyverse)
img <- bomrang::get_satellite_imagery(
product_id = "IDE00427.201912280400.tif",
cache = TRUE
) %>% stars::st_as_stars()
ggplot() +
stars::geom_stars(data = img)
@djnavarro
djnavarro / ou-model.R
Created April 16, 2020 20:42
toy example with leaky accumulator models
# illustrate that the temporally-accrued evidence in an Ornstein-
# Uhlenbeck model of perceptual decision-making is bounded
t <- 500 # length of time to run the process
drift <- .2 # drift rate measures the perceptual signal strength
leak <- .9 # evidence leakage rate
# momentary samples are presumed to generate normally distributed
# evidence with mean corresponding to drift rate, and (for reasons
# known but to Roger) standard deviation .1
library(flametree)
library(ggplot2)
library(gganimate)
dat <- flametree_grow(time = 13)
pic <- ggplot(
data = dat,
mapping = aes(
x = coord_x,
# https://github.com/djnavarro/jasmines
library(jasmines)
library(dplyr)
simple_plot <- function(octaves) {
dat <- use_seed(259) %>%
scene_rows(
n = 5,
library(jasmines)
library(dplyr)
# data structure to plot
dat <- use_seed(1) %>%
scene_bubbles(n = 3, grain = 10000) %>%
mutate(x = x * 2, y = y * 2) %>%
unfold_tempest(
iterations = 4,
scale = .05,
@djnavarro
djnavarro / scope_05.R
Created March 30, 2020 08:51
draw a "scope" plot
library(ambient) # may need dev version: https://github.com/thomasp85/ambient
library(viridis)
# specify the seed and grain
seed <- 272
grain <- 1000
# specify the circle
origin_x <- .3
origin_y <- .5