pingwyn.core.differentiate
Differentiate the closest thing to dy/dx for the given object.
- param obj:
The pingwyn object to compute the derivative for.
For pingwyn.Curve types, the difference is computed as diff(obj[1]) / diff(obj[0]).
For pingwyn.Grid types, the difference is computed per curve as diff(obj[i, j, :]) / diff( obj.z).
For pingwyn.Profile types, the difference is diff(obj) / diff(obj.x) per row (i.e. per curve).
For pingwyn.Image types, the difference is computed as the (absolute value of) row differences plus the (absolute value of) column differences, divided by 2.
- type obj:
pingwyn.Curve or pingwyn.Profile or pingwyn.Image or pingwyn.Grid
- param method:
The differentiation method. Can be “central” or “diff”. - “central”: compute the derivative using a central difference. - “diff”: compute the derivative using the difference.
- type method:
str
- param absolute:
Whether or not to return the differences as absolute values. If obj is a pingwyn.Image, the row and column differences are summed as absolute values.
- type absolute:
bool
- returns:
The result of the differential computation.
- rtype:
pingwyn.Curve or pingwyn.Profile or pingwyn.Image