This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here we import the numpy module to use arrays, and matplotlib for plotting. | |
# Pyplot is a sub-module of matplotlib designed to be a good interface for | |
# interactive plotting, matplotlib in general contains many sub-modules defining | |
# all sorts of behavior, from colors, fonts, to how tickmarks are rendered. We | |
# use the "as" keyword to give the modules an alias, so we don't import literally | |
# thousands of function names into the scope of the program (in IPython just type | |
# "np.<tab>" to see how many symbols are defined. | |
import numpy as np | |
import pandas as pd | |
from matplotlib import pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import difflib | |
import subprocess | |
EMOJI_UNICODE = { | |
'+1': '\U0001F44D', | |
'-1': '\U0001F44E', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import glob | |
from os import path | |
import numpy as np | |
import pandas as pd | |
from matplotlib import pyplot as plt | |
from astropy import units as u | |
from astropy import constants as c | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from astropy import table | |
# use the astropy table reader method to read the file and convert | |
# to a `pandas.DataFrame` | |
df = table.Table.read('table1.txt', format='ascii.cds').to_pandas() | |
df.to_csv('table1.csv', index=False) | |
# when reading the files, remember to set the index column for | |
# matching and other things |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" settings | |
let barposition = "bottom" | |
let scrollstep = 150 | |
let mapleader = "," | |
" options | |
set nosmoothscroll | |
set scalehints | |
set linkanimations | |
set numerichints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
def is_prime(x): | |
assert type(x) == int | |
assert x > 0 | |
if x == 2: | |
return True | |
for n in xrange(2, x / 2 + 1): | |
if not x % n: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_dark(infilen, targetfilen, outfilen='masterdark'): | |
# step 1: median stack the darks | |
darklist = open(infilen,'r') | |
darklist = darklist.readlines() | |
n = len(darklist) | |
fits = pyfits.open(darklist[0]) | |
darkheader = fits[0].header | |
imdark = fits[0].data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if you haven't setup a ~/.gitconfig, make one with these lines: | |
git config --global user.name "Your Name" | |
git config --global user.email "you@email.com" | |
# first enter the directory you want to version-control and initialize the repository | |
git init | |
# git works by storing the changes to files rather than the files themselves, | |
# so you first have to add the files, or start tracking them | |
# add all files in the current directory: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseFitter(object): | |
# Put everything common to all fitting routines in this class | |
def __init__(self, *args): | |
# handle the arguments | |
pass | |
def interpolate(self): | |
pass | |
def calc_covariance(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
An example of a class and a factory function. | |
""" | |
import model_fit # fit_func lives here | |
class Fitter(object): | |
# This would be the starting point for your fit routine, | |
# and the different methods could do different parts. You could |