mrsprint.simulator package¶
Submodules¶
mrsprint.simulator.old_plot module¶
mrsprint.simulator.plot module¶
Module for plotting related classes and functions.
- Authors:
- Victor Hugo de Mello Pessoa <victor.pessoa@usp.br>
- Daniel Cosmo Pizetta <daniel.pizetta@usp.br>
- Since:
- 2017/07/01
-
class
mrsprint.simulator.plot.
Plot
(settings, mx, my, mz, gr, tp, freq_shift, position, max_magnetization)[source]¶ Bases:
object
Class that contains the plots of simulation.
Parameters: - settings (Settings) – Represents the program settings.
- mx (np.ndarray) – Magnetization in x.
- my (np.ndarray) – Magnetization in y.
- mz (np.ndarray) – Magnetization in z.
- gr (np.ndarray) – Gradients of magnetic field.
- tp (np.ndarray) – Time.
- freq_shift (np.ndarray) – Frequency shift due to field inhomogeneity.
- position (np.ndarray) – Position of spins.
- max_magnetization (float) – Maximum value of magnetization.
-
plotMagnetization
(mag_win)[source]¶ Create the graphics of magnetization.
Parameters: mag_win (pg.graphicsWindows.GraphicsWindow) – Window where plot will be made.
-
mrsprint.simulator.plot.
plot_item
(graphics, x, y, line_color, x_axis=True, x_label='', x_unit='', y_axis=True, y_label='', y_unit='')[source]¶ Create a new plot item in a graph.
Parameters: - graphics (pl.graphicsWindow) – The GraphicsWindow where the plot will be shown.
- x (np.array) – List of x coordinates.
- y (np.array) – List of y coordinates.
- line_color (str) – String containing the color (“r”, “g”, “b”, “w”, for example).
- x_axis (bool) – Visibility of x axis.
- x_label (str) – Label of x axis.
- x_unit (str) – Unit of x axis.
- y_axis (bool) – Visibility of y axis.
- y_label (str) – Label of y axis.
- y_unit (str) – Unit of y axis.
Returns: Plot.
Return type: pg.graphicsItems.PlotItem
mrsprint.simulator.simulator module¶
Module for simulate the response of the sample to the magnetic signal related classes and functions.
- Authors:
- Victor Hugo de Mello Pessoa <victor.pessoa@usp.br>
- Daniel Cosmo Pizetta <daniel.pizetta@usp.br>
- Since:
- 2017/07/01
Module contents¶
Package for simulator related classes and objects.
- Authors:
- Daniel Cosmo Pizetta <daniel.pizetta@usp.br>
- Since:
- 2018/06/07
Todo
Maybe remove old_plot module.
-
mrsprint.simulator.
calculate_t2_star
(t2, freq_shift)[source]¶ Returns the value for t2*, considering the range of frequencies.
Parameters: Returns: T2 star value.
Return type: float [s]
Todo
Confirm if it is the right way to calculate or if it has a weight function for t2star Pass freq_shift as a number?
-
mrsprint.simulator.
create_positions
(size=(1, 1, 1), step=(1.0, 1.0, 1.0), offset=(0.0, 0.0, 0.0), dtype=<class 'numpy.float32'>)[source]¶ Creates array of positions.
Parameters: Returns: - Position array in this format [[gr_x_plotx gr_y_plotx gr_z_plotx …]
[gr_x_ploty gr_y_ploty gr_z_ploty …][gr_x_plotz gr_y_plotz gr_z_plotz …]], where p is the number of position (from offset to size plus offset).
Return type: np.array
Todo
Set physical unit for each args.
-
mrsprint.simulator.
frequency_shift
(freq_shift, freq_step=1.0, offset=0.0, symetric=True, dtype=<class 'numpy.float32'>)[source]¶ Generates an array of frequency shift, from -frequency_shift to +frequency_shift, between offset.
Parameters: - freq_shift (float [Hz]) – Maximum frequency to shift.
- freq_step (float [Hz]) – Spacing between values.
- offset (float [Hz]) – Offset frequency.
- symetric (bool) – If true, generates the array between offset (-maximum shift, maximum shift), otherwise from offset to maximum frequency. Default is True.
- dtype (np.dtype) – Data type for the array. Default is np.float32.
Returns: Array of frequency shift value.
Return type: np.array [Hz]
Todo
Use the key symetric for something.
-
mrsprint.simulator.
reduce_magnetization_in_frequency
(mx, my, mz, freq_shift, fsa_size)[source]¶ Reduces the magnetization vector by summing frequency components.
Parameters: - mx (np.array) – Array of magnetization x without reduction in frequency.
- my (np.array) – Array of magnetization y without reduction in frequency.
- mz (np.array) – Array of magnetization z without reduction in frequency.
- freq_shift (np.array) – Array of frequency shift.
- fsa_size (int) – Size of array of frequency shift.
Returns: (mx, my, mz) arrays of magnetization reduced
Return type: Todo
Shape size different of 2. Better solution for freq_shift array. Set physical unit for each args.
-
mrsprint.simulator.
reduce_magnetization_in_position
(mx, my, mz, position, freq_shift)[source]¶ Reduces the magnetization vector by summing position components.
Parameters: - mx (np.array) – Array of x magnetization without reduction in frequency.
- my (np.array) – Array of y magnetization without reduction in frequency.
- mz (np.array) – Array of z magnetization without reduction in frequency.
- position (np.array) – Array of positions.
- freq_shift (np.array) – Array of frequency shift.
Returns: (mx, my, mz) arrays of magnetization reduced.
Return type: Todo
Test shape size different of 2. Set physical unit for each args.