Skip to content

Instantly share code, notes, and snippets.

View goerz's full-sized avatar

Michael Goerz goerz

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@goerz
goerz / check_inventory.jl
Created March 27, 2024 21:54
Testing an `objects.inv` inventory file in Julia
# Assumptions
#
# * current working directory is the root directory of the project ("DocInventories") in this case
# * the documentation for the project has been built locally in `docs/build/`
# * the documentation has also been deployed online and is available at the `root_url` hard-coded in the script. Otherwise, do not call `check_url`
# * running on Unix (otherwise: adjust that path separator)
using HTTP
using URIs
using DocInventories
@goerz
goerz / 3-level_mod.svg
Last active March 26, 2024 02:36
Three-Wave Mixing AutoDiff Example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@goerz
goerz / mwe.jl
Created March 20, 2024 21:24
Julia Parametrization MWE
# This MWE is to explore the use of RecursiveArrayTools for optimizing
# parameters for control functions.
#
# We want two things:
#
# * Extract control parameters that might occur in a set of Hamiltonians, each
# Hamiltonian containing multiple controls, and each control containing an
# AbstractVector of parameters (a ComponentArray seems very useful, but it
# could be any AbstractVector). This should be done with a function
# `get_parameters()` that collects all control parameters in a
using Pkg
Pkg.activate(temp=true)
Pkg.add("MarkdownAST")
import MarkdownAST
"""
replace(f::Function, root::Node)
@goerz
goerz / animation-sketch.jl
Created June 8, 2023 18:31 — forked from cormullion/animation-sketch.jl
an animated something
using Luxor, Thebes, MathTeXEngine
function frame(scene, framenumber)
background("white")
sethue("black")
fontsize(15)
eased_n = scene.easingfunction(framenumber, 0, 1, scene.framerange.stop)
helloworld()
eyepoint(200, 200, 100)
setline(0.5)
@goerz
goerz / profile_propagate.jl
Created March 26, 2022 22:45
Profile Newton Propagation
# Include this file in a devrepl of
module TransmonModel
using LinearAlgebra
using SparseArrays
using QuantumControl.Shapes: flattop
const GHz = 2π
const MHz = 0.001GHz
const ns = 1.0
@goerz
goerz / extract_textblocks.py
Created March 24, 2022 03:05
Python script for extracting textblocks from Beamer presentations
#!/usr/bin/env python
"""Extract textblocks from a Beamer presentation.
This is useful for making Powerpoint slides from Beamer presentations.
"""
import logging
import click
from pathlib import Path
PREAMBLE = r"""\documentclass[compress, aspectratio=169]{beamer}
@goerz
goerz / 2022-03-19_ChainRulesComplexDet.ipynb
Last active March 20, 2022 03:54
Analytical Reverse-AD for the determinant of a complex matrix (https://github.com/JuliaDiff/ChainRules.jl/issues/600)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@goerz
goerz / find.jl
Created January 16, 2022 18:30
Find a string in a deeply nested Julia data structure
function find_string(obj, name::String, string::String)
for _name in propertynames(obj)
found = find_string(getproperty(obj, _name), name * "." * String(_name), string)
if !isnothing(found)
return found
end
end
end
function find_string(obj::String, name::String, string::String)