sas.qtgui.Perspectives.ParticleEditor.sampling package

Submodules

sas.qtgui.Perspectives.ParticleEditor.sampling.angles module

Different methods for sampling the angular distribution of q vectors

A list of the different methods available can be found at the bottom of the code and needs to be updated if new ones are added.

class sas.qtgui.Perspectives.ParticleEditor.sampling.angles.Uniform(geodesic_divisions: int)

Bases: AngularDistribution

Spherically averaged sample

__abstractmethods__ = frozenset({})
__doc__ = ' Spherically averaged sample '
__init__(geodesic_divisions: int)
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.angles'
__repr__()

Return repr(self).

_abc_impl = <_abc._abc_data object>
property n_points: int

Number of sample points

static name()

Name of this distribution

static parameters() List[Tuple[str, str, type]]

List of keyword arguments to constructor, names for GUI, and the type of value

sample_points_and_weights() Tuple[ndarray, ndarray]

Get sample q vector directions and associated weights

class sas.qtgui.Perspectives.ParticleEditor.sampling.angles.ZDelta

Bases: AngularDistribution

Perfectly oriented sample

__abstractmethods__ = frozenset({})
__doc__ = ' Perfectly oriented sample '
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.angles'
__repr__()

Return repr(self).

_abc_impl = <_abc._abc_data object>
property n_points

Number of sample points

static name()

Name of this distribution

static parameters()

List of keyword arguments to constructor, names for GUI, and the type of value

sample_points_and_weights()

Get sample q vector directions and associated weights

sas.qtgui.Perspectives.ParticleEditor.sampling.chunking module

Functions designed to help avoid using too much memory, chunks up the pairwise distributions

Something like this

. First Point

. 1 2 3 | 4 5 6 | 7 8 9 | 0 . 1 | | | .S | | | .e 2 CHUNK 1 | CHUNK 2 | CHUNK 3 | CHUNK 4 .c | | | .o 3 | | | .n —————+———–+———–+———— .d 4 | | | . | | | .P 5 CHUNK 5 | CHUNK 6 | CHUNK 7 | CHUNK 8 .o | | | .i 6 | | | .n —————+———–+———–+———— .t 7 | | | . | | | . 8 CHUNK 9 | CHUNK 10 | CHUNK 11 | CHUNK 12 . | | | . 9 | | | . —————+———–+———–+———— . 0 | | | . CHUNK 13 | CHUNK 14 | CHUNK 15 | CHUNK 16 . | | |

class sas.qtgui.Perspectives.ParticleEditor.sampling.chunking.Chunker(point_generator: SpatialDistribution)

Bases: ABC

__abstractmethods__ = frozenset({'_iterator'})
__dict__ = mappingproxy({'__module__': 'sas.qtgui.Perspectives.ParticleEditor.sampling.chunking', '__init__': <function Chunker.__init__>, '__iter__': <function Chunker.__iter__>, '_iterator': <function Chunker._iterator>, '__dict__': <attribute '__dict__' of 'Chunker' objects>, '__weakref__': <attribute '__weakref__' of 'Chunker' objects>, '__doc__': None, '__abstractmethods__': frozenset({'_iterator'}), '_abc_impl': <_abc._abc_data object>, '__annotations__': {}})
__doc__ = None
__init__(point_generator: SpatialDistribution)
__iter__()
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.chunking'
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
abstract _iterator() Tuple[Tuple[ndarray, ndarray, ndarray], Tuple[ndarray, ndarray, ndarray]]

Python generator function that yields chunks

class sas.qtgui.Perspectives.ParticleEditor.sampling.chunking.Chunks(point_generator: SpatialDistribution)

Bases: Chunker

Class that takes a point generator, and produces all pairwise combinations in chunks

This trades off speed for space.

__abstractmethods__ = frozenset({'_iterator'})
__doc__ = ' Class that takes a point generator, and produces all pairwise combinations in chunks\n\n    This trades off speed for space.\n    '
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.chunking'
_abc_impl = <_abc._abc_data object>
exception sas.qtgui.Perspectives.ParticleEditor.sampling.chunking.InputLengthMismatch

Bases: Exception

__doc__ = None
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.chunking'
__weakref__

list of weak references to the object

class sas.qtgui.Perspectives.ParticleEditor.sampling.chunking.SingleChunk(point_generator: SpatialDistribution)

Bases: Chunker

Chunker that doesn’t chunk

__abstractmethods__ = frozenset({})
__doc__ = " Chunker that doesn't chunk "
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.chunking'
_abc_impl = <_abc._abc_data object>
_iterator()

Python generator function that yields chunks

sas.qtgui.Perspectives.ParticleEditor.sampling.chunking.pairwise_chunk_iterator(left_data: Sequence[Sequence[Any]], right_data: Sequence[Sequence[Any]], chunk_size: int) Tuple[Sequence[Sequence[Any]], Sequence[Sequence[Any]]]

Generator to do chunking as described in the module docs above

sas.qtgui.Perspectives.ParticleEditor.sampling.chunking.sublist_lengths(data: Sequence[Sequence[Any]]) int

Return the length of the

sas.qtgui.Perspectives.ParticleEditor.sampling.geodesic module

class sas.qtgui.Perspectives.ParticleEditor.sampling.geodesic.Geodesic

Bases: object

Points arranged pretty uniformly and regularly on a sphere

__dict__ = mappingproxy({'__module__': 'sas.qtgui.Perspectives.ParticleEditor.sampling.geodesic', '__doc__': ' Points arranged pretty uniformly and regularly on a sphere', '_base_vertices': [(0.0, 0.0, 1.0), (0.8944271909999159, 0.0, 0.4472135954999579), (0.27639320225002106, 0.8506508083520399, 0.4472135954999579), (-0.7236067977499788, 0.5257311121191337, 0.4472135954999579), (-0.7236067977499789, -0.5257311121191335, 0.4472135954999579), (0.27639320225002084, -0.85065080835204, 0.4472135954999579), (0.7236067977499789, 0.5257311121191336, -0.4472135954999579), (-0.27639320225002095, 0.85065080835204, -0.4472135954999579), (-0.8944271909999159, 1.0953573965284052e-16, -0.4472135954999579), (-0.2763932022500211, -0.8506508083520399, -0.4472135954999579), (0.7236067977499788, -0.5257311121191338, -0.4472135954999579), (0.0, 0.0, -1.0)], '_base_edges': [(0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (1, 2), (2, 3), (3, 4), (4, 5), (5, 1), (1, 6), (2, 7), (3, 8), (4, 9), (5, 10), (1, 10), (2, 6), (3, 7), (4, 8), (5, 9), (6, 7), (7, 8), (8, 9), (9, 10), (10, 6), (6, 11), (7, 11), (8, 11), (9, 11), (10, 11)], '_base_triangles': [(0, 1, 2), (0, 2, 3), (0, 3, 4), (0, 4, 5), (0, 5, 1), (2, 1, 6), (3, 2, 7), (4, 3, 8), (5, 4, 9), (1, 5, 10), (6, 10, 1), (7, 6, 2), (8, 7, 3), (9, 8, 4), (10, 9, 5), (6, 7, 11), (7, 8, 11), (8, 9, 11), (9, 10, 11), (10, 6, 11)], '_cache': {}, 'points_for_division_amount': <staticmethod(<function Geodesic.points_for_division_amount>)>, 'minimal_divisions_for_points': <staticmethod(<function Geodesic.minimal_divisions_for_points>)>, 'by_point_count': <staticmethod(<function Geodesic.by_point_count>)>, 'by_divisions': <staticmethod(<function Geodesic.by_divisions>)>, '_calculate_weights': <staticmethod(<function Geodesic._calculate_weights>)>, '_rotation_matrix_to_z_vector': <staticmethod(<function Geodesic._rotation_matrix_to_z_vector>)>, '__dict__': <attribute '__dict__' of 'Geodesic' objects>, '__weakref__': <attribute '__weakref__' of 'Geodesic' objects>, '__annotations__': {}})
__doc__ = ' Points arranged pretty uniformly and regularly on a sphere'
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.geodesic'
__weakref__

list of weak references to the object

_base_edges = [(0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (1, 2), (2, 3), (3, 4), (4, 5), (5, 1), (1, 6), (2, 7), (3, 8), (4, 9), (5, 10), (1, 10), (2, 6), (3, 7), (4, 8), (5, 9), (6, 7), (7, 8), (8, 9), (9, 10), (10, 6), (6, 11), (7, 11), (8, 11), (9, 11), (10, 11)]
_base_triangles = [(0, 1, 2), (0, 2, 3), (0, 3, 4), (0, 4, 5), (0, 5, 1), (2, 1, 6), (3, 2, 7), (4, 3, 8), (5, 4, 9), (1, 5, 10), (6, 10, 1), (7, 6, 2), (8, 7, 3), (9, 8, 4), (10, 9, 5), (6, 7, 11), (7, 8, 11), (8, 9, 11), (9, 10, 11), (10, 6, 11)]
_base_vertices = [(0.0, 0.0, 1.0), (0.8944271909999159, 0.0, 0.4472135954999579), (0.27639320225002106, 0.8506508083520399, 0.4472135954999579), (-0.7236067977499788, 0.5257311121191337, 0.4472135954999579), (-0.7236067977499789, -0.5257311121191335, 0.4472135954999579), (0.27639320225002084, -0.85065080835204, 0.4472135954999579), (0.7236067977499789, 0.5257311121191336, -0.4472135954999579), (-0.27639320225002095, 0.85065080835204, -0.4472135954999579), (-0.8944271909999159, 1.0953573965284052e-16, -0.4472135954999579), (-0.2763932022500211, -0.8506508083520399, -0.4472135954999579), (0.7236067977499788, -0.5257311121191338, -0.4472135954999579), (0.0, 0.0, -1.0)]
_cache = {}
static _calculate_weights(points) ndarray

Calculate the anular area associated with each point

static _rotation_matrix_to_z_vector(point_on_sphere: ndarray) ndarray

Calculate a rotation matrix that moves a given point onto the z axis

static by_divisions(n_divisions) Tuple[ndarray, ndarray]

Get point sample on a unit geodesic sphere, points are creating by dividing each face of an icosahedron into smaller triangles so that each edge is split into n_divisions pieces

Weights of each point are calculated by fractional spherical area of dual polyhedron, and total weight = 4pi

static by_point_count(self, n_points) Tuple[ndarray, ndarray]

Get point sample on a unit geodesic sphere, at least n_points will be returned

Weights of each point are calculated by fractional spherical area of dual polyhedron, and total weight = 4pi

static minimal_divisions_for_points(n_points)

What division number should I use if I want at least n_points points on my geodesic

rounded (ciel) inverse of points_for_division_amount

static points_for_division_amount(n_divisions)

Get the number of points on the sphere for a given number of geodesic divisions by which I mean how many sections is each edge of the initial icosahedron split into (not how many times it is divided in half, which might be what you think given some other geodesic generation methods)

Icosahedron counts as 1 division

class sas.qtgui.Perspectives.ParticleEditor.sampling.geodesic.GeodesicDivisions

Bases: object

Use this so that the GUI program gives geodesic divisions box, rather than a plain int one

__dict__ = mappingproxy({'__module__': 'sas.qtgui.Perspectives.ParticleEditor.sampling.geodesic', '__doc__': ' Use this so that the GUI program gives geodesic divisions box, rather than a plain int one', '__dict__': <attribute '__dict__' of 'GeodesicDivisions' objects>, '__weakref__': <attribute '__weakref__' of 'GeodesicDivisions' objects>, '__annotations__': {}})
__doc__ = ' Use this so that the GUI program gives geodesic divisions box, rather than a plain int one'
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.geodesic'
__weakref__

list of weak references to the object

sas.qtgui.Perspectives.ParticleEditor.sampling.points module

Instances of the spatial sampler

class sas.qtgui.Perspectives.ParticleEditor.sampling.points.BoundedByCube(radius: float, n_points: int, n_desired_points)

Bases: SpatialDistribution

__abstractmethods__ = frozenset({'generate'})
__doc__ = None
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.points'
_abc_impl = <_abc._abc_data object>
_boundary_base_points = array([[-1.,  0.,  0.],        [ 1.,  0.,  0.],        [ 0., -1.,  0.],        [ 0.,  1.,  0.],        [ 0.,  0., -1.],        [ 0.,  0.,  1.],        [ 1.,  1.,  1.],        [ 1.,  1., -1.],        [ 1., -1.,  1.],        [ 1., -1., -1.],        [-1.,  1.,  1.],        [-1.,  1., -1.],        [-1., -1.,  1.],        [-1., -1., -1.]])
_bounding_surface_check_points() Tuple[ndarray, ndarray, ndarray]

Points used to check that the SLD/magnetism vector are zero outside the sample space

class sas.qtgui.Perspectives.ParticleEditor.sampling.points.Grid(radius: float, desired_points: int)

Bases: BoundedByCube

Generate points on a grid within a cube with side length 2*radius

__abstractmethods__ = frozenset({})
__doc__ = ' Generate points on a grid within a cube with side length 2*radius '
__init__(radius: float, desired_points: int)
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.points'
_abc_impl = <_abc._abc_data object>
generate(start_index: int, end_index: int) Tuple[ndarray, ndarray, ndarray]

Generate points from start_index up to end_index

property info

Information to be displayed in the settings window next to the point number input

class sas.qtgui.Perspectives.ParticleEditor.sampling.points.PointGeneratorStepper(point_generator: SpatialDistribution, step_size: int, bootstrap_sections: int)

Bases: object

Generate batches of step_size points from a PointGenerator instance

__dict__ = mappingproxy({'__module__': 'sas.qtgui.Perspectives.ParticleEditor.sampling.points', '__doc__': ' Generate batches of step_size points from a PointGenerator instance\n    ', '__init__': <function PointGeneratorStepper.__init__>, '_iterator': <function PointGeneratorStepper._iterator>, '__iter__': <function PointGeneratorStepper.__iter__>, '__dict__': <attribute '__dict__' of 'PointGeneratorStepper' objects>, '__weakref__': <attribute '__weakref__' of 'PointGeneratorStepper' objects>, '__annotations__': {}})
__doc__ = ' Generate batches of step_size points from a PointGenerator instance\n    '
__init__(point_generator: SpatialDistribution, step_size: int, bootstrap_sections: int)
__iter__()
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.points'
__weakref__

list of weak references to the object

_iterator()
class sas.qtgui.Perspectives.ParticleEditor.sampling.points.RandomCube(radius: float, desired_points: int, seed=None)

Bases: BoundedByCube

Generate random points in a cube with side length 2*radius

__abstractmethods__ = frozenset({})
__doc__ = ' Generate random points in a cube with side length 2*radius'
__init__(radius: float, desired_points: int, seed=None)
__module__ = 'sas.qtgui.Perspectives.ParticleEditor.sampling.points'
_abc_impl = <_abc._abc_data object>
allows_bootstrap() bool
generate(start_index: int, end_index: int) Tuple[ndarray, ndarray, ndarray]

Generate points from start_index up to end_index

Module contents