psf = pyfits.open(args.psf) image_file = pyfits.open(args.image) spectra, ivar, wave = boxcar(psf, image_file, args.nfibers) if args.resample : log.info("Starting resampling...") spectra, ivar, wave = resample_to_same_wavelength_grid(spectra, ivar, wave) log.info("Data resampled.") hdulist = pyfits.HDUList([pyfits.PrimaryHDU(spectra), pyfits.ImageHDU(ivar,name="IVAR"), pyfits.ImageHDU(wave,name="WAVELENGTH")]) #pyfits.ImageHDU(rdata, name="RESOLUTION")]) hdulist.writeto(args.outframe,clobber=True) if args.plot or args.show : frame = pyfits.open(args.outframe) if not (args.plot) : plot_graph(frame) else : nb = args.plot.split(',') if ((len(nb) is 2) or (nb[0].isdigit == True and nb[1].isdigit == True)) : plot_graph(frame, args.nfibers, nb[0], nb[1]) else : log.error("--plot parsing error. correct format is : --plot=nb_from,nb_to") log.info("Showing.......") show_graph() log.info("Script done")