Simulation2D#

class diffsims.simulations.Simulation2D(phases: Sequence[Phase], coordinates: DiffractingVector | Sequence[DiffractingVector] | Sequence[Sequence[DiffractingVector]], rotations: Rotation | Sequence[Rotation], simulation_generator: SimulationGenerator, reciprocal_radius: float = 1.0)[source]#

Bases: object

Holds the result of a kinematic diffraction simulation for some phase and rotation. This class is iterable and can be used to iterate through simulations of different phases and rotations.

Attributes

Simulation2D.current_phase

Simulation2D.current_size

Returns the number of rotations in the current phase

Simulation2D.has_multiple_phases

Returns True if the simulation has multiple phases

Simulation2D.has_multiple_rotations

Returns True if the simulation has multiple rotations

Simulation2D.num_phases

Returns the number of phases in the simulation

Methods

Simulation2D.deepcopy()

Simulation2D.get_current_coordinates()

Returns the coordinates of the current phase and rotation

Simulation2D.get_current_rotation_matrix()

Returns the current rotation matrix based on the phase and rotation index

Simulation2D.get_diffraction_pattern([...])

Returns the diffraction data as a numpy array with two-dimensional Gaussians representing each diffracted peak.

Simulation2D.get_simulation(item)

Return the rotation and the phase index of the simulation

Simulation2D.plot([size_factor, ...])

A quick-plot function for a simulation of spots

Simulation2D.plot_rotations(beam_direction)

Plots the rotations of the current phase in stereographic projection

Simulation2D.polar_flatten_simulations([...])

Flattens the simulations into polar coordinates for use in template matching.

Simulation2D.rotate_shift_coordinates(angle)

Rotate, flip or shift patterns in-plane

Examples using Simulation2D#

0.5.x –> 0.6.x Migration Guide

0.5.x --> 0.6.x Migration Guide

Simple Diffraction Pattern Simulation Examples

Simple Diffraction Pattern Simulation Examples