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
using Luxor | |
function array2dtogrid(a2d::AbstractArray) | |
g = Tiler(200, 200, size(a2d)[1:2]..., margin=25) | |
for (pos, n) in g | |
setgray(a2d[n]) | |
box(pos, g.tilewidth, g.tileheight, :fill) | |
setgray(1-a2d[n]) | |
text(string(round(a2d[n], 2)), pos, halign=:center) | |
end | |
end |
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
MacBook-Pro ~ $ julia | |
_ | |
_ _ _(_)_ | A fresh approach to technical computing | |
(_) | (_) (_) | Documentation: https://docs.julialang.org | |
_ _ _| |_ __ _ | Type "?help" for help. | |
| | | | | | |/ _` | | | |
| | |_| | | | (_| | | Version 0.6.0-rc1.0 (2017-05-07 00:00 UTC) | |
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release | |
|__/ | x86_64-apple-darwin13.4.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
# most of the code is by Rainer Engelken | |
# updated to Julia 1.0 syntax, tested on 1.4 | |
using Luxor, StaticArrays | |
# poincare section of chaotic network of three neurons | |
function spikingnet(n, couplingstrength=1.0) | |
# number of spikes in calculation |
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
using HTTP, JSON, Query | |
# get data for the julia channel "UC9IuUwwE2xdjQUT_LMLONoA" | |
function getrawdata(nextpagetoken, apikey) | |
d = HTTP.get("https://www.googleapis.com/youtube/v3/search?key=$(apikey)&channelId=UC9IuUwwE2xdjQUT_LMLONoA&pageToken=$(nextpagetoken)&part=snippet,id&order=date&maxResults=50") | |
return d.body | |
end | |
jsonpages = [] # store the json pages, 50 records at a time | |
vidlinks = [] # to hold the video titles and links |
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
julia> Pkg.status() | |
37 required packages: | |
- AstroLib 0.1.0 | |
- Atom 0.6.1 | |
- BenchmarkTools 0.0.8 | |
- Cairo 0.3.0 | |
- ColorSchemes 1.4.0+ master | |
- Combinatorics 0.4.1 | |
- DataFrames 0.10.0 | |
- Documenter 0.11.1 |
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
using Luxor, Colors, Combinatorics, Random | |
mutable struct Ball | |
id::Int | |
position::Point | |
velocity::Point | |
color::Union{NTuple, Colorant, String} | |
ballradius::Float64 | |
end |
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
using Luxor | |
using ODE # I should be using OrdinaryDiff, but that's for another day | |
function pendulum(t, y) | |
Y = [6 * (2 * y[3] - 3 * cos(y[1] - y[2]) * y[4])/(16 - 9 * cos(y[1] - y[2])^2); | |
6 * (8 * y[4] - 3 * cos(y[1] - y[2]) * y[3])/(16 - 9 * cos(y[1] - y[2])^2)] | |
[Y[1]; | |
Y[2]; | |
- (Y[1] * Y[2] * sin(y[1] - y[2]) + 3 * sin(y[1]))/2; |
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
using Luxor, DynamicalSystems, Colors | |
function frame(scene, framenumber, datas) | |
background("black") | |
# datas contains two datasets | |
# each dataset is an array of sarrays of 4 floats | |
d1, d2 = datas | |
offset = π / 2 | |
L = 200 | |
disksize = 15 |
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
using Luxor | |
darker_blue = (0.251, 0.388, 0.847) | |
darker_purple = (0.584, 0.345, 0.698) | |
darker_green = (0.22, 0.596, 0.149) | |
darker_red = (0.796, 0.235, 0.2) | |
@png begin | |
w = 256 | |
background("white") | |
origin() |
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
using Luxor | |
pentagon(pos, radius, ang=0, action=:stroke) = ngon(pos, radius, 5, ang, vertices=true) | |
function drawmonth(year, month, radius) | |
# origin is now in center of pentagon | |
@layer begin | |
rotate(pi) | |
fontsize(18) | |
fontface("DINNextLTPro-Black") |