Skip to content

Instantly share code, notes, and snippets.

View colinclement's full-sized avatar

Colin Clement colinclement

View GitHub Profile
@colinclement
colinclement / tree_sitter_get_function_calls.py
Created July 22, 2022 23:23
Get all Python function calls with Tree Sitter queries
from athenacommon.tree_sitter import get_language
from tree_sitter import Parser
parser = Parser()
lang = get_language('python') # get lang whatever way if you lack athenacommon
parser.set_language(lang)
code = bytes("""def foo(qux):
h = boo()
for j in range(10):
@colinclement
colinclement / leastsq.py
Created March 26, 2019 21:17
Least-squares optimization function featuring geodesic accelerated Levenberg Marquardt
"""
leastsq.py
author: Colin Clement
date: 2019-03-26
This module defines a Levenberg Marquardt optimization routine, featuring
geodesic acceleration from Mark Transtrum's PRE paper
@article{transtrum2012geodesic,
@colinclement
colinclement / mog.py
Created February 29, 2016 05:09
Fit data like spectra or something to a sum of gaussians.
"""
mog.py
Mixture of gaussians. For fitting data that looks like Gaussians.
author: Colin Clement
date: 2016-2-29
"""