desihub / specter

A toolkit for simulating multi-object spectrographs
Other
8 stars 7 forks source link

another exspec failure #9

Closed sbailey closed 9 years ago

sbailey commented 9 years ago

From Julien Guy:

import desimodel.io
import pyfits
import numpy as np

psf = desimodel.io.load_psf("B")
throughput = desimodel.io.load_throughput("B")
wave = np.arange(3600,6000)
flux = np.ones((2,wave.size))
phot = throughput.photons(wave,flux,units='erg/s/cm^2/A/arcsec^2',objtype='SKY',exptime=1000.)
img  = psf.project(wave, phot)
var  = img+3**2.
# need to randomize values

h=pyfits.HDUList([pyfits.PrimaryHDU(img),pyfits.ImageHDU(1./var,name="IVAR")])
h.writeto("image.fits",clobber=True)

Followed by

exspec -i image.fits -p $DESIMODEL/data/specpsf/psf-b.fits -o frame.fits --bundlesize 2 --wavelength 3600,6000,1
#--- Extraction Parameters ---
input:      image.fits
psf:        /home/guy/software/desimodel/trunk/data/specpsf/psf-b.fits
output:     frame.fits
wavelength: 3600.0 - 6000.0 AA steps 1.0
specrange:  0 - 2
bundlesize: 2
regularize: 0.0
#-----------------------------
Spectra (0, 2) wavelengths (3588.00, 3662.00) -> (3600.00, 3650.00)
Traceback (most recent call last):
  File "/home/guy/software/specter/bin/exspec", line 107, in <module>
    xyrange=xyrange, regularize=opts.regularize)
  File "/home/guy/software/specter/lib/specter/extract/ex2d.py", line 76, in ex2d
     I.data[0,ibad] = minweight - fluxweight[ibad]
IndexError: too many indices for array
sbailey commented 9 years ago

Duplicate of #10 which has a better title; closing this one.