This file contains hidden or 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 pyraf import iraf | |
def sep_spec(spec, aperture): | |
"""Separate the multi spectrum in its orders""" | |
nslits = int(iraf.imhead(spec, Stdout=1)[0].split(',')[1]) | |
for i in xrange(1, nslits+1): | |
spec_in = spec+'[*,'+str(i)+','+aperture+']' | |
if i<10: | |
spec_out = './'+spec.split('.fits')[0]+'_000'+str(i)+'.fits' |
This file contains hidden or 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 subprocess import Popen, PIPE | |
def run_idl(inp, do_log = False): | |
"""Run IDL""" | |
if do_log: | |
with open('idl.log', 'w') as log: | |
idl = Popen(['nice','-n0','idl'],stdin = PIPE, \ | |
stdout=log,stderr=log) | |
idl.communicate(inp) |
This file contains hidden or 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
To get Git to diff between your odt/odp/ods files you will need to do the following things: | |
Install a conversion tool | |
$ sudo yum install odt2txt | |
Create your git config info directory if it's not already there | |
$ mkdir -p ~/.config/git/info | |
Add in attributes (you can paste this straight in or edit the file accordingly) | |
$ cat > ~/.config/git/info/attributes <<DELIM |
This file contains hidden or 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 scipy.stats as st | |
import numpy as np | |
import matplotlib.pytlot as plt | |
def contour_plot(array3d, **kwargs): | |
""" | |
Do the contour plot of a X, Y, Z vector. | |
Parameters | |
---------- |
This file contains hidden or 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 numpy as np | |
def create_list(list1, list2): | |
""" | |
list1 : N-dimensional list | |
list2 : 1-dimensional list | |
""" | |
return np.array([np.append(np.array(i), j) for i in list1 for j in list2]) |
This file contains hidden or 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 append(xs, yss): | |
return [[x] + ys for x in xs for ys in yss] | |
def make_lists(*xss): | |
if len(xss) == 1: | |
return [[x] for x in xss[0]] | |
h, t = xss[0], xss[1:] | |
return append(h, make_lists(*t)) |
This file contains hidden or 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 python | |
""" | |
Script for running and save notebooks from command line. | |
How to use: `ipynb_run_save.py foo.ipynb | |
Some tweaks over ipydoctest.py from minrk | |
by @damianavila | |
""" |
This file contains hidden or 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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
plt.rcParams['figure.figsize'] = 16, 12 # that's default image size for this interactive session | |
plt.rcParams['figure.dpi'] = 100 | |
plt.rcParams['axes.titlesize'] = 22 | |
plt.rcParams['axes.labelsize'] = 18 | |
plt.rcParams['lines.linewidth'] = 2 | |
plt.rcParams['lines.markersize'] = 8 | |
plt.rcParams['xtick.labelsize'] = 14 | |
plt.rcParams['ytick.labelsize'] = 14 |
This file contains hidden or 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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or 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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
OlderNewer