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_normalizeFcal.py -h "; sys.exit(1);

if options.verbose:
    print 'Input spectrum: ', options.input
    print 'Output spectrum file: ', options.output
    print 'Output spectrum file: ', options.outputcontinuum
    print 'RV sampling for output spectrum in km/s: ', options.rvsampling
    print 'Polar option: ', options.polar
    print 'Telluric correction: ', options.telluric
    print 'Heliocentric correction: ', options.helio

spc = Spectrum(options.input, 'fcal', options.polar, options.telluric, options.helio)

spc.applyMask()

spc.binning(float(options.rvsampling), median=True)

spc.continuum(binsize=200, overlap=100, sigmaclip=3.0, window=3)

spc.normalizeByContinuum()

spc.saveToFile(options.output)

if options.outputcontinuum :
    spc.saveContinuumToFile(options.outputcontinuum)
示例#2
0
except:
    print "Error: check usage with extract.py -h "
    sys.exit(1)

if options.verbose:
    print 'Input spectrum: ', options.input
    print 'Spectrum type: ', options.spectype
    print 'Polar option: ', options.polar
    print 'Telluric correction: ', options.telluric
    print 'Heliocentric correction: ', options.helio

spectrallines = [
    384, 389, 397, 403, 410, 427, 434, 439, 448, 454, 465, 469, 471, 486, 492,
    502, 517, 541, 587, 656, 668, 707, 724, 728, 824, 845, 846, 850, 854, 860,
    866, 875, 886, 901, 923, 955, 1012
]
telluriclines = [762, 765, 942]

lines = np.concatenate((spectrallines, telluriclines), axis=0)

spc = Spectrum(options.input, options.spectype, options.polar,
               options.telluric, options.helio)

width = 2.0
spc.maskdata(lines, width)

continuum_wlsampling = 10.0
spc.binning(continuum_wlsampling, median=True)

spc.printdata()