Skip to content

Instantly share code, notes, and snippets.

View stephtdouglas's full-sized avatar

Stephanie Douglas stephtdouglas

View GitHub Profile
@stephtdouglas
stephtdouglas / append_rubric.sh
Created September 17, 2022 16:44
Script to append a grading rubric onto the beginning of every PDF in a directory
input_folder="./CA1_submitted"
output_folder="./CA1_rubrics"
rubric="CA1_rubric.pdf"
ls $input_folder/*.pdf > inlist
while read -r line
do
# echo "$line"
fname=${line##*/}
@stephtdouglas
stephtdouglas / get_binary_positions.py
Created June 15, 2022 22:04
Script to crossmatch literature binary IDs with Simbad and Gaia
"""
Script to crossmatch literature binary IDs with Simbad and Gaia
"""
import os, sys
import matplotlib.pyplot as plt
import numpy as np
import astropy.io.ascii as at
from astropy.coordinates import SkyCoord
import matplotlib.pyplot as plt
from datetime import date
today = date.today().isoformat()
plt.savefig("filename_{0}.png".format(today))
@stephtdouglas
stephtdouglas / read_mdm.py
Last active January 25, 2018 22:39
Read MDM Spectrum
def read_mdm(filename,to_plot=False,return_header=False):
with fits.open(filename) as spec:
# print(spec.info())
# print(spec[0].data)
flux = spec[0].data[0][0]
w0 = np.float(spec[0].header["CRVAL1"])
wi = np.int(spec[0].header["CRPIX1"])
wstep = np.float(spec[0].header["CD1_1"])
@stephtdouglas
stephtdouglas / connelly_palette.py
Last active January 23, 2023 05:40
Color palettes for color blindness from
# http://bconnelly.net/2013/10/creating-colorblind-friendly-figures/
from __future__ import print_function, division
import matplotlib.pyplot as plt
from matplotlib import colors
from cycler import cycler
import numpy as np
palette_names = np.array(["Black", "Orange", "SkyBlue", "#009e73",
@stephtdouglas
stephtdouglas / kraushillenbrand5.dat
Last active January 19, 2017 20:07
Write spectral types across the top of a color-magnitude diagram
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.ascii as at
from scipy.interpolate import interp1d
# Read in Kraus & Hillenbrand for later use
kh = at.read('kraushillenbrand5.dat')
ksub = np.array([-23,-19,-15,-12,-11,-9,-7,-6,-5,-4,-3,-2,-1])
kh_rpmK0 = (kh['Mr'] - 0.035*(kh['Mr']-kh['Mi']) - 0.007 - kh['MK'])
kh_rpmK = kh_rpmK0[ksub]
# Created by Brett Morris @bmorris3
# Saving for future use
def strided_array(a, window_width):
as_strided = np.lib.stride_tricks.as_strided
#window_width = 4
new_shape = (len(a) - window_width + 1, window_width)
b = as_strided(a, new_shape, (a.strides[0], a.strides[0]))
return b