"Bug" is in quotes because it was reported so by the user, who was using a catalog grid that STScI does not support. She provided her fix but it changes the behavior of pysynphot. It might suit her but does not reflect what STScI wants.
def _breakList(self, inList, index, parameter):
par = float(parameter)
array = [parameters[index] for parameters in inList]
array = N.array(array, dtype=N.float64)
upperArray = array[array >= par]
lowerArray = array[array <= par]
if upperArray.size == 0:
maxAllowed = array.max()
s = "Parameter '%s' exceeds data. Max allowed=%f, entered=%f."
s = s % (self.parameter_names[index], maxAllowed, parameter)
raise exceptions.ParameterOutOfBounds(s)
elif lowerArray.size == 0:
minAllowed = array.min()
s = "Parameter '%s' exceeds data. Min allowed=%f, entered=%f."
s = s % (self.parameter_names[index], minAllowed, parameter)
raise exceptions.ParameterOutOfBounds(s)
upper = upperArray.min()
lower = lowerArray.max()
upperList = []
lowerList = []
for i,parameters in enumerate(inList):
if array[i] >= par and array[i] <= upper:
upperList.append(parameters)
if array[i] >= lower and array[i] <= par:
lowerList.append(parameters)
return upperList, lowerList
From User
Awhile ago, I found a bug in catalog.py within pysynphot. I have lost my test case; but I have the fix. I only just noticed that I never sent the fix along (when I upgraded my OS, reinstalled pysynphot, and it broke again).
Within catalog.py, I modifed the _breakList function.
I called
catalog.Icat('nextgen', 4159.10610494, 0, 3.8294)
But I believe the nextgen catalog was something I created from a library of atmospheres. Let me know if you want it. I have attached the error below the new (fixed) code:
def _breakList(self, inList, index, parameter):
par = float(parameter)
array = [parameters[index] for parameters in inList]
array = N.array(array, dtype=N.float64)
upperArray = array[array >= par]
lowerArray = array[array <= par]
upperList = []
lowerList = []
warnings = ''
if upperArray.size > 0:
upper = upperArray.min()
for i,parameters in enumerate(inList):
if array[i] >= par and array[i] <= upper:
upperList.append(parameters)
else:
maxAllowed = array.max()
warnings += "Parameter '%s' exceeds data. Max allowed=%f, entered=%f.\n" % (self.parameter_names[index], maxAllowed, parameter)
if lowerArray.size > 0:
lower = lowerArray.max()
for i,parameters in enumerate(inList):
if array[i] >= lower and array[i] <= par:
lowerList.append(parameters)
else:
minAllowed = array.min()
warnings += "Parameter '%s' exceeds data. Min allowed=%f, entered=%f." % (self.parameter_names[index], minAllowed, parameter)
if len(upperList) == 0 and len(lowerList) == 0:
raise exceptions.ParameterOutOfBounds(warnings)
# If only one side is empty, just replicate
if len(upperList) == 0:
upperList = lowerList
if len(lowerList) == 0:
lowerList = upperList
#if upperArray.size == 0:
# maxAllowed = array.max()
# s = "Parameter '%s' exceeds data. Max allowed=%f, entered=%f."
# s = s % (self.parameter_names[index], maxAllowed, parameter)
# raise exceptions.ParameterOutOfBounds(s)
#elif lowerArray.size == 0:
# minAllowed = array.min()
# s = "Parameter '%s' exceeds data. Min allowed=%f, entered=%f."
# s = s % (self.parameter_names[index], minAllowed, parameter)
# raise exceptions.ParameterOutOfBounds(s)
#upper = upperArray.min()
#lower = lowerArray.max()
#upperList = []
#lowerList = []
#for i,parameters in enumerate(inList):
# if array[i] >= par and array[i] <= upper:
# upperList.append(parameters)
# if array[i] >= lower and array[i] <= par:
# lowerList.append(parameters)
return upperList, lowerList
See FootPrints Ticket 4589.
"Bug" is in quotes because it was reported so by the user, who was using a catalog grid that STScI does not support. She provided her fix but it changes the behavior of
pysynphot
. It might suit her but does not reflect what STScI wants.The method in question is
_breakList()
at http://trac.assembla.com/astrolib/browser/trunk/pysynphot/pysynphot/catalog.pyOriginal Code
From User
Awhile ago, I found a bug in
catalog.py
withinpysynphot
. I have lost my test case; but I have the fix. I only just noticed that I never sent the fix along (when I upgraded my OS, reinstalledpysynphot
, and it broke again).Within
catalog.py
, I modifed the_breakList
function.I called
But I believe the
nextgen
catalog was something I created from a library of atmospheres. Let me know if you want it. I have attached the error below the new (fixed) code:Traceback info: