Field class

class IMTreatment.core.field.Field[source]

Bases: object

axe_x
axe_y
change_unit(axe, new_unit)[source]

Change the unit of an Field.

Parameters:
  • axe (string) – ‘y’ for changing the profile y axis unit ‘x’ for changing the profile x axis unit
  • new_unit (Unum.unit object or string) – The new unit.
check_consistency()[source]

Raise errors if the field show some incoherences.

copy()[source]

Return a copy of the Field object.

crop(intervx=None, intervy=None, full_output=False, ind=False, inplace=False)[source]

Crop the field in respect with given intervals.

Parameters:
  • intervx (array, optional) – interval wanted along x
  • intervy (array, optional) – interval wanted along y
  • full_output (boolean, optional) – If ‘True’, cutting indices are alson returned
  • ind (boolean, optional) – If ‘True’, intervals are understood as indices along axis. If ‘False’ (default), intervals are understood in axis units.
  • inplace (boolean, optional) – If ‘True’, the field is croped in place.
dx
dy
extend(nmb_left=0, nmb_right=0, nmb_up=0, nmb_down=0, inplace=False)[source]

Add columns or lines of masked values at the field.

Parameters:
  • nmb_**** (integers) – Number of lines/columns to add in each direction.
  • inplace (bool) – If ‘False’, return a new extended field, if ‘True’, modify the field inplace.
Returns:

Extended_field – Extended field.

Return type:

Field object, optional

get_indice_on_axe(direction, value, kind='bounds')[source]

Return, on the given axe, the indices representing the positions surrounding ‘value’. if ‘value’ is exactly an axe position, return just one indice.

Parameters:
  • direction (int) – 1 or 2, for axes choice.
  • value (number) –
  • kind (string) – If ‘bounds’ (default), return the bounding indices. if ‘nearest’, return the nearest indice if ‘decimal’, return a decimal indice (interpolated)
Returns:

interval

Return type:

2x1 or 1x1 array of integer

get_points_around(center, radius, ind=False)[source]

Return the list of points or the scalar field that are in a circle centered on ‘center’ and of radius ‘radius’.

Parameters:
  • center (array) – Coordonate of the center point (in axes units).
  • radius (float) – radius of the cercle (in axes units).
  • ind (boolean, optional) – If ‘True’, radius and center represent indices on the field. if ‘False’, radius and center are expressed in axis unities.
Returns:

indices – Array contening the indices of the contened points. [(ind1x, ind1y), (ind2x, ind2y), …]. You can easily put them in the axes to obtain points coordinates

Return type:

array

rotate(angle, inplace=False)[source]

Rotate the field.

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’, Field is rotated in place, else, the function return a rotated field.
Returns:

rotated_field – Rotated field.

Return type:

Field object, optional

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

Scale the Field.

Parameters:
  • scaley (scalex,) – Scale for the axis
  • inplace (boolean) –

    .

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

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

Parameters:
  • x (number) –
  • y (number) –
shape
unit_x
unit_y