LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
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
lsst::shapelet.generator.IndexGenerator.size
size
Definition: generator.py:19
lsst::shapelet.generator.IndexGenerator.order
order
Definition: generator.py:18
lsst::shapelet.generator.HermiteIndexGenerator
Definition: generator.py:32
lsst::shapelet.generator.LaguerreIndexGenerator
Definition: generator.py:53
lsst::shapelet.generator.IndexGenerator.__len__
def __len__(self)
Definition: generator.py:28
lsst::shapelet::computeSize
int computeSize(int order)
Return the size of the coefficient vector for the given order.
Definition: constants.h:97
lsst::shapelet.generator.IndexGenerator.make
def make(self, order, basisType)
Definition: generator.py:22
lsst::shapelet.generator.IndexGenerator.__init__
def __init__(self, order)
Definition: generator.py:17
lsst::shapelet.generator.HermiteIndexGenerator.__iter__
def __iter__(self)
Definition: generator.py:45
lsst::shapelet.generator.LaguerreIndexGenerator.__iter__
def __iter__(self)
Definition: generator.py:66
lsst::shapelet.generator.IndexGenerator
Definition: generator.py:6