Move MIN,MAX,SQ macros to a common header
[qpms.git] / qpms / types.py
blob7e25b7d0ea51be2f5d96aa4c431edb8b872c18cd
1 """
2 Here shall be defined some types that are needed across the individual
3 modules of the qpms package and they do not belong logically to a single
4 module.
5 """
7 import collections
8 import enum
10 class NormalizationT(enum.IntEnum):
11 """ Corresponding to the c type qpms_normalization_t from translations.h """
12 KRISTENSSON=2 # power-normalised, this should be the default in the future
13 TAYLOR=1
14 UNDEF=0
16 class BesselT(enum.IntEnum):
17 """ Corresponding to the c type qpms_bessel_t from translations.h """
18 BESSEL_REGULAR = 1
19 BESSEL_SINGULAR = 2
20 HANKEL_PLUS = 3
21 HANKEL_MINUS = 4
22 UNDEF = 0
25 '''
26 The namedtuples below might become classes or other objects in later versions.
27 '''
29 TMatrixOp = collections.namedtuple('TMatrixOp',
30 ['optype', 'content'])
32 TMatrixSpec = collections.namedtuple('TMatrixSpec',
33 ['lMax_override', 'tmatrix_path', 'ops'])
34 TMatrixSpec.__doc__ = """\
35 Specification of a to-be-created TMatrix object.
37 lMax_override: int or None. If int and lower than the cutoff degree of the
38 T-Matrix file located at tmatrix_path, lMax_override shall be used instead.
40 tmatrix_path: str. Location of the .TMatrix file to be loaded.
42 ops: sequence of TMatrixOp instances. The operations to be performed on
43 top of the loaded .TMatrix files.
44 """
46 ParticleSpec = collections.namedtuple('ParticleSpec', ['label', 'position', 'tmatrix_spec'])
47 ParticleSpec.__doc___ = """\
48 Specification of an individual scatterer, or a component scatterer
49 of a lattice unit cell.
51 label: immutable (usually a string or None). Unique label of a unit cell
52 component (and the corresponding sublattice).
54 position: tuple of floats (or similar, such as numpy array).
56 tmatrix_spec: TMatrixSpec or TMatrix instance.
57 """
59 LatticeSpec = collections.namedtuple('LatticeSpec', ['basis', 'particle_set_specs'])
60 LatticeSpec.__doc__ = """\
61 Specification of a lattice, finite or infinite.
63 basis: tuple of basic vectors (tuples of floats or similar) (or similar,
64 such as 2d numpy array), preferably of reduced basis.
66 particle_set_specs: sequence of tuples (particle_spec, selection) where
67 particle_spec is a ParticleSpec and selection is a sequence of 2d integer
68 coordinates/indices indicating which particles (TODO describe better)
69 of that type shall be included in a finite lattice. Alternatively,
70 selection can be None for an infinite lattice.
71 """