[SciPy-user] object_arrtype addition error
Chris Fonnesbeck
fonnesbeck at gmail.com
Tue Nov 29 06:34:49 CST 2005
On 11/28/05, Travis Oliphant <oliphant.travis at ieee.org> wrote:
> Chris Fonnesbeck wrote:
>
> >Under scipy_core, I have a dictionary that contains what I thought
> >were floating point numbers, but are actually 'object_arrtype':
> >
> >
> >
> One question is why these are object array scalars (entries in an object
> array), instead of floating point numbers in the first place. Perhaps
> there is something going on there.
>
Its just my PyMC code calculating the quantiles of the trace (the big
array of sampled values), and throwing those values into a dictionary:
def quantiles(self, qlist=[2.5, 25, 50, 75, 97.5], start=0, end=None):
"""Returns a dictionary of requested quantiles"""
# Make a copy of trace
trace = self.get_trace(start, end)
# For multivariate node
if rank(trace)>1:
# Transpose first, then sort, then transpose back
trace = t(sort(t(trace)))
else:
# Sort univariate node
trace = sort(trace)
try:
# Generate specified quantiles
quants = [trace[int(len(trace)*q/100.0)] for q in qlist]
return dict(zip(qlist, quants))
except IndexError:
print "Too few elements for quantile calculation"
--
Chris Fonnesbeck
Atlanta, GA
More information about the SciPy-user
mailing list