nstat.ConfidenceInterval
- class nstat.ConfidenceInterval(time, bounds, *args, color=None, value=0.95)[source]
Bases:
objectConfidence interval for a time series or Covariate.
Stores a pair of (lower, upper) bound traces over a shared time axis, with plotting support for both line and shaded-patch styles.
- Parameters:
time (array_like) – Time vector.
bounds (array_like, shape (n, 2)) – Lower and upper bounds at each time point.
*args – Positional metadata:
(name, xlabelval, xunits, yunits, dataLabels, plotProps). If a single short string is passed it is interpreted as the colour (Matlab compatibility).color (str or None) – Line / patch colour. Default
'b'.value (float, default 0.95) – Confidence level (e.g. 0.95 for 95 %).
- setValue(value)[source]
Set the confidence level (e.g. 0.95 for 95 %).
- Parameters:
value (float)
- Return type:
None
- dataToStructure()[source]
Serialise to a plain dictionary (matches Matlab
dataToStructure).- Return type:
- getSigInTimeWindow(wMin, wMax, holdVals=0)[source]
Return a new ConfidenceInterval restricted to [wMin, wMax].
- windowedSignal(windowTimes)[source]
Return a ConfidenceInterval restricted to the given time window.
- resample(sample_rate)[source]
Resample the CI bounds to a new sample rate via linear interpolation.
- Parameters:
sample_rate (float)
- property derivative
Numerical derivative of both bounds.
- merge(other, holdVals=0)[source]
Merge with another ConfidenceInterval along the time axis.
- Parameters:
holdVals (int)
- setMinTime(minTime=None, holdVals=0)[source]
Restrict to times >= minTime.
- Parameters:
holdVals (int)
- setMaxTime(maxTime=None, holdVals=0)[source]
Restrict to times <= maxTime.
- Parameters:
holdVals (int)
- toStructure()[source]
Alias for
dataToStructure().- Return type:
- plot(color=None, alphaVal=0.2, drawPatches=0, ax=None)[source]
Plot the confidence interval.
- Parameters:
- Returns:
Plot handles.
- Return type:
PolyCollection or list of Line2D