Fields class

class IMTreatment.core.fields.Fields[source]

Bases: object

Class representing a set of fields. These fields can have differente positions along axes, or be successive view of the same area. It’s recommended to use TemporalVelocityFields or SpatialVelocityFields instead of this one.

add_field(field, copy=True)[source]

Add a field to the existing fields.

Parameters:field (sf.VectorField or sf.ScalarField object) – The field to add.
copy()[source]

Return a copy of the velocityfields

remove_field(fieldnumbers)[source]

Remove a field of the existing fields.

Parameters:fieldnumber (integer or list of integers) – Velocity field(s) number(s) to remove.
rotate(angle, inplace=False)[source]

Rotate the fields.

Parameters:
  • angle (integer) – Angle in degrees (positive for trigonometric direction). In order to preserve the orthogonal grid, only multiples of 90° are accepted (can be negative multiples).
  • inplace (boolean, optional) – If ‘True’, fields is rotated in place, else, the function return rotated fields.
Returns:

rotated_field – Rotated fields.

Return type:

TemporalFields or child object, optional

scale(scalex=None, scaley=None, scalev=None, inplace=False)[source]

Scale the Fields.

Parameters:
  • scaley, scalev (scalex,) – Scale for the axis and the values.
  • inplace (boolean) –

    .

set_origin(x=None, y=None)[source]

Modify the axis in order to place the origin at the actual point (x, y)

Parameters:
  • x (number) –
  • y (number) –
smooth(tos='uniform', size=None, inplace=False, **kw)[source]

Smooth the fields in place. Warning : fill up the field (should be used carefully with masked field borders)

Parameters:
  • tos (string, optional) – Type of smoothing, can be ‘uniform’ (default) or ‘gaussian’ (See ndimage module documentation for more details)
  • size (number, optional) – Size of the smoothing (is radius for ‘uniform’ and sigma for ‘gaussian’) in indice number. Default is 3 for ‘uniform’ and 1 for ‘gaussian’.
  • inplace (boolean, optional) – If True, Field is smoothed in place, else, the smoothed field is returned.
  • kw (dic) – Additional parameters for ndimage methods (See ndimage documentation)