Skip to content

Instantly share code, notes, and snippets.

View tlambert03's full-sized avatar

Talley Lambert tlambert03

View GitHub Profile
@tlambert03
tlambert03 / gui_apis.py
Last active February 25, 2024 22:57
gui apis
‎‎​
@tlambert03
tlambert03 / mmti2.py
Last active January 22, 2024 18:10
Install Ti2
# https://bit.ly/4b9xkgI
# run with:
# powershell -Command "(New-Object Net.WebClient).DownloadString('https://bit.ly/4b9xkgI') | python"
# you may wish to change "python" to a specific version/env of python, e.g.
# powershell -Command "(New-Object Net.WebClient).DownloadString('https://bit.ly/4b9xkgI') | C:\Users\User\miniforge3\envs\mm\python.exe"
# or without powershell, if you have curl
# curl -L -o install_mm.py https://bit.ly/4b9xkgI && python install_mm.py && del install_mm.py
import urllib.request
@tlambert03
tlambert03 / photobleach.py
Last active December 20, 2023 21:19
Photobleaching calculations
import math
import pint
AVOGADRO = pint.Quantity("6.02214076e23 /mol")
PLANCK = pint.Quantity("6.62607015e-34 J*s")
C = pint.Quantity("299792458 m/s")
def _ensure_quantity(value: str | float | pint.Quantity, units: str) -> pint.Quantity:
quant = pint.Quantity(value)
@tlambert03
tlambert03 / build_mm.sh
Last active July 6, 2023 17:24
This script will download micro-manager and build just the DemoCamera. Can be used on apple silicon (with home-brew installed)
#!/bin/bash
# output to the current directory if no argument is given
if [[ $# -eq 0 ]]; then
OUTPUT=$(pwd)
else
OUTPUT=$1
fi
packages=("autoconf" "automake" "libtool" "boost")
from turtle import position
from typing import Sequence
import scipy.special
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import patches
from matplotlib.animation import FuncAnimation
import warnings
from scipy.fft import fft, fftshift, ifftshift, fftfreq
@tlambert03
tlambert03 / confocal_psf.py
Created April 28, 2023 00:48
confocal PSF as a function of pinhole size
import scipy.special
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import patches
from matplotlib.animation import FuncAnimation
WF_FWHM = 0.8436843684368438
WF_MAX = 2199.5516151207426
WF_INTEGRAL = 1300.2494235915415
@tlambert03
tlambert03 / deploy.yml
Created March 8, 2023 14:15
basic ci deploy
name: Deploy
# this job will be triggered whenever you push to main, or push a tag
on:
push:
branches:
- main
tags:
- "v*"
@tlambert03
tlambert03 / image_conv.ipynb
Created February 28, 2023 01:18
image convolution
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tlambert03
tlambert03 / pyperf.ipynb
Last active February 20, 2023 21:47
pyperf.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tlambert03
tlambert03 / drawdot.py
Created September 20, 2022 14:42
vispy scenegraph visualizer
from graphviz import Digraph
from vispy import scene
def trace(root):
nodes, edges = set(), set()
def build(v):
if v not in nodes:
nodes.add(v)
for child in v.children:
edges.add((child, v))