24 from .densityPlot
import mergeDefaults
25 from ..
import modelfitLib
27 __all__ = (
"SamplingDataAdapter",
"OptimizerTrackLayer",
"OptimizerDataAdapter",)
34 self.
pdf = record.getPdf()
39 z = numpy.zeros(x.shape, dtype=float)
40 if i >= self.
pdf.getDimension():
42 projection = self.
pdf.project(i)
43 projection.evaluate(x.reshape(x.shape + (1,)), z)
49 z = numpy.zeros(x.size, dtype=float)
50 if i >= self.
pdf.getDimension()
or j >= self.
pdf.getDimension():
52 projection = self.
pdf.project(j, i)
53 xy = numpy.zeros((x.size, 2), dtype=float)
54 xy[:, 0] = x.flatten()
55 xy[:, 1] = y.flatten()
56 projection.evaluate(xy, z)
57 return z.reshape(x.shape)
63 ModelFitDataAdapter.__init__(self, record)
64 self.
samples = record.getSamples().copy(deep=
True)
71 fractions = numpy.array([lower, upper], dtype=float)
72 ranges = self.
record.getInterpreter().computeParameterQuantiles(self.
record, fractions)
81 marker=
'.', linestyle=
'-', color=
'c',
85 marker=
'.', linestyle=
'-', color=
'k', alpha=0.5,
90 def __init__(self, tag, accepted=None, rejected=None):
92 self.accepted =
mergeDefaults(accepted, self.defaults[
'accepted'])
93 self.rejected =
mergeDefaults(rejected, self.defaults[
'rejected'])
95 def plotX(self, axes, data, dim):
98 def plotY(self, axes, data, dim):
101 def plotXY(self, axes, data, xDim, yDim):
102 i = data.dimensions.index(yDim)
103 j = data.dimensions.index(xDim)
105 artists.extend(axes.plot(data.rejected[:, j], data.rejected[:, i], **self.rejected))
106 artists.extend(axes.plot(data.accepted[:, j], data.accepted[:, i], **self.accepted))
113 ModelFitDataAdapter.__init__(self, record)
114 self.
samples = record.getSamples().copy(deep=
True)
119 mask = (self.
state & modelfitLib.Optimizer.STATUS_STEP_REJECTED).astype(bool)
127 nans = numpy.array([numpy.nan] * self.
parameters.shape[1], dtype=float)
128 for parameters, isRejected
in zip(self.
parameters, mask):
130 rejected.extend([parameters, current, nans])
137 projected = self.
pdf[0].project(i)
138 mu = projected.getMu()
139 sigma = projected.getSigma()**0.5
144 record.getInterpreter().packParameters(
145 self.
record[
'initial.nonlinear'], self.
record[
'initial.amplitudes'],
148 record.getInterpreter().packParameters(
149 self.
record[
'fit.nonlinear'], self.
record[
'fit.amplitudes'],
def __init__(self, record)
def __init__(self, record)
def __init__(self, minimum, dataRange, Q)
def mergeDefaults(kwds, defaults)
def eval2d(self, xDim, yDim, x, y)
def __init__(self, record)
daf::base::PropertyList * list
def setRangesFromQuantiles(self, lower, upper)