Instantly share code, notes, and snippets.

🎩

# Anshul Singhvi asinghvi17

🎩
• Columbia University
• New York, NY
Created Jun 16, 2022
Flip axis in Makie using PointTrans
View flipped_axis.jl
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}
Last active May 10, 2022
Gist of one of my FHN MakieLayout figures
View fitzhugh_nagumo_makielayout.jl
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 = (
Last active May 7, 2022
Interactive cobweb plot with Makie
View cobweb.jl
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, GLMakie f(x::Real, r::Real) = r * x * (1 - x) function cobweb( xᵢ::Real, curve_f::Function, r::Real; nstep::Real = 30 )::Vector{Point2f} # col 1 is x, col 2 is y
Created May 7, 2022
PDF metadata writing script for Julia
View insert_pdf_description.jl
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
 # Author: Anshul Singhvi # Works as of 20220507 # Basically, the function is used to edit the metadata of a PDF using Ghostscript # This could be made pure-Julian with the right logic (searching for keywords, etc.) # but that is annoying to do. using Ghostscript_jll const AUTHOR = Ref{String}("Anshul Singhvi")
Created Aug 6, 2020
Makie position popup along multiple axes
View position_popup.jl
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 using Makie.AbstractPlotting.MakieLayout function position_popup!( scene, axes; formatter = (point::Point2f0) -> string(round.(Float64.(point), digits = 3)), ) visible = Observable(false)
Last active Apr 4, 2020
View tex_prototype.jl
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
 # Generate the tex file rawtex = raw""" \documentclass{standalone} \begin{document} $\left[{\frac{-\hbar^{2}}{2m}}\nabla^{2}+V(\mathbf{r})\right]\Psi(\mathbf{r}) = E\Psi(\mathbf{r})$ % Schrodinger equation \end{document} """ lua_stdin = IOBuffer(writable = true)
Created Aug 3, 2019
View MakieUSPop.jl
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
 # setup # import Pkg; # Pkg.pkg"add Makie#master PlotUtils GeoInterface GeoJSON" using Makie using GeoInterface, GeoJSON using PlotUtils states = download("https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json")
Created Jun 28, 2019 — forked from endolith/frequency_estimator.py
Frequency estimation methods in Python
View frequency_estimator.py
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
 from __future__ import division from numpy.fft import rfft from numpy import argmax, mean, diff, log, nonzero from scipy.signal import blackmanharris, correlate from time import time import sys try: import soundfile as sf except ImportError: from scikits.audiolab import flacread
Last active May 15, 2019
View interactive_lorenz.jl
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
 ## setup differential equation using DifferentialEquations, ParameterizedFunctions lorenz = @ode_def Lorenz begin # define the system dx = σ * (y - x) dy = x * (ρ - z) - y dz = x * y - β*z end σ ρ β
Created May 5, 2019
View mass_prs.jl
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
 #!/usr/bin/env julia ### USAGE # GITHUB_AUTH="MY_GITHUB_AUTH_TOKEN_HERE" FILENAME.jl ### ## NOTE: # To set this up, you will need to change the two constants below # to the user who will fork, # and the organization which owns the repos.