print "Error: check usage with extract.py -h "; sys.exit(1); if options.verbose: print 'Input spectrum: ', options.input print 'Output wavelength range: ', options.wlrange print 'Spectrum type: ', options.spectype print 'Polar option: ', options.polar print 'Telluric correction: ', options.telluric print 'Heliocentric correction: ', options.helio wl0, wlf = options.wlrange.split() spc = Spectrum(options.input, options.spectype, options.polar, options.telluric, options.helio) #spc.info() wl,flux,fluxerr = spc.extractChunk(float(wl0), float(wlf)) chunk = SpectrumChunk(wl,flux,fluxerr) chunk.snrfilter(15.0) chunk.removeBackground(2.0) #chunk.binning(0.5, median=True) #chunk.fft_filter() init_guess = [656.270,2500, 0.5] chunk.fitgaussian(init_guess) chunk.printdataWithModel()
parser.add_option("-v", action="store_true", dest="verbose", help="verbose", default=False) parser.add_option("-t", action="store_true", dest="telluric", help="telluric correction", default=False) parser.add_option("-r", action="store_true", dest="helio", help="heliocentric correction", default=False) try: options,args = parser.parse_args(sys.argv[1:]) except: print "Error: check usage with App_extract.py -h "; sys.exit(1); if options.verbose: print 'Input spectrum: ', options.input print 'Output wavelength range: ', options.wlrange print 'Spectrum type: ', options.spectype print 'Print header: ', options.header print 'Polar option: ', options.polar print 'Telluric correction: ', options.telluric print 'Heliocentric correction: ', options.helio spc = Spectrum(options.input, options.spectype, options.polar, options.telluric, options.helio) if options.header : spc.info() print "# wavelength(nm) flux flux_err" wl0,wlf = espectrolib.wlrange(options.wlrange, spc) wl,flux,fluxerr = spc.extractChunk(wl0,wlf) chunk = SpectrumChunk(wl,flux,fluxerr) chunk.printdata()