Skip to content

Error messages are often missing in AnalyticSpectra's sanity checks #1

@alexrudy

Description

@alexrudy

Sanity checks in AnalyticSpectra.InteropolatedSpectrumBase raise error types that don't support messaging. Errors should probably be encased in a custom error type when raised from AnalyticSpectra. Most of these errors are incorrectly categorized in this mode.

Example Traceback:

Traceback (most recent call last):
  File "./Examples/spectra.py", line 38, in <module>
    OBJECT["Resampled"] = OBJECT.frame("Interpolated")(wavelengths=WAVELENGTHS_LOWR[1:],resolution=LOWR,method='resample')
  File "/Users/alexanderrudy/Dropbox/Library/Development/Astronomy/AstroObject/AstroObject/AnalyticSpectra.py", line 866, in __call__
    return InterpolatedSpectrumBase.__call__(self,method=method,**kwargs)
  File "/Users/alexanderrudy/Dropbox/Library/Development/Astronomy/AstroObject/AstroObject/AnalyticSpectra.py", line 290, in __call__
    return method(**kwargs)
  File "/Users/alexanderrudy/Dropbox/Library/Development/Astronomy/AstroObject/AstroObject/AnalyticSpectra.py", line 606, in resample
    self._presanity(self.wavelengths,self.flux,wavelengths,resolution,upsample=upsample)
  File "/Users/alexanderrudy/Dropbox/Library/Development/Astronomy/AstroObject/AstroObject/AnalyticSpectra.py", line 454, in _presanity
    raise e
ValueError

Error should have been raised with a message. Also, a value error is regardless not a good descriptor. This error is caused by an interpolation error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions