LSST Applications g0f08755f38+82efc23009,g12f32b3c4e+e7bdf1200e,g1653933729+a8ce1bb630,g1a0ca8cf93+50eff2b06f,g28da252d5a+52db39f6a5,g2bbee38e9b+37c5a29d61,g2bc492864f+37c5a29d61,g2cdde0e794+c05ff076ad,g3156d2b45e+41e33cbcdc,g347aa1857d+37c5a29d61,g35bb328faa+a8ce1bb630,g3a166c0a6a+37c5a29d61,g3e281a1b8c+fb992f5633,g414038480c+7f03dfc1b0,g41af890bb2+11b950c980,g5fbc88fb19+17cd334064,g6b1c1869cb+12dd639c9a,g781aacb6e4+a8ce1bb630,g80478fca09+72e9651da0,g82479be7b0+04c31367b4,g858d7b2824+82efc23009,g9125e01d80+a8ce1bb630,g9726552aa6+8047e3811d,ga5288a1d22+e532dc0a0b,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+37c5a29d61,gcf0d15dbbd+2acd6d4d48,gd7358e8bfb+778a810b6e,gda3e153d99+82efc23009,gda6a2b7d83+2acd6d4d48,gdaeeff99f8+1711a396fd,ge2409df99d+6b12de1076,ge79ae78c31+37c5a29d61,gf0baf85859+d0a5978c5a,gf3967379c6+4954f8c433,gfb92a5be7c+82efc23009,gfec2e1e490+2aaed99252,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
generator.py
Go to the documentation of this file.
1from ._shapeletLib 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