Derived units

Derived units — Derive units for common parameters

Functions

Types and Values

Includes

#include <libgwyddion/gwyddion.h>

Description

Functions

gwy_derive_units()

gboolean
gwy_derive_units (GwyUnit *unit,
                  GwyDerivedQuantity quantity,
                  gint dimension,
                  GwyUnit *spatial,
                  GwyUnit *value);

Derives units for a known quantity from spatial and value units.

Parameter dimension should be 1 for line data, 2 for images, 3 for volume * data, etc. Some quantities depend on the number of spatial dimensions, for example GWY_DERIVED_PSDF_FULLD or GWY_DERIVED_VARIATION.

Although the units of spatial dimensions can in principle differ, prectically all quantities either do not depend on the spatial units, or cannot be calculated if they differ. So this case is currently not handled.

It is possible to pass NULL for either input unit to mean unitless.

Angles are considered unitless because Gwyddion represents angles in radians by default. Use gwy_derived_quantity_angle_power() to check if a quantity is angle and convert to degrees for the user.

Parameters

unit

Unit to set.

[transfer none]

quantity

Known quantity to derive units for.

 

dimension

The number of spatial dimensions.

 

spatial

Spatial (distance) units.

[transfer none][nullable]

value

Value units.

[transfer none][nullable]

Returns

TRUE if the derived unit is valid. FALSE is returned when the derivation cannot be done, for example when the quantity is only meaningful when spatial distances and values are commensurable.


gwy_derived_quantity_spatial_power()

gint
gwy_derived_quantity_spatial_power (GwyDerivedQuantity quantity,
                                    gint dimension);

Reports the power of spatial dimensions in a known quantity.

Note that knowing the power may not be sufficient for correct unit handling. You may also need gwy_derived_quantity_is_angle() and gwy_derived_quantity_same_units().

Parameters

quantity

Known derived quantity.

 

dimension

The number of spatial dimensions.

 

Returns

The power of spatial dimensions in the quantity.


gwy_derived_quantity_value_power()

gint
gwy_derived_quantity_value_power (GwyDerivedQuantity quantity);

Reports the power of values in a known quantity.

Note that knowing the power may not be sufficient for correct unit handling. You may also need gwy_derived_quantity_is_angle() and gwy_derived_quantity_same_units().

Parameters

quantity

Known derived quantity.

 

Returns

The power of values in the quantity.


gwy_derived_quantity_angle_power()

gint
gwy_derived_quantity_angle_power (GwyDerivedQuantity quantity);

gwy_derived_quantity_same_units()

gboolean
gwy_derived_quantity_same_units (GwyDerivedQuantity quantity);

Reports whether a derived quantity requires the same spatial and value units.

Some quantities, for example radii of curvature or developed lengths and surface areas, are only meaningful when the values are commensurable with the spatial coordinates.

Parameters

quantity

A general derived quantity.

 

Returns

TRUE if the quantity needs the same spatial and value units.

Types and Values

enum GwyDerivedQuantity

Type of known derived quantity.

Functions such as gwy_derive_units() can be used to generically derive units of known quantities from spatial and value units.

Separate derived quantities exists for a number cases where the derived units must be the same, for example median. rms and value range. This is to improve clarity and make the code more obviously correct. Try to use the exactly matching specific quantity wherever possible. Some are more generic, such as volume or distance, but should still clearly apply to any specific volume or spatial distance.

Members

GWY_DERIVED_MEAN

Mean value.

 

GWY_DERIVED_MEDIAN

Median value.

 

GWY_DERIVED_MINIMUM

Minimum value.

 

GWY_DERIVED_MAXIMUM

Maximum value.

 

GWY_DERIVED_RANGE

Range of values.

 

GWY_DERIVED_RMS

Root mean square difference.

 

GWY_DERIVED_RA

Mean absolute difference.

 

GWY_DERIVED_SKEW

Value distribution skewness.

 

GWY_DERIVED_KURTOSIS

Value distribution kurtosis.

 

GWY_DERIVED_OFFSET

Value offset.

 

GWY_DERIVED_SLOPE

Derivative of values by spatial coodinates.

 

GWY_DERIVED_GRADIENT

Derivative of values by spatial coodinates.

 

GWY_DERIVED_RMS_SLOPE

Root mean square value derivative.

 

GWY_DERIVED_SLOPE_ANGLE

Angle corresponding to the derivative of values by spatial coordinates (either of the normal or along the surface).

 

GWY_DERIVED_DIRECTION

Angle in the space (only – not involving the value dimension).

 

GWY_DERIVED_PEAK

Peak value.

 

GWY_DERIVED_VALLEY

Valley value.

 

GWY_DERIVED_COUNT

The number of some features.

 

GWY_DERIVED_SPATIAL_DENSITY

Density of some features in space.

 

GWY_DERIVED_CURVATURE_RADIUS

Radius of curvature, in combined spatial+value space.

 

GWY_DERIVED_CURVATURE

Curvature, in combined spatial+value space.

 

GWY_DERIVED_DEVELOPED

Developed length, surface area or volume in combined spatial+value space.

 

GWY_DERIVED_PROJECTED

Length, area or volume in space only.

 

GWY_DERIVED_VARIATION

Total variation.

 

GWY_DERIVED_INTEGRAL

Integral of values over space.

 

GWY_DERIVED_VOLUME

Volume in combined spatial+value space.

 

GWY_DERIVED_ENTROPY

Value distribution entropy.

 

GWY_DERIVED_VALUE_DIST_ARG

Abscissa (argument) of value distribution function.

 

GWY_DERIVED_VALUE_DIST

Ordinate (value) of value distribution function.

 

GWY_DERIVED_VALUE_CDIST

Ordinate (value) of value cumulative distribution function.

 

GWY_DERIVED_SLOPE_DIST_ARG

Abscissa (argument) of value distribution function.

 

GWY_DERIVED_SLOPE_DIST

Ordinate (value) of value distribution function.

 

GWY_DERIVED_SLOPE_CDIST

Ordinate (value) of value cumulative distribution function.

 

GWY_DERIVED_DISTANCE

Spatial distance.

 

GWY_DERIVED_POSITION

Position in space.

 

GWY_DERIVED_ACF

Autocovariance (frequently called autocorrelation in Gwyddion).

 

GWY_DERIVED_HHCF

Height-height covariance (frequently called height-height correlation in Gwyddion).

 

GWY_DERIVED_IDF

Interface density (second derivative of a covatiance function).

 

GWY_DERIVED_ASG

Area scale graph.

 

GWY_DERIVED_PSDF_ARG

Abscissa (argument) of spectral density or Fourier transform.

 

GWY_DERIVED_PSDF_1D

Value of one-dimensional, i.e. projected, spectral density.

 

GWY_DERIVED_PSDF_FULLD

Value of full-dimensional spectral density.

 

GWY_DERIVED_ANGULAR_SPECTRUM

Angular power spectrum value.

 

GWY_DERIVED_MINKOVSKI_ARG

Abscissa (argument) of Minkowski functionals.

 

GWY_DERIVED_MINKOVSKI

Ordinate (value) of Minkowski functionals.