Ticket #128 (new defect)

Opened 5 months ago

Last modified 1 month ago

__call__ should accept a scalar wavelength value

Reported by: laidler Assigned to: somebody
Priority: normal Milestone: Pysynphot: user-friendly interface
Component: pysynphot Version: Pysynphot v1.0
Severity: normal Keywords: commissioning
Cc: svn_pysyn@stsci.edu

Description

It should be possible to query the spectrum at a single wavelength, rather than having to provide an array.

Note that simply wrapping the single value in an array will be insufficient:

>>> sp=S.BlackBody(30000)
>>> sp(1000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/user/laidler/pyinstall/pysynphot/spectrum.py", line 781, in __call__
    sp._fluxtable = planck.bbfunc(wavelength, self.temperature)* RENORM
  File "/user/laidler/pyinstall/pysynphot/planck.py", line 32, in bbfunc
    factor = N.zeros(wave.shape, dtype=N.float64)
AttributeError: 'int' object has no attribute 'shape'

>>> sp(N.array([1000]))
Warning: divide by zero encountered in double_scalars
Warning: invalid value encountered in divide
array([ NaN])

>>> sp(N.array([1000,1001]))
array([ 0.79833079,  0.79899633])

Change History

08/01/08 11:04:22 changed by laidler

  • version set to Pysynphot v1.0.

08/01/08 13:08:52 changed by laidler

  • keywords set to commissioning.

10/07/08 17:31:23 changed by laidler

A similar fix needs to be made for the SpectralElement?.call methods; it was implemented in r668.