LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
generator.py
Go to the documentation of this file.
1 from .constants import HERMITE, LAGUERRE, computeSize
2 
3 __all__ = ['IndexGenerator', 'HermiteIndexGenerator', 'LaguerreIndexGenerator']
4 
5 
7  """Base class for shapelet index generators.
8 
9  Parameters
10  ----------
11  order: `int`
12  Order of the function indices to generate.
13  """
14 
15  __slots__ = "order", "size"
16 
17  def __init__(self, order):
18  self.order = order
19  self.size = computeSize(self.order)
20 
21  @staticmethod
22  def make(self, order, basisType):
23  if basisType == HERMITE:
24  return HermiteIndexGenerator(order)
25  elif basisType == LAGUERRE:
26  return LaguerreIndexGenerator(order)
27 
28  def __len__(self):
29  return self.size
30 
31 
33  """Iterable that generates tuples of indices.
34 
35  Yields
36  ------
37  i : `int`
38  the overall coefficient index for a 2-d shapelet expansion (just counts from zero)
39  nx : `int`
40  the order of the x expansion
41  ny : `int`
42  the order of the y expansion
43  """
44 
45  def __iter__(self):
46  i = 0
47  for n in range(0, self.order+1):
48  for nx in range(0, n+1):
49  yield (i, nx, n - nx)
50  i += 1
51 
52 
54  """Iterable that generates tuples of indices.
55 
56  Yields
57  ------
58  i : `int`
59  the overall coefficient index for a 2-d shapelet expansion (just counts from zero)
60  p, q : `int`
61  indices of the polar shapelet expansion (see BasisTypeEnum).
62  re : `bool`
63  True, if this is the real part of the coefficient.
64  """
65 
66  def __iter__(self):
67  i = 0
68  for n in range(0, self.order+1):
69  p = n
70  q = 0
71  while p > q:
72  yield (i, p, q, True)
73  i += 1
74  yield (i, p, q, False)
75  i += 1
76  p -= 1
77  q += 1
78  if p == q:
79  yield (i, p, q, True)
80  i += 1
int computeSize(int order)
Return the size of the coefficient vector for the given order.
Definition: constants.h:97
def make(self, order, basisType)
Definition: generator.py:22