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 SHA | |
function archive_source_string(prefix_name, prefix, suffix, oldhash::String; joinchar = "", unpack_target = nothing) | |
url = join((prefix, suffix,), joinchar) | |
hash = bytes2hex(get_hash(url)) | |
print("ArchiveSource(\"\$($(prefix_name))$(joinchar)$(suffix)\", \"$(hash)\"") | |
if !isnothing(unpack_target) | |
print("; unpack_target = \"$(unpack_target)\")") | |
else | |
print(")") |
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 Proj, BenchmarkTools | |
import GeometryOps as GO | |
# using proj_trans_generic on a vector of tuples - or could be GB.Point or SVector or GI.Point with arbitrary metadata, doesn't matter! | |
points = tuple.(rand(10000), rand(10000)) | |
t = Proj.Transformation("+proj=longlat", "+proj=natearth"; always_xy = true) | |
function batch_project_numsfirst!(points, projection) | |
# GC.@preserve points begin # not technically necessary |
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
_stix_fonts = Dict(:regular => "/System/Library/Fonts/Supplemental/STIXTwoMath.otf",#joinpath("NewComputerModern", "NewCMMath-Regular.otf"), | |
:italic => "/System/Library/Fonts/Supplemental/STIXTwoMath.otf",#joinpath("NewComputerModern", "NewCM10-Italic.otf"), | |
:bold => "/System/Library/Fonts/Supplemental/STIXTwoMath.otf",#joinpath("NewComputerModern", "NewCM10-Bold.otf"), | |
:bolditalic => "/System/Library/Fonts/Supplemental/STIXTwoMath.otf",#joinpath("NewComputerModern", "NewCM10-BoldItalic.otf"), | |
:math => "/System/Library/Fonts/Supplemental/STIXTwoMath.otf" | |
) | |
Makie.MathTeXEngine.default_font_families["STIX"] = Makie.MathTeXEngine.FontFamily( | |
_stix_fonts, |
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 BenchmarkTools, Metal | |
using Makie, CairoMakie | |
using RecurrenceAnalysis | |
function recurrence_kernel!(output_matrix, x1, x2) | |
x, y = Metal.thread_range() | |
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
# # A GUI to display location "attractiveness" | |
# The following code creates a GUI which allows you to inspect | |
# a map of Toronto, and see the attractiveness of different locations | |
# based on different nearness measures. | |
# First, we load the necessary packages. | |
# We will build our GUI with the `Makie` toolchain, consisting of `Makie`, `[W]GLMakie`, and `Tyler` for map tile visualization. | |
# Data is from OpenStreetMap and is parsed using `OpenStreetMapX`. Attractiveness scores are obtained using `OSMToolset`. |
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 Makie: GeometryBasics | |
using Makie.GeometryBasics: StructArrays | |
@recipe(MeshImage) do scene | |
Attributes( | |
npoints = 100, | |
space = :data, | |
) | |
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
# auto facet for makie | |
# Taken from Plots.jl | |
function compute_gridsize(numplts::Int; landscape = false, nr = -1, nc = -1) | |
# figure out how many rows/columns we need | |
if nr < 1 | |
if nc < 1 | |
nr = round(Int, sqrt(numplts)) | |
nc = ceil(Int, numplts / nr) | |
else |
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 Makie, WGLMakie | |
# implementation from the PGFPlots example gallery, at https://pgfplots.net/klein-bottle/ | |
klein(u, v) = Point3f((-2/15 * cos(u) * ( | |
3*cos(v) - 30*sin(u) | |
+ 90 *cos(u)^4 * sin(u) | |
- 60 *cos(u)^6 * sin(u) | |
+ 5 * cos(u)*cos(v) * sin(u)) | |
), | |
(-1/15 * sin(u) * (3*cos(v) |
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 Makie, CairoMakie | |
# patch a bug in Makie, will push a PR laters | |
@eval Makie begin | |
function apply_transform(f::PointTrans{N}, point::VecTypes{N}) where N | |
return f.f(point) | |
end | |
function apply_transform(f::PointTrans{N1}, point::VecTypes{N2}) where {N1, N2} |
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 Makie, MakieTeX, CairoMakie | |
# Makie v0.17 and associated packages | |
using DifferentialEquations, Polynomials | |
# define the default theme | |
Makie.set_theme!(Theme( | |
font = "CMU Serif", | |
fontsize = 12, # 12, | |
Axis = ( |
NewerOlder