def parse_input(inputlist): chifile = inputlist[0] coeffile = inputlist[1] datafile = inputlist[2] kwar = {} i = 3 while i < len(inputlist): if inputlist[i] == '-o': kwar['output'] = inputlist[i+1] i += 1 if inputlist[i] == '-w': kwar['wavemin'] = inputlist[i+1] kwar['wavemax'] = inputlist[i+2] i += 2 if inputlist[i] == '-b': kwar['plotblue'] = True if inputlist[i] == '-n': import nice_plots nice_plots.format_plots(False) i += 1 return chifile, coeffile, datafile, kwar
def parse_input(inputlist): coeffile = inputlist[0] fitfile = inputlist[1] datafile = inputlist[2] errorfile = inputlist[3] modelfile = inputlist[4] kwar = {} i = 5 while i < len(inputlist): if inputlist[i] == '-o': kwar['output'] = inputlist[i+1] i += 1 if inputlist[i] == '-v': kwar['veloffset'] = float(inputlist[i+1]) i += 1 if inputlist[i] == '-l': kwar['location'] = inputlist[i+1] i += 1 if inputlist[i] == '-w': kwar['wavemin'] = inputlist[i+1] kwar['wavemax'] = inputlist[i+2] i += 2 if inputlist[i] == '-x': kwar['xcorV'] = inputlist[i+1] i += 1 if inputlist[i] == '-c': kwar['chivel'] = inputlist[i+1] i += 1 if inputlist[i] == '-s': kwar['smoothkern'] = int(inputlist[i+1]) i += 1 if inputlist[i] == '-b': kwar['plotblue'] = True if inputlist[i] == '-n': import nice_plots nice_plots.format_plots(False) if inputlist[i] == '-H': kwar['maskBalm'] = True i += 1 return [coeffile, fitfile, datafile, errorfile, modelfile], kwar
def parse_input(inputlist): coeffile = inputlist[0] fitfile = inputlist[1] datafile = inputlist[2] errorfile = inputlist[3] modelfile = inputlist[4] kwar = {} i = 5 while i < len(inputlist): if inputlist[i] == '-o': kwar['output'] = inputlist[i+1] i += 1 if inputlist[i] == '-l': kwar['location'] = inputlist[i+1] i += 1 if inputlist[i] == '-w': kwar['wavemin'] = inputlist[i+1] kwar['wavemax'] = inputlist[i+2] i += 2 if inputlist[i] == '-b': kwar['plotblue'] = True if inputlist[i] == '-n': import nice_plots nice_plots.format_plots(False) i += 1 return [coeffile, fitfile, datafile, errorfile, modelfile], kwar
from glob import glob import numpy as np import pyfits import matplotlib.pyplot as plt import scipy.ndimage as spnd import nice_plots from matplotlib.backends.backend_pdf import PdfPages as PDF plt.ioff() nice_plots.format_plots(False) def size_bin(chifile, coeffile, datafile, location, wavemin=3800., wavemax=6800., intwave=None): hdu = pyfits.open(datafile)[0] numfibers, wavesize = hdu.data.shape head = hdu.header cdelt = head['CDELT1'] crval = head['CRVAL1'] crpix = head['CRPIX1'] print 'CDELT1 = ', cdelt print 'CRVAL1 = ', crval print 'CRPIX1 = ', crpix wave = (np.arange(wavesize) - crpix) * cdelt + crval idx = np.where((wave >= wavemin) & (wave <= wavemax)) redwl = wave[idx] redchiarray = pyfits.open(chifile)[0].data