Skip to content

Instantly share code, notes, and snippets.

View keatonb's full-sized avatar

Keaton Bell keatonb

View GitHub Profile
@keatonb
keatonb / FAP.py
Created January 3, 2024 17:52
Calculate false alarm probability for a light curve
import lightkurve as lk
import numpy as np
from tqdm import tqdm
# lc = download or read in a lk.LightCurve object
fap = 1e-3 # False Alarm Probability level to calculate
nruns = 5000 # number of simulations to run (should be > 1/fap)
times = lc.time
@keatonb
keatonb / InterpolatePRF.ipynb
Last active April 17, 2021 00:55
Interpolate and resample TESS PRF at source location
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@keatonb
keatonb / lmfit_2DGaussian.ipynb
Created December 17, 2020 10:29
Fitting 2D data with a symmetric 2D Gaussian with lmfit
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@keatonb
keatonb / SpectralWindow.ipynb
Last active October 11, 2020 22:18
Exploring the Fourier spectral window in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@keatonb
keatonb / demo emcee intervene function.ipynb
Created October 2, 2020 21:51
Demo of how to use the proposed "intervene" functionality to sample a sinusoid with emcee
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@keatonb
keatonb / runspeedtest.py
Created August 21, 2020 23:22
Script to record internet speed in a cron job
#!/Users/keatonb/anaconda3/bin/python
import speedtest
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="whitegrid", rc={'axes.edgecolor':'.5'})
servers = [1782] #Seattle
threads = None
@keatonb
keatonb / clashsongs.txt
Created April 7, 2020 04:25
Fairly complete list of Clash songs
"1–2, Crush on You" B-side of "Tommy Gun"
"1977" B-side of "White Riot"
"48 Hours" The Clash
"All the Young Punks" Give 'Em Enough Rope
"Are You Red..Y" Cut the Crap
"Armagideon Time" B-side of "London Calling"
"Atom Tan" Combat Rock
"Bankrobber" Non-album single
"Brand New Cadillac" London Calling
"Broadway" Sandinista!
@keatonb
keatonb / scriptexample.py
Created March 9, 2020 01:52
Example of script that takes command line arguments
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 8 18:47:26 2020
@author: keatonb
Example of script that takes command line arguments
Call from terminal as `python scriptexample.py arg1 arg2 ...`
@keatonb
keatonb / Interactive Matplotlib Demo.ipynb
Last active March 7, 2020 07:04
Demo for interaction between matplotlib figure and ipywidgets for JRAD
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@keatonb
keatonb / fixagileheaders.py
Last active January 18, 2020 12:57
Force correct "IMAGETYP" fits keywords for Agile data
#All Agile frames are currently saved with "IMAGETYP" = "object" in the headers as of 01.18.2020
#This script assumes that all bias, dark, and flat filenames start with "bias", "dark", "flat"
#Run in folder containing files
#WARNING: will overwrite files with modified headers
from astropy.io import fits
from glob import glob
from tqdm import tqdm
for imagetype in ['bias','dark','flat']: