Esempio n. 1
0
parser.add_option("-p", "--psf",    type="string",  help="input psf")
parser.add_option("-c", "--calib",  type="string",  help="input calibration vectors")
parser.add_option("-o", "--output", type="string",  help="output image")
parser.add_option('-n', "--noise",  action='store_true', help='Add noise')

opts, args = parser.parse_args()

if opts.input is None or opts.psf is None or \
   opts.output is None or opts.calib is None:
    parser.print_help()
    print >> sys.stderr, "\nERROR: input, psf, and output are all required parameters"
    sys.exit(1)

#- Load spectra and PSF
spectra = fitsio.read(opts.input)
psf = load_psf(opts.psf)

#- Strip wavelength off of spectra array
#- TODO : redo data format
loglam = N.log10(spectra[0])
spectra = spectra[1:]

#- Trim to just 1 CCD of spectra
spectra = spectra[0:psf.nspec]
nfiber = spectra.shape[0]

#- HACK ALERT : derive channel from psf filename...
if opts.psf.count('r1')>0 or opts.psf.count('r2')>0:
    ihdu = 1
else:
    ihdu = 0
Esempio n. 2
0
                  type="string",
                  help="input calibration vectors")
parser.add_option("-o", "--output", type="string", help="output image")
parser.add_option('-n', "--noise", action='store_true', help='Add noise')

opts, args = parser.parse_args()

if opts.input is None or opts.psf is None or \
   opts.output is None or opts.calib is None:
    parser.print_help()
    print >> sys.stderr, "\nERROR: input, psf, and output are all required parameters"
    sys.exit(1)

#- Load spectra and PSF
spectra = fitsio.read(opts.input)
psf = load_psf(opts.psf)

#- Strip wavelength off of spectra array
#- TODO : redo data format
loglam = N.log10(spectra[0])
spectra = spectra[1:]

#- Trim to just 1 CCD of spectra
spectra = spectra[0:psf.nspec]
nfiber = spectra.shape[0]

#- HACK ALERT : derive channel from psf filename...
if opts.psf.count('r1') > 0 or opts.psf.count('r2') > 0:
    ihdu = 1
else:
    ihdu = 0
Esempio n. 3
0
data.resize( (nmangafibers, ) )
for i in range(nmangafibers):
    b = i / opts.fibers_per_bundle
    data[i] = d[b*nboss_fibers_per_bundle]
    data[i]['IGROUP'] = b

pyfits.append(opts.output, data, header=header)

#- HDU 5 : Model images; copy through
data = pyfits.getdata(opts.input, 5)
header = pyfits.getheader(opts.input, 5)
pyfits.append(opts.output, data, header=header)



#-------------------------------------------------------------------------
#- Scratch code for debugging

sys.exit(0)
from bbspec.spec2d.psf import load_psf
psf0 = load_psf('spBasisPSF-PIX-r1-00131554.fits')
psf1 = load_psf('MaNGA-PSF-r1.fits')
x, y = psf0.x(), psf0.y()
xx, yy = psf1.x(), psf0.y()

P.subplot(211)
for i in range(0,65): P.plot(x[i], y[i])

P.subplot(212)
for i in range(0,65): P.plot(xx[i], yy[i])