febid.monte_carlo.etrajectory.ETrajectory#

class ETrajectory[source]#

Bases: MC_Sim_Base

A class responsible for the generation and scattering of electron trajectories

Methods

get_crossing_point

get_next_crossing

Get next two crossing points and a flag showing if volume boundaries are met

get_norm_factor

Calculate norming factor with the given number of generated trajectories

map_trajectory

Simulate trajectory of the electrons with a specified starting position.

map_trajectory_verbose

Simulate trajectory of the electrons with a specified starting position.

map_wrapper

Create normally distributed electron positions and run trajectory mapping

map_wrapper_cy

Create normally distributed electron positions and run trajectory mapping in Cython

plot_distribution

Plot a scatter plot of the (x,y) points with 2D histograms depicting axial distribution

rnd_gauss_xy

Generate a specified number of points according to a Gaussian distribution.

rnd_super_gauss

Generate a specified number of points according to a Super Gaussian distribution.

save_passes

Save passes to a text file or by pickling

setParameters

Initialise the instance and set all the necessary parameters

Attributes

NA

elementary_charge

shape

shape_abs

get_next_crossing(coords)[source]#

Get next two crossing points and a flag showing if volume boundaries are met

Parameters:

coords

Returns:

get_norm_factor(N=None)[source]#

Calculate norming factor with the given number of generated trajectories

Parameters:

N – number of trajectories

Returns:

map_trajectory(x0, y0)[source]#

Simulate trajectory of the electrons with a specified starting position.

Parameters:
  • x0 – x-positions of the electrons

  • y0 – y-positions of the electrons

Returns:

map_trajectory_verbose(x0, y0)[source]#

Simulate trajectory of the electrons with a specified starting position. Version with step-by-step output to console.

Parameters:
  • x0 – x-positions of the electrons

  • y0 – y-positions of the electrons

Returns:

map_wrapper(y0, x0, N=0)[source]#

Create normally distributed electron positions and run trajectory mapping

Parameters:
  • y0 – y-position of the beam, nm

  • x0 – x-position of the beam, nm

  • N – number of electrons to create

Returns:

map_wrapper_cy(y0, x0, N=0)[source]#

Create normally distributed electron positions and run trajectory mapping in Cython

Parameters:
  • y0 – y-position of the beam, nm

  • x0 – x-position of the beam, nm

  • N – number of electrons to create

Returns:

plot_distribution(x, y, func=None)[source]#

Plot a scatter plot of the (x,y) points with 2D histograms depicting axial distribution

Parameters:
  • x – array of x-coordinates

  • y – array of y-coordinates

  • func – 2D probability density function

Returns:

rnd_gauss_xy(x0, y0, N)[source]#

Generate a specified number of points according to a Gaussian distribution. Standard deviation and order of the super gaussian are class properties.

Parameters:
  • x0 – mean along X-axis

  • y0 – mean along Y-axis

  • N – number of points to generate

Returns:

two arrays of N-length with x and y positions

rnd_super_gauss(x0, y0, N)[source]#

Generate a specified number of points according to a Super Gaussian distribution. Standard deviation and order of the super gaussian are class properties.

Parameters:
  • x0 – mean along X-axis

  • y0 – mean along Y-axis

  • N – number of points to generate

Returns:

two arrays of N-length with x and y positions

save_passes(fname, type)[source]#

Save passes to a text file or by pickling

Parameters:
  • fname – name of the file

  • type – saving type: accepts ‘pickle’ or ‘text’

Returns:

setParameters(structure, params, stat=1000)[source]#

Initialise the instance and set all the necessary parameters

Parameters:
  • structure – solid structure representation

  • params – contains all input parameters for the simulation

  • stat – number of simulated trajectories