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

Class Lawn

source code

Three-dimensional data representation

Lawn represents 3D data arrays in Gwyddion. It is typically useful for different volume data obtained from SPMs, like in force volume measurements.

Instance Methods [hide private]
 
__init__(xres, yres, xreal, yreal, ncurves, nsegments)
Creates a new data lawn.
source code
 
check_compatibility(lawn2, check)
Checks whether two data lawns are compatible.
source code
 
new_alike()
Creates a new data lawn similar to an existing one.
source code
 
new_part(xpos, ypos, xres, yres, keep_offsets)
Creates a new data lawn as a part of existing one.
source code
 
data_changed()
Emits signal "data_changed" on a data lawn.
source code
 
copy(dest, nondata_too)
Copies the contents of an already allocated lawn to a lawn of the same size.
source code
 
get_xres()
Gets the x resolution of a data lawn.
source code
 
get_yres()
Gets the y resolution of a data lawn.
source code
 
get_xreal()
Gets the physical size of a data lawn in the x direction.
source code
 
get_yreal()
Gets the physical size of a data lawn in the y direction.
source code
 
get_xoffset()
Gets the offset of data lawn origin in x direction.
source code
 
get_yoffset()
Gets the offset of data lawn origin in y direction.
source code
 
get_n_curves()
Gets the number of curves at each sample.
source code
 
set_xreal(xreal)
Sets the real x dimension of a lawn.
source code
 
set_yreal(yreal)
Sets the real y dimension of a lawn.
source code
 
set_xoffset(xoffset)
Sets the offset of a data lawn origin in the x direction.
source code
 
set_yoffset(yoffset)
Sets the offset of a data lawn origin in the y direction.
source code
 
get_dx()
Gets the horizontal (X) pixel size of a lawn in real units.
source code
 
get_dy()
Gets the vertical (Y) pixel size of a lawn in real units.
source code
 
get_si_unit_xy()
Returns x- and y-direction SI unit of a data lawn.
source code
 
get_si_unit_curve(n)
Returns value SI unit of the n-th curve of a data lawn.
source code
 
set_si_unit_xy(si_unit)
Sets the SI unit corresponding to the lateral (X, Y) dimensions of a data lawn.
source code
 
set_si_unit_curve(n, si_unit)
Sets the SI unit corresponding of the n-th curve of a data lawn.
source code
 
copy_units(target)
Sets lateral and curve units of a data lawn to match another data lawn.
source code
 
set_curve_label(n, label)
Sets the label of a curve in data lawn.
source code
 
get_curve_label(n)
Gets the label of a curve in data lawn.
source code
 
get_value_format_xy(style)
Finds value format good for displaying coordinates of a data lawn.
source code
 
get_value_format_curve(n, style) source code
 
get_curve_length(col, row)
Gets the length of the curves at given position in a data lawn.
source code
 
get_n_segments()
Gets the number of segments marked in curves in a data lawn.
source code
 
get_segment_label(segment)
Gets the label of a curve segment in data lawn.
source code
 
set_segment_label(segment, label)
Sets the label of a curve segment in data lawn.
source code
 
clear()
Removes curve data at all samples (curve number, units, and labels preserved).
source code
 
new_rotated_90(clockwise)
Creates a new data lawn by rotating a data lawn by 90 degrees.
source code
 
invert(xflipped, yflipped)
Flips a data lawn in place.
source code
Method Details [hide private]

__init__(xres, yres, xreal, yreal, ncurves, nsegments)
(Constructor)

source code 

Creates a new data lawn.

Parameters:
  • xres - X resolution, i.e., the number of samples in x direction (int)
  • yres - Y resolution, i.e., the number of samples in y direction (int)
  • xreal - Real physical dimension in x direction. (float)
  • yreal - Real physical dimension in y direction. (float)
  • ncurves - The number of curves at each sample. (int)
  • nsegments - The number of curve segments. (int)
Returns:
A newly created data lawn. (Lawn)

Since: 2.60

check_compatibility(lawn2, check)

source code 

Checks whether two data lawns are compatible.

Dimensions are checked only in the plane. To check if the curve lengths match, use the DATA_COMPATIBILITY_CURVELEN flag. Use DATA_COMPATIBILITY_NCURVES to check if the two lawns have the same number of curves.

Parameters:
  • lawn2 - Another data lawn. (Lawn)
  • check - The compatibility tests to perform. Expected values: DATA_COMPATIBILITY_RES, DATA_COMPATIBILITY_REAL, DATA_COMPATIBILITY_MEASURE, DATA_COMPATIBILITY_LATERAL, DATA_COMPATIBILITY_VALUE, DATA_COMPATIBILITY_AXISCAL, DATA_COMPATIBILITY_NCURVES, DATA_COMPATIBILITY_CURVELEN, DATA_COMPATIBILITY_ALL. (DataCompatibilityFlags)
Returns:
Zero if all tested properties are compatible. Flags corresponding to failed tests if lawns are not compatible. (DataCompatibilityFlags)

Since: 2.60

new_alike()

source code 

Creates a new data lawn similar to an existing one.

Use Lawn.duplicate() if you want to copy a data lawn including data.

Returns:
A newly created data lawn. (Lawn)

Since: 2.60

new_part(xpos, ypos, xres, yres, keep_offsets)

source code 

Creates a new data lawn as a part of existing one.

Use Lawn.duplicate() if you want to copy a whole data lawn.

Parameters:
  • xpos - x position where to start from (int)
  • ypos - y position where to start from (int)
  • xres - x resolution (width) to be extracted (int)
  • yres - y resolution (height) to be extracted (int)
  • keep_offsets - keep offsets of data during extraction (bool)
Returns:
A newly created data lawn. (Lawn)

Since: 2.60

data_changed()

source code 

Emits signal "data_changed" on a data lawn.

Since: 2.60

copy(dest, nondata_too)

source code 

Copies the contents of an already allocated lawn to a lawn of the same size.

Parameters:
  • dest - Destination lawn. (Lawn)
  • nondata_too - Whether non-data (units, labels, segment information) should be copied too. (bool)

get_xres()

source code 

Gets the x resolution of a data lawn.

Returns:
Resolution (number of data points). (int)

Since: 2.60

get_yres()

source code 

Gets the y resolution of a data lawn.

Returns:
Resolution (number of data points). (int)

Since: 2.60

get_xreal()

source code 

Gets the physical size of a data lawn in the x direction.

Returns:
Real size of a data lawn the x direction. (float)

Since: 2.60

get_yreal()

source code 

Gets the physical size of a data lawn in the y direction.

Returns:
Real size of a data lawn the y direction. (float)

Since: 2.60

get_xoffset()

source code 

Gets the offset of data lawn origin in x direction.

Returns:
Offset value. (float)

Since: 2.60

get_yoffset()

source code 

Gets the offset of data lawn origin in y direction.

Returns:
Offset value. (float)

Since: 2.60

get_n_curves()

source code 

Gets the number of curves at each sample.

Returns:
Number of curves. (int)

Since: 2.60

set_xreal(xreal)

source code 

Sets the real x dimension of a lawn.

Parameters:
  • xreal - New real x dimensions value (float)

Since: 2.60

set_yreal(yreal)

source code 

Sets the real y dimension of a lawn.

Parameters:
  • yreal - New real y dimensions value (float)

Since: 2.60

set_xoffset(xoffset)

source code 

Sets the offset of a data lawn origin in the x direction.

Note offsets don't affect any calculation.

Parameters:
  • xoffset - New offset value. (float)

Since: 2.60

set_yoffset(yoffset)

source code 

Sets the offset of a data lawn origin in the y direction.

Note offsets don't affect any calculation.

Parameters:
  • yoffset - New offset value. (float)

Since: 2.60

get_dx()

source code 

Gets the horizontal (X) pixel size of a lawn in real units.

The result is the same as Lawn.get_xreal(lawn)/Lawn.get_xres(lawn).

Returns:
Horizontal pixel size. (float)

Since: 2.60

get_dy()

source code 

Gets the vertical (Y) pixel size of a lawn in real units.

The result is the same as Lawn.get_yreal(lawn)/Lawn.get_yres(lawn).

Returns:
Vertical pixel size. (float)

Since: 2.60

get_si_unit_xy()

source code 

Returns x- and y-direction SI unit of a data lawn.

Returns:
SI unit corresponding to the lateral (X) dimension of the data lawn. Its reference count is not incremented. (SIUnit)

Since: 2.60

get_si_unit_curve(n)

source code 

Returns value SI unit of the n-th curve of a data lawn.

Parameters:
  • n - Index of a curve in lawn. (int)
Returns:
SI unit corresponding to the "value" of the data lawn. Its reference count is not incremented. (SIUnit)

Since: 2.60

set_si_unit_xy(si_unit)

source code 

Sets the SI unit corresponding to the lateral (X, Y) dimensions of a data lawn.

It does not assume a reference on si_unit, instead it adds its own reference.

Parameters:
  • si_unit - SI unit to be set. (SIUnit)

Since: 2.60

set_si_unit_curve(n, si_unit)

source code 

Sets the SI unit corresponding of the n-th curve of a data lawn.

It does not assume a reference on si_unit, instead it adds its own reference.

Parameters:
  • n - Index of a curve in lawn. (int)
  • si_unit - SI unit to be set. (SIUnit)

Since: 2.60

copy_units(target)

source code 

Sets lateral and curve units of a data lawn to match another data lawn.

Parameters:
  • target - Target data lawn. (Lawn)

Since: 2.60

set_curve_label(n, label)

source code 

Sets the label of a curve in data lawn.

Parameters:
  • n - Index of a curve in lawn. (int)
  • label - New curve label. (string)

Since: 2.60

get_curve_label(n)

source code 

Gets the label of a curve in data lawn.

Parameters:
  • n - Index of a curve in lawn. (int)
Returns:
Curve label, as a string owned by lawn. It may be None. (string)

Since: 2.60

get_value_format_xy(style)

source code 

Finds value format good for displaying coordinates of a data lawn.

Parameters:
  • style - Unit format style. Expected values: SI_UNIT_FORMAT_NONE, SI_UNIT_FORMAT_PLAIN, SI_UNIT_FORMAT_MARKUP, SI_UNIT_FORMAT_VFMARKUP, SI_UNIT_FORMAT_TEX, SI_UNIT_FORMAT_VFTEX, SI_UNIT_FORMAT_UNICODE, SI_UNIT_FORMAT_VFUNICODE. (SIUnitFormatStyle)
Returns:
Tuple consisting of 2 values (value, format). ((SIValueFormat), (SkipArg))

Since: 2.60

get_curve_length(col, row)

source code 

Gets the length of the curves at given position in a data lawn.

Parameters:
  • col - Position in the lawn (column index). (int)
  • row - Position in the lawn (row index). (int)
Returns:
The curves length at given index. (int)

Since: 2.60

get_n_segments()

source code 

Gets the number of segments marked in curves in a data lawn.

All curves have the same number of segments, even empty curves. Empty curves simply have the corresponding number of trivial zero-length segments.

Returns:
The number of segments. Zero is returned if no segments are marked. (int)

Since: 2.60

get_segment_label(segment)

source code 

Gets the label of a curve segment in data lawn.

Parameters:
  • segment - Index of a curve segment in lawn. (int)
Returns:
Segment label, as a string owned by lawn. It may be None. (string)

Since: 2.60

set_segment_label(segment, label)

source code 

Sets the label of a curve segment in data lawn.

Since all curves in lawn are segmented into the same segments the segments share labels. The first segment label corresponds to the first segment in all the curves.

Parameters:
  • segment - Index of a curve segment in lawn. (int)
  • label - New segment label. (string)

Since: 2.60

clear()

source code 

Removes curve data at all samples (curve number, units, and labels preserved).

Since: 2.60

new_rotated_90(clockwise)

source code 

Creates a new data lawn by rotating a data lawn by 90 degrees.

Parameters:
  • clockwise - True to rotate clocwise, False to rotate anti-clockwise. (bool)
Returns:
A newly created data lawn. (Lawn)

Since: 2.60

invert(xflipped, yflipped)

source code 

Flips a data lawn in place.

Since real sizes cannot go backward, flipping an axis results in the corresponding offset being reset (the real dimension stays positive).

Note that the axis parameter convention is different from the confusing one of DataField.invert(). Here parameters simply correspond to directions that should be flipped.

Parameters:
  • xflipped - True to reflect X, i.e. rows. (bool)
  • yflipped - True to reflect Y, i.e. columns. (bool)

Since: 2.60