FieldMap

class zgoubidoo.fieldmaps.fieldmap.FieldMap(field_map: pandas.core.frame.DataFrame)[source]

Bases: object

TODO

Parameters

field_map

Attributes Summary

data

Field map raw data in a numpy array.

df

Field map dataframe.

field_profile_fit

Fit of the field profile.

mesh_sampling_x

Sampling points of the field map along the X axis.

mesh_sampling_y

Sampling points of the field map along the Y axis.

mesh_sampling_z

Sampling points of the field map along the Z axis.

reference_trajectory

Reference trajectory attached to the field map.

Methods Summary

attach_cartesian_trajectory([axis, lower, …])

TODO: support arbitrary rotations

attach_polar_trajectory(radius, lower_angle, …)

param radius

export_for_bdsim([method])

param method

method used for the grid interpolation (‘nearest’ or ‘linear’)

fit_field_profile([model, field_component, …])

param model

load_from_opera(file[, path])

Factory method to load a field map from a Opera parent file.

load_from_opera_with_mesh(field_file, mesh_file)

Factory method to load a field map from Opera parent files (field map and mesh definition).

mesh_sampling_along_axis(axis)

Sampling points of the field map along a given axis.

plot_field_map(ax, field_component[, …])

param ax

plot_field_profile(ax[, field_component, …])

param ax

rotate()

TODO

sample(points[, field_component, method])

param points

slice([slicing])

Slices the field map following a slicing query.

translate([x, y, z])

param x

Attributes Documentation

data

Field map raw data in a numpy array.

df

Field map dataframe.

field_profile_fit

Fit of the field profile.

mesh_sampling_x

Sampling points of the field map along the X axis.

mesh_sampling_y

Sampling points of the field map along the Y axis.

mesh_sampling_z

Sampling points of the field map along the Z axis.

reference_trajectory

Reference trajectory attached to the field map.

Methods Documentation

attach_cartesian_trajectory(axis: int = 0, lower: Optional[float] = None, upper: Optional[float] = None, samples: Optional[int] = None, offset_x: float = 0.0, offset_y: float = 0.0, offset_z: float = 0.0)[source]

TODO: support arbitrary rotations

Parameters
  • axis

  • lower

  • upper

  • samples

  • offset_x

  • offset_y

  • offset_z

Returns:

attach_polar_trajectory(radius: float, lower_angle: float, upper_angle: float, samples: int, plane: str = 'XY', offset_x: float = 0.0, offset_y: float = 0.0, offset_z: float = 0.0)[source]
Parameters
  • radius

  • lower_angle

  • upper_angle

  • samples

  • plane

  • offset_x

  • offset_y

  • offset_z

Returns:

export_for_bdsim(method: str = 'nearest')[source]
Parameters

method – method used for the grid interpolation (‘nearest’ or ‘linear’)

Returns:

fit_field_profile(model: Optional[lmfit.model.Model] = None, field_component: str = 'MOD', sampling_method: str = 'nearest') → lmfit.model.ModelResult[source]
Parameters
  • model

  • field_component

  • sampling_method

Returns:

classmethod load_from_opera(file: str, path: str = '.')[source]

Factory method to load a field map from a Opera parent file.

Parameters
  • file – the file containing the field map data

  • path – path to the field mpa data file

Returns

A FieldMap loaded from file.

classmethod load_from_opera_with_mesh(field_file: str, mesh_file: str, path: str = '.')[source]

Factory method to load a field map from Opera parent files (field map and mesh definition).

Parameters
  • field_file – the file containing the field map data

  • mesh_file – the file containing the mesh data

  • path – path to the field mpa data files

Returns

A FieldMap loaded from files.

mesh_sampling_along_axis(axis: int) → Tuple[numpy.array, int][source]

Sampling points of the field map along a given axis.

Parameters

axis – the index of the axis.

Returns

A numpy array containing the data points of the field map sampling.

plot_field_map(ax, field_component: str, plane1: int = 0, plane2: int = 2, bins: int = 50)[source]
Parameters
  • ax

  • field_component

  • plane1

  • plane2

  • bins

Returns:

plot_field_profile(ax, field_component: str = 'MOD', sampling_method: str = 'nearest')[source]
Parameters
  • ax

  • field_component

  • sampling_method

Returns:

rotate()[source]

TODO

sample(points, field_component: str = 'MOD', method: str = 'nearest')[source]
Parameters
  • points

  • field_component – field component to be sampled (‘BX’, ‘BY’, ‘BZ’ or ‘MOD’)

  • method – method used for the grid interpolation (‘nearest’ or ‘linear’)

Returns:

slice(slicing: str = 'Z == 0')[source]

Slices the field map following a slicing query.

Parameters

slicing – the slicing query string

Returns

The object itself (allows method chaining).

translate(x: float = 0, y: float = 0, z: float = 0)[source]
Parameters
  • x

  • y

  • z

Returns: