Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide edge effects from user #17

Closed
sbailey opened this issue Nov 24, 2015 · 2 comments
Closed

hide edge effects from user #17

sbailey opened this issue Nov 24, 2015 · 2 comments
Assignees
Milestone

Comments

@sbailey
Copy link
Contributor

sbailey commented Nov 24, 2015

Currently specsim has some edge effects such that the output spectra are not valid over the full wavelength range requested, requiring the user to pad their requested range and then trim back. It isn't completely straightforward for the user to know how much to pad or what the valid range is. It would be better if specsim could internally do this padding and trimming such that the user just gets back a fully valid spectrum over the requested wavelength grid.

Note: this isn't just an issue of walking off the edge of a CCD. In that case specsim should return flux=ivar=0 for those wavelengths.

Some example user-side code that might be helpful when doing this internally, and would be considerably simplified on the user side when this is done:

#- resolution matrix is pre-calculated but doesn't cover all wavelengths
#- HACK HACK HACK: pull out piece that is actually used
j = qsim.instrument.cameraBands.index(channel)
R = qsim.cameras[j].sparseKernel
goodwave = np.where(np.sum(R.toarray(), axis=0) > 0)[0]
Rdata = R[goodwave][:,goodwave].todia().data  #- [goodwave, goodwave] doesn't work

# ...

results = qsim.simulate(sourceType=opts.objtype.lower(), sourceSpectrum=inspec, 
            airmass = opts.airmass, expTime = desiparams['exptime'], downsampling=1)

# ...

results.obsflux[goodwave]
results.ivar[goodwave]

# Note: np.where(results.ivar != 0)[0] != goodwave; I don't know what the difference is
@dkirkby
Copy link
Member

dkirkby commented Feb 14, 2016

Is this issue about the wavelength coverage of each camera's resolution matrix (sparseKernel) or of the output spectrum? I am not sure what you mean by:

...output spectra are not valid over the full wavelength range requested...

@dkirkby
Copy link
Member

dkirkby commented Mar 9, 2016

Fixed by #35

@dkirkby dkirkby closed this as completed Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants