Skip to content

Instantly share code, notes, and snippets.

View gabraganca's full-sized avatar
🚀
going above and beyond

Gustavo Bragança gabraganca

🚀
going above and beyond
View GitHub Profile
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)
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'