pingwyn.differentiate

pingwyn.differentiate(obj, method='central', absolute=False)

Differentiate the closest thing to dy/dx for the given object.

Parameters:
  • obj (pingwyn.Curve or pingwyn.Profile or pingwyn.Image or pingwyn.Grid) –

    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.

  • method (str) – The differentiation method. Can be “central” or “diff”. - “central”: compute the derivative using a central difference. - “diff”: compute the derivative using the difference.

  • absolute (bool) – 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.

Returns:

The result of the differential computation.

Return type:

pingwyn.Curve or pingwyn.Profile or pingwyn.Image