plot.points¶
The lines of a curve over the points of the dimensions of a scan.
A curve names the dimensions of its data it draws one line per point of
(over); after broadcasting by name its data must leave at most one more
dimension, the axis a line is drawn along: the time of a timecourse, the
points of a ragged result, the rows of a dataset or the dimension of the
values a scan sets (a value per simulation over a dimension). The lines are in
the order of the labels of the over dimensions, the last one fastest. Their
colours follow the first over dimension, their line styles the second; a
legend entry names its point by the value and unit of the target its
dimension changes, else by its label. Everything of a point is found by its
label in the dimension, so a curve of selected points (Data(sel=...)) names
and colours the points it draws. The colour of a point is the colour map at its
value, through the norm of the colour bar (logarithmic for positive values
spanning more than a factor of LOG_RATIO); a dimension which does not change
one target is coloured by position, with the labels on a discrete colour bar. A
band reduces a dimension of draws to two quantiles and the median, computed
when the figure is drawn; the draws of a ragged result, whose simulations keep
their own time points (the steps of the integrator), are interpolated onto the
time points of a figure first, a few hundred which follow the density of their
time points (onto_grid, sbmlsim.result.timecourse.plot_times), and its
legend entry is its area, <name> (<low>-<high> %).
Line
dataclass
¶
One line of a curve, see curve_lines.
Attributes:
| Name | Type | Description |
|---|---|---|
point |
tuple[Any, ...]
|
the label of every |
index |
tuple[int, ...]
|
the position of the point along every |
x |
Any
|
the x values along the axis, without the padding. |
y |
Any
|
the y values. |
xerr |
Any
|
the x errors, |
yerr |
Any
|
the y errors, |
BandLine
dataclass
¶
One band, see band_lines.
Attributes:
| Name | Type | Description |
|---|---|---|
point |
tuple[Any, ...]
|
the label of every |
index |
tuple[int, ...]
|
the position of the point along every |
x |
Any
|
the x values along the axis. |
low |
Any
|
the lower quantile. |
median |
Any
|
the median. |
high |
Any
|
the upper quantile. |
Grids
¶
The time points of a figure of the x data of bands, found by their values.
The bands of a figure over the draws mostly share their x, the time of a
task with a band per variable of it: the time points and the steps every
simulation keeps are found once per x, which was most of the time of the
bands (sbmlsim#664). An x is the one of a grid bit for bit, so a band gets
the time points of its own values. A figure keeps its grids, see
onto_grid.
Start without grids.
of
¶
Get the grid of x data, a row per simulation, see onto_grid.
Raises:
| Type | Description |
|---|---|
ValueError
|
if x of a simulation does not increase. |
ColorBarScale
dataclass
¶
The scale of the colour bar of a dimension.
Attributes:
| Name | Type | Description |
|---|---|---|
low |
float
|
the value at the low end of the colour bar, the smallest value of the points, the position 0 of a categorical one. |
high |
float
|
the value at its high end, the largest value of the points, the
position |
log |
bool
|
whether the scale is logarithmic. |
labels |
list[str]
|
the label of every point of a categorical colour bar, empty for a colour bar of values. |
categorical |
bool
|
whether it has a band per point, at the positions of the
points |
PointStyle
dataclass
¶
How the lines of a curve over scan points look, see point_styles.
Attributes:
| Name | Type | Description |
|---|---|---|
colors |
list[str]
|
the colour of every point of the first dimension. |
linestyles |
list[str] | None
|
the line style of every point of the second, |
labels |
list[list[str]]
|
the legend label of every point of every dimension. |
colorbar |
bool
|
whether the first dimension gets a colour bar. |
values |
ndarray
|
the values of the points of the first dimension, their positions without a single target. |
title |
str
|
the label of the colour bar, |
scale |
ColorBarScale | None
|
the scale of the colour bar, |
middle |
str
|
the colour of the middle of the colour range, of the legend entry the lines of a colour bar share. |
curve_lines
¶
Split the data of a curve into one line per point of its over dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sid
|
str
|
the id of the curve, for the errors. |
required |
over
|
Sequence[str]
|
the dimensions with a line per point, in the order of the lines. |
required |
x
|
DataArray
|
the x data. |
required |
y
|
DataArray
|
the y data. |
required |
xerr
|
DataArray | None
|
the x errors, |
None
|
yerr
|
DataArray | None
|
the y errors, |
None
|
Returns:
| Type | Description |
|---|---|
list[Line]
|
The lines, without the padding of a ragged result. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if two arrays have different coordinates of a dimension, an
|
band_label
¶
Get the legend label of a band, its name and its quantiles in percent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
the name of the band, of a point of it with |
required |
quantiles
|
tuple[float, float]
|
the lower and the upper quantile. |
required |
Returns:
| Type | Description |
|---|---|
str
|
|
str
|
without a name. |
nan_quantile
¶
Get a quantile along the last axis, ignoring NaN, vectorized.
The linear interpolation of numpy.nanquantile, whose reduction of an
array with a NaN runs in python once per position of the other axes; the
values are sorted once (NaN last) and the quantile is taken from the
finite values of every position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
ndarray
|
the values, reduced along the last axis. |
required |
q
|
float
|
the quantile in |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The quantile of every position of the other axes, |
ndarray
|
value is |
nan_quantiles
¶
Get quantiles along the last axis, ignoring NaN, the values sorted once.
Every quantile is the one of nan_quantile; the sort, most of its time,
is shared by the quantiles, e.g. the two of a band and its median.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
ndarray
|
the values, reduced along the last axis. |
required |
qs
|
Sequence[float]
|
the quantiles in |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ...]
|
Every quantile, see |
onto_grid
¶
Interpolate the data of a band of a ragged result onto the time points of a figure.
In the ragged layout every simulation keeps its own time points (_point,
padded with NaN), so the quantiles of a band at a position of _point
would mix times. Every simulation is interpolated linearly onto n time
points which follow the density of the time points of all simulations
(plot_times), with NaN outside of its own range; the times of the
changes, which a simulation has twice (the states before and after it),
are among them and give the state after the change, as
ScanResult.interpolate does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sid
|
str
|
the id of the band, for the errors. |
required |
x
|
DataArray
|
the x data, the time over |
required |
y
|
DataArray
|
the y data over |
required |
n
|
int
|
the number of time points. |
PLOT_POINTS
|
grids
|
Grids | None
|
the grids of the x data of the bands of a figure, which the bands of the same x share; one of its own without. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[DataArray, DataArray]
|
The time points as x over |
Raises:
| Type | Description |
|---|---|
ValueError
|
if x of a simulation does not increase. |
band_lines
¶
Reduce the dimension across of the data of a band to quantiles and the median.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sid
|
str
|
the id of the band, for the errors. |
required |
over
|
Sequence[str]
|
the dimensions with a band per point. |
required |
across
|
str
|
the dimension of the draws, which is reduced. |
required |
quantiles
|
tuple[float, float]
|
the lower and the upper quantile, in |
required |
x
|
DataArray
|
the x data. |
required |
y
|
DataArray
|
the y data. |
required |
grids
|
Grids | None
|
the grids of the x data of a ragged result, see |
None
|
Returns:
| Type | Description |
|---|---|
list[BandLine]
|
One band per point of |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the data has not the dimension |
point_colors
¶
Get the colours of the points of a dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
the number of points. |
required |
color
|
str | None
|
the colour of the style of the curve, |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Shades of the colour from light to the colour itself, or colours of the |
list[str]
|
colour scale |
list[str]
|
keeps the colour. |
point_linestyles
¶
Get the line styles of the points of a second over dimension.
Raises:
| Type | Description |
|---|---|
ValueError
|
for more than |
point_values
¶
Get the target, the values and the unit of a dimension which changes one target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dimension
|
Dimension | None
|
the dimension of the scan, |
required |
units
|
Mapping[str, str]
|
the units of the symbols of the model, for values without a unit. |
required |
labels
|
Sequence[Any] | None
|
the labels of the points, in their order, every point of the dimension by default; a point is found by its label. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[str, ndarray, str] | None
|
The target, the values of the points and their unit, |
tuple[str, ndarray, str] | None
|
dimension which changes no or several targets or has not every label. |
point_labels
¶
Get the legend label of every point of a dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
str
|
the id of the dimension. |
required |
labels
|
Sequence[Any]
|
the labels of the points, in their order. |
required |
dimension
|
Dimension | None
|
the dimension of the scan, |
required |
units
|
Mapping[str, str]
|
the units of the symbols of the model, see |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
|
list[str]
|
else |
point_scale
¶
Get the range which maps the values of the points of a dimension onto colours.
Returns:
| Type | Description |
|---|---|
tuple[float, float, bool] | None
|
|
tuple[float, float, bool] | None
|
largest is more than |
tuple[float, float, bool] | None
|
the smallest to the largest value; |
tuple[float, float, bool] | None
|
range (a single value, equal values or a value which is not finite). |
format_value
¶
Format a value of a dimension: six significant digits, a short exponent.
label_text
¶
Get the text of a label of a dimension, a float formatted as a value.
colorbar_arguments
¶
Get the colour bar of points whose colours are of the colour scale COLORMAP.
The points take the first _COLORMAP_END of the colour scale, since its
light yellow end is hard to see on white, so the colour bar shows that part
of the scale over the range of the values of the points: the colour of the
bar at the value of a point is the colour of its line and the bar shows no
value no line has. A dimension which does not change one target gets a
categorical bar of a band per point, labelled by the labels of its points,
up to MAX_BANDS points, a bar of their positions above.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
styles
|
PointStyle
|
the style of the points, see |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
The keyword arguments of |
dict[str, Any] | None
|
span no range. |
point_styles
¶
Get the colours, line styles, labels and colour bar of the lines of a curve.
The points are the ones the lines draw, i.e. the labels left after the
sel of the data, each found by its label in its dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines
|
Sequence[Line | BandLine]
|
the lines of the curve or band. |
required |
over
|
Sequence[str]
|
the ids of the dimensions it is drawn over. |
required |
color
|
str | None
|
the colour of the style of the curve, |
required |
dimensions
|
Sequence[Dimension | None]
|
the dimension of the scan of every one of |
required |
units
|
Mapping[str, str]
|
the units of the symbols of the model, see |
required |
Returns:
| Type | Description |
|---|---|
PointStyle
|
The style shared by the serializers. |
Raises:
| Type | Description |
|---|---|
ValueError
|
for more points of a second dimension than line styles. |