# 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

  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

  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`

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.

exception sas.qtgui.Perspectives.ParticleEditor.sampling.chunking.InputLengthMismatch

  Bases: `Exception`

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

  Bases: `Chunker`

  Chunker that doesn’t chunk

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

  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

## 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`

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

  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

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

  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