twomassid, id, teff, feh = mcallib.loadSampleOfCalibrators(options.inputsample) Tcal = [] FeHcal = [] ewcal = [] for file in listOfStarSpectra: spc = Spectrum(file) objname = spc.object.replace(" ", "").upper() if options.verbose: print "Processing spectrum: ", file, objname if spc.instrument == 'ESPaDOnS' or spc.instrument == 'NARVAL': spc.resampling(0.01, 4000, 10400) for i in range(len(id)): if objname in id[i].upper() or objname in twomassid[i].upper(): spc.equivalentWidths(override=False, verbose=options.verbose) ewcal_tmp = spc.eqwidths if not np.any(np.isnan(ewcal_tmp)): ewcal.append(ewcal_tmp) Tcal.append(teff[i]) FeHcal.append(feh[i]) print "Selected Calibrator: ", file, objname, twomassid[i], id[ i], teff[i], feh[i] else: print "Eq. Widths contain NaNs. Ignoring potential calibrator: ", file, objname mcallib.calibrate_mcal(ewcal, Tcal, FeHcal, options.outputcalibmatrix)
print 'File with wavelength ranges: ', options.wavemask spc = Spectrum(options.input, options.spectype, options.polar, options.telluric, options.helio, Sort=False) #spc.binningOrderByOrder(rvsampling_kps=float(options.rvsampling), median=False) if options.wavemask: spc.applyMask(options.wavemask) spc.sortByWavelength() if options.output.endswith(".fits"): wlsampling = (float(options.rvsampling) * 1000.0 / constants.c) * (spc.wl[-1] + spc.wl[0]) / 2.0 spc.resampling(wlsampling) spc.saveToFile(options.output, format='fits') elif options.output.endswith(".txt"): spc.binning(float(options.rvsampling), median=False) spc.saveToFile(options.output, format='ascii') else: spc.printdata(printerrors=False)