Module gwy :: Class GraphCurveModel
[hide private]
[frames] | no frames]

Class GraphCurveModel

source code

Instance Methods [hide private]
 
__init__()
Creates a new graph curve model.
source code
 
new_alike()
Creates new graph curve model object that has the same settings as gcmodel.
source code
 
set_data_from_dataline(dline, from_index, to_index)
Sets graph curve model data from a data line.
source code
 
enforce_order()
Ensures curve model data points are ordered by abscissa in ascending order.
source code
 
is_ordered()
Checks if a curve model data points are ordered by abscissa in ascending order.
source code
 
get_ndata()
Gets the number of points in a graph curve model.
source code
 
get_x_range()
Gets the abscissa range of a graph curve.
source code
 
get_y_range()
Gets the ordinate range of a graph curve.
source code
 
get_ranges(x_logscale, y_logscale)
Gets the log-scale suitable range minima of a graph curve.
source code
 
get_xdata()
Gets y data points of a graph curve model.
source code
 
get_ydata()
Gets y data points of a graph curve model.
source code
 
set_data(xdata, ydata)
Sets curve model data from separated X and Y arrays.
source code
 
set_data_interleaved(xydata)
Sets curve model data from an interleaved array.
source code
 
duplicate()
Convenience macro doing gwy_serializable_duplicate() with all the necessary typecasting.
source code
Method Details [hide private]

__init__()
(Constructor)

source code 

Creates a new graph curve model.

Returns:
New empty graph curve model as a GObject. (GraphCurveModel)

new_alike()

source code 

Creates new graph curve model object that has the same settings as gcmodel.

Curve data are not duplicated.

Returns:
New graph curve model. (GraphCurveModel)

set_data_from_dataline(dline, from_index, to_index)

source code 

Sets graph curve model data from a data line.

The range of import can be modified using parameters from_index and to_index that are interpreted directly as data indices within the DataLine. In the case that from_index == to_index, the full DataLine is used.

If there were calibration data in the former gcmodel, they are removed.

Parameters:
  • dline - A data line. (DataLine)
  • from_index - Data line index where to start. (int)
  • to_index - Data line index where to stop. (int)

enforce_order()

source code 

Ensures curve model data points are ordered by abscissa in ascending order.

The function reorders the data points currently present in the model. It does not prevent functions such as Graph.curve_model_set_data() from disrupting the order again. See its documentation for further remarks.

The "data-changed" signal is emitted if the data order actually changes.

Since: 2.45

is_ordered()

source code 

Checks if a curve model data points are ordered by abscissa in ascending order.

If the curve model has less than two points it is considered ordered by abscissa. Two points with the same abscissa are considered correctly ordered in both orders.

See Graph.curve_model_enforce_order() for fixing the point order.

Returns:
True if the graph curve model points are sorted by abscissa, False when they are not. (bool)

Since: 2.46

get_ndata()

source code 

Gets the number of points in a graph curve model.

Returns:
number of data points within the curve data (int)

get_x_range()

source code 

Gets the abscissa range of a graph curve.

The values are cached in the curve model therefore repeated calls to this function (with unchanged data) are cheap.

If there are no data points in the curve, x_min and x_max are untouched and the function returns False.

See also Graph.curve_model_get_ranges() for a more high-level function.

Returns:
Tuple consisting of 3 values (value, x_min, x_max). ((bool), (float), (float))

get_y_range()

source code 

Gets the ordinate range of a graph curve.

The values are cached in the curve model therefore repeated calls to this function (with unchanged data) are cheap.

If there are no data points in the curve, x_min and x_max are untouched and the function returns False.

See also Graph.curve_model_get_ranges() for a more high-level function.

Returns:
Tuple consisting of 3 values (value, y_min, y_max). ((bool), (float), (float))

get_ranges(x_logscale, y_logscale)

source code 

Gets the log-scale suitable range minima of a graph curve.

Parameters x_logscale and y_logscale determine which axis or axes are intended to use logarithmical scale. The range of displayble values for an axis generally depends on the other axis too as it acts as a filter. When both x_logscale and y_logscale are False, the returned minima are identical to those returned by Graph.curve_model_get_x_range() and Graph.curve_model_get_y_range().

The return values are cached in the curve model therefore repeated calls to this function (with unchanged data) are cheap.

If there are no data points that would be displayable with the intended logarithmical scale setup, the output arguments are untouched and False is returned.

Parameters:
  • x_logscale - True if logarithmical scale is intended for the abscissa. (bool)
  • y_logscale - True if logarithmical scale is intended for the ordinate. (bool)
Returns:
Tuple consisting of 5 values (value, x_min, x_max, y_min, y_max). ((bool), (float), (float), (float), (float))

Since: 2.8

get_xdata()

source code 

Gets y data points of a graph curve model.

The returned data are owned by the and cannot be modified nor freed. The returned pointer is valid only so long as the curve model exists and its data do not change.

Returns:
X data points, owned by the curve model. (list)

get_ydata()

source code 

Gets y data points of a graph curve model.

The returned data are owned by the and cannot be modified nor freed. The returned pointer is valid only so long as the curve model exists and its data do not change.

Returns:
Y data points, owned by the curve model. (list)

set_data(xdata, ydata)

source code 

Sets curve model data from separated X and Y arrays.

If there were calibration data in the former gcmodel, they are removed.

Parameters:
  • xdata - X data points (array of size n). (list)
  • ydata - Y data points (array of size n). (list)

Warning: The points should be ordered in ascending abscissa order, meaning xdata values ordered from smallest to largest. It is not enforced and you can create graphs of data the do not satisfy this condition. However, various graph functionality may be unavailable or degraded then. You also can use Graph.curve_model_enforce_order() afterwards to ensure the recommended data point order.

set_data_interleaved(xydata)

source code 

Sets curve model data from an interleaved array.

The array should contain interleaved abscissa and ordinate values: x0, y0, x1, y1, x2, y2, etc. You can also typecast an array of XY structs and pass it as xydata.

If there were calibration data in the former gcmodel, they are removed.

Parameters:
  • xydata - X and Y data points (array of size 2*n). (list)

Warning: The points should be ordered in ascending abscissa order, meaning xdata values ordered from smallest to largest. It is not enforced and you can create graphs of data the do not satisfy this condition. However, various graph functionality may be unavailable or degraded then. You also can use Graph.curve_model_enforce_order() afterwards to ensure the recommended data point order.

Since: 2.45

duplicate()

source code 

Convenience macro doing gwy_serializable_duplicate() with all the necessary typecasting.

Returns:
(GraphCurveModel)