STParams

class pyrost.simulation.STParams(**kwargs)

Container with the experimental parameters of one-dimensional Speckle Tracking scan. All the experimental parameters are enlisted in attr_dict.

Parameters

**kwargs (dict) – Values for the exerimental parameters specified in attr_dict.

Variables
  • attr_dict (dict) – Dictionary which contains all the experimental parameters.

  • fmt_dict (dict) – Dictionary which specifies the data types of the parameters in attr_dict.

See also

st_sim_param

Full list of experimental parameters.

bar_positions(dist)

Generate a coordinate array of barcode’s bar positions at distance dist from focal plane.

Parameters

dist (float) – Distance from the focal plane [um].

Returns

b_steps – Array of barcode’s bar coordinates.

Return type

numpy.ndarray

See also

bin.bar_positions

Full details of randomized barcode steps generation algorithm.

barcode_profile(b_steps, dx, n_x)

Generate a barcode’s transmission profile.

Parameters
  • b_steps (numpy.ndarray) – Array of barcode’s bar positions [um].

  • dx (float) – Sampling distance [um].

  • n_x (int) – Wavefront size.

Returns

b_tr – Barcode’s transmission profile.

Return type

numpy.ndarray

See also

bin.barcode_profile

Full details of barcode’s transmission profile generation algorithm.

beam_span(dist)

Return beam span along the x axis at distance dist from the focal plane.

Parameters

dist (float) – Distance from the focal plane [um].

Returns

  • th_lb (float) – Beam’s lower bound [um].

  • th_ub (float) – Beam’s upper bound [um].

export_dict()

Export experimental parameters to dict.

Returns

param_dict – Experimental parameters.

Return type

dict

classmethod export_ini(**kwargs)

Return a configparser.ConfigParser object with all the attributes exported the class.

Parameters

**kwargs (dict) – Extra parameters to export to the configparser.ConfigParser object.

Returns

A parser object with all the attributes contained in attr_dict.

Return type

configparser.ConfigParser

fs_roi()

Return detector’s region of interest along the fast axis.

Returns

  • fs_lb (int) – Beam’s lower bound along the detector’s fast axis.

  • fs_ub (int) – Beam’s upper bound along the detector’s fast axis.

classmethod get_format(section, option)

Return the attribute’s format specified by fmt_dict.

Parameters
  • section (str) – Attribute’s section.

  • option (str) – Attribute’s name.

Returns

Type of the attribute.

Return type

type

classmethod get_value(ini_parser, section, option)

Return an attribute from an INI file’s parser object ini_parser.

Parameters
  • ini_parser (configparser.ConfigParser) – A parser object of an INI file.

  • section (str) – Attribute’s section.

  • option (str) – Attribute’s option.

Returns

Return type

Attribute’s value imported from the INI file.

classmethod import_dict(**kwargs)

Initialize experimental parameters from a dictionary kwargs.

Parameters

**kwargs (dict) – Dictionary with experimental parameters.

Returns

An STParams object with the parameters from kwargs.

Return type

STParams

classmethod import_ini(protocol_file)

Initialize an INIParser object class with an ini file.

Parameters

protocol_file (str) – Path to the file.

Returns

An INIParser object with all the attributes imported from the INI file.

Return type

INIParser

lens_wavefronts(n_x=None, n_y=None, return_dxdy=False)

Return wavefields at the lens plane along x and y axes.

Parameters
Returns

  • u0_x (numpy.ndarray) – Wavefront along the x axis.

  • u0_y (numpy.ndarray) – Wavefront along the y axis.

  • dx (float) – Step size along the x axis [um]. Only if return_dxdy is True.

  • dy (float) – Step size along the y axis [um]. Only if return_dxdy is True.

Notes

The exit-surface at the lens’ plane:

\[U_0(x) = \Pi(a_x x) \exp \left[ -\frac{j \pi x^2}{\lambda f} + j \alpha \left( \frac{x - x_{ab_cnt}}{f} \right)^3 \right]\]
\[U_0(y) = \Pi(a_y y)\]
classmethod lookup_dict()

Look-up table between the sections and the parameters.

Returns

Look-up dictionary.

Return type

dict

classmethod read_ini(protocol_file)

Read the protocol_file and return an instance of configparser.ConfigParser class.

Parameters

protocol_file (str) – Path to the file.

Returns

Parser object with all the data contained in the INI file.

Return type

configparser.ConfigParser

Raises

ValueError – If the file doesn’t exist.

source_curve(dist, dx)

Return source’s rocking curve profile at dist distance from the lens.

Parameters
  • dist (float) – Distance from the lens to the rocking curve profile [um].

  • dx (float) – Sampling distance [um].

Returns

Source’s rocking curve profile.

Return type

numpy.ndarray

x_wavefront_size()

Return wavefront array size along the x axis, that satisfies the sampling condition.

Returns

n_x – Array size.

Return type

int

Notes

The sampling condition when we propagate the wavefield from the lens plane to the sample plane is as follows:

\[N_x >= \frac{\mathrm{max} \left( \Delta x_{lens}, \Delta x_{sample} \right) (\Delta x_{lens} + \Delta x_{sample})}{\lambda d} = \frac{4 a_x^2 \mathrm{max} \left( f, df \right)}{f^2 \lambda}\]

Whereupon, the sampling condition when we propagate the wavefield to the detector plane is:

\[N_x >= \frac{\Delta x_{sample} \Delta x_{det}}{\lambda d} = \frac{2 a_x n_{fs} \Delta_{pix} df}{f \lambda d_{det}}\]
y_wavefront_size()

Return wavefront array size along the y axis, that satisfies the sampling condition.

Returns

n_y – Array size.

Return type

int

Notes

The sampling condition when we propagate the wavefield from the lens plane to the sample plane is as follows:

\[N_y >= \frac{\mathrm{max} \left( \Delta y_{lens}, \Delta y_{sample} \right) (\Delta y_{lens} + \Delta y_{sample})}{\lambda d} = \frac{8 a_y^2}{(f + df) \lambda}\]

Whereupon, the sampling condition when we propagate the wavefield to the detector plane is:

\[N_y >= \frac{\Delta y_{sample} \Delta y_{det}}{\lambda d} = \frac{2 a_y n_{ss} \Delta_{pix}}{\lambda d_{det}}\]