aburgasser / splat

SpeX Prism Spectral Analysis Toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

splat.classifyByTemplate fails due to lack of Spectrum.dof attribute

brackham opened this issue · comments

splat.classifyByTemplate() raises AttributeError: 'Spectrum' object has no attribute 'dof'

Here's a minimal example reproducing the problem:

image

In splat/splat/core.py it looks like self.dof was commented out on line 511 at some point when instrument-specific information was removed from that class.

# self.dof = numpy.round(len(self.wave)/self.slitpixelwidth)

Simply removing dof=sp.dof from line 6389 of splat/splat/core.py fixed the problem for me because utilities.weightedMeanVar() calculates a dof if none is provided.

Offending line:

mean,var = weightedMeanVar(sspt,stat,method='ftest',dof=sp.dof)

Suggested fix:

mean,var = weightedMeanVar(sspt,stat,method='ftest')

fixed!