Skip to content

Instantly share code, notes, and snippets.

View iancze's full-sized avatar

Ian Czekala iancze

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import time
import multiprocessing as mp
import gc
#From https://gist.github.com/astrofrog/1453933
import numpy as np
import matplotlib.pyplot as plt
@iancze
iancze / frame.html
Last active August 29, 2015 14:01
Bokeh Embedding
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test plot</title>
</head>
<body>
<div id="9fe4daf9-51ec-4a04-a625-d9d6c84217a9">
<script
src="static/js/9fe4daf9-51ec-4a04-a625-d9d6c84217a9.js"
@iancze
iancze / arrays.py
Last active August 29, 2015 14:07
Accessing numpy arrays
import numpy as np
rr = np.linspace(0, 20, num=50) #50 elements linearly spaced from 0 to 20
a = 3.0
b = 7.5
w = 2.0
#The functional way
#this np.vectorize decorator is sort of python magic, but allows you
@iancze
iancze / yo.py
Created October 23, 2014 03:11
YOCODEDONE
#!/usr/bin/env python
import yopy #Install with pip install yopy
username = "IANCZE" #Your personal yo account
token = <REDACTED> #Developer API key
yo = yopy.Yo(token=token,user="YOCODEDONE") #(optionally) create a separate account on your DEV page to send the Yo's
yo.yo(username) #send a yo at me, yo
#Usage
#$ python mcmc.py ; ./yo.py
@iancze
iancze / index.jade
Created May 31, 2015 18:33
ERES source
extends ../reveal
block cssstyle
style.
.reveal img.noborder {
border:none;
box-shadow:none;
background:none;
@iancze
iancze / Starfish likelihood function
Created June 1, 2015 18:46
Starfish likelihood function
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Spectroscopic Likelihood Function\n",
"\n",
"by Ian Czekala (`iczekala@cfa.harvard.edu`)\n",
"\n",
\documentclass{aastex61}
% \documentclass[modern]{aastex61}
\shorttitle{Test AAS Document}
\shortauthors{Czekala et al.}
\begin{document}
\title{Testing}
# based off of DFM's notebook here: https://gist.github.com/dfm/3f746476ac61e142b340ad74c7a1bc75
# imports come from PSOAP, celerite
term1 = terms.Matern32Term(log_sigma=-4.0, log_rho=-22)
term2 = terms.Matern32Term(log_sigma=-6.0, log_rho=-22)
gp1 = celerite.GP(term1)
gp2 = celerite.GP(term2)
@iancze
iancze / stuff_visibilities.py
Created October 11, 2018 17:33
Putting model and residual visibilities back into a CASA measurement set
# presume that we have been modeling some table of visibilities exported by UVPLOT
# : https://github.com/mtazzari/uvplot/blob/master/uvplot/io.py
# we want to put the model and residual visibilties into the CASA MS format so we can CLEAN them to make an image.
# load the model visibilities produced by galario
# assemble them into the right form to go into CASA
# (following UVHDF5: https://github.com/AstroChem/UVHDF5/blob/master/UVHDF5_to_MS.py)
# these would probably be columns of a text file in your case
uu = fid["uu"][:,:] # [kilolam]