Skip to content

Instantly share code, notes, and snippets.

@gabraganca
Created April 1, 2013 15:40
Show Gist options
  • Save gabraganca/5285645 to your computer and use it in GitHub Desktop.
Save gabraganca/5285645 to your computer and use it in GitHub Desktop.
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'
else:
spec_out = './'+spec.split('.fits')[0]+'_00'+str(i)+'.fits'
iraf.imcopy(spec_in, spec_out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment