Skip to content

Instantly share code, notes, and snippets.

View astro313's full-sized avatar

T. K. Daisy Leung astro313

  • New York, NY
View GitHub Profile
@astro313
astro313 / Prelim.py
Last active August 29, 2015 14:19
DataMining Project
from matplotlib import pyplot as plt
import numpy as np
import matplotlib
from astropy.io import fits
from astropy.convolution import Gaussian2DKernel
from scipy import ndimage, stats, interpolate, signal
import random
plt.rcParams['font.family'] = 'serif'
plt.rcParams['font.size'] = 18
@astro313
astro313 / Kepler.pro
Created April 28, 2015 02:08
Old Kepler May 29 2012
pro readdata, max
readcol, 'data.txt', name, KIC, Kp, t_0, t_0_unc, P, P_unc, Rp, a, T_eq, Dur, Depth, a_to_Rstar, a_to_Rstar_unc, r_to_Rstar, r_to_Rstar_unc, b, b_unc, SNR, chi, T_eff, log_g, Rad2, f_T_eff, /silent ;read in the given file with all the information
BJD=2456069 ; May 21th 2012, initial start time for the plot
t=findgen(1000000)/10000+BJD ;ends August 29 2012
dist=500 ;pc distance from earth to the objects
f=4.84e-6 ;convert AU to pc
ff=2.254e-8 ;conert solar R to pc
@astro313
astro313 / CCF.py
Created May 4, 2015 21:58
Matched-filtering
import numpy as np
# from statsmodels.tsa.stattools import ccf
import scipy
from scipy import optimize
def template_fun(x, x_0, W_FWHM, A):
return A * np.exp(-0.5 * (x - x_0)**2 * (2.35/W_FWHM)**2)
@astro313
astro313 / DaisyInteLumTest.py
Last active May 6, 2016 17:39
testing IR luminosity based on SED models in .txt
'''
Just integrating a model SED in observed frame from mbb & RP's output
Last Modified: 05 May 2016
'''
from astropy.cosmology import WMAP9
import numpy as np
@astro313
astro313 / bash-cheatsheet.sh
Created June 14, 2016 08:26 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@astro313
astro313 / memReport.py
Created August 29, 2016 15:50
Check mem status
#!/usr/bin/python
'''
from http://apple.stackexchange.com/questions/4286/is-there-a-mac-os-x-terminal-version-of-the-free-command-in-linux-systems
'''
import subprocess
import re
# Get process info
@astro313
astro313 / galLunchRand.py
Created September 8, 2016 20:57
Pick people for gal lunch randomly
import random
peeps = [
'Dominik',
'Martha',
'Gordon',
'Thomas',
'Henrik',
'Tyler',
'Luke',
@astro313
astro313 / emcee_indSample.py
Created September 20, 2016 02:23
use emcee to generate ~N ind. samples
import emcee
import numpy as np
# TODO:
# write something using sampler.sample() instead of predefined niter to ensure we have enough uncorrelated sample after run..
nindependent = 0
nind = 500
niter = 1000
attempts = 10
counter = 0
@astro313
astro313 / FFT_img.py
Created December 29, 2016 00:16
testing fft residual
#! /usr/bin/env python
'''
Reads in image data from a FITS file. It transforms the image using FFT.
Plot the original image, the real part and the imaginary part of the transform, and the inverse transform -- real part, which should be equal to the original image, and a imaginary part.
The last panel = residual, and shows the quality of the FFT = original image - real part of the inverse FFT image.
@astro313
astro313 / vdispRE.py
Created February 3, 2017 22:32
convert between vdisp, R_E, M_E
'''Convert between R_E to vdisp and M_E
one z_lens, one z_source, one R_E at a time
'''
import numpy
#HELMS59