1+ import numpy as np
2+ from numpy .linalg import pinv , eig
3+ from scipy .stats import multivariate_normal
4+ from pyrecest .distributions .cart_prod .abstract_se2_distribution import AbstractSE2Distribution
5+
6+
7+ class SE2BinghamDistribution (AbstractSE2Distribution ):
8+
9+ def __init__ (self , C1 , C2 , C3 ):
10+ self .C1 = C1
11+ self .C2 = C2
12+ self .C3 = C3
13+
14+ def computeNC (self ):
15+ # Compute normalization constant of the distribution.
16+ pass
17+
18+ def mode (self ):
19+ # Computes one of the modes of the distribution.
20+ pass
21+
22+ def sampleDeterministic (self ):
23+ # Generates deterministic samples.
24+ pass
25+
26+ def sample (self , n = 10000 ):
27+ # Samples from current distribution.
28+ pass
29+
30+ def plotState (self , scalingFactor = 1 , circleColor = None , angleColor = None , samplesForMatching = 10000 ):
31+ if circleColor is None :
32+ circleColor = np .array ([0 , 0.4470 , 0.7410 ])
33+ if angleColor is None :
34+ angleColor = np .array ([0.8500 , 0.3250 , 0.0980 ])
35+ pass
36+
37+ def getBinghamMarginal (self ):
38+ # Computes Bingham marginal of circular part.
39+ BM = self .C1 - (self .C2 .T @ pinv (self .C3 ) @ self .C2 )
40+ M , Z = eig (BM )
41+ order = np .argsort (np .diag (Z ), axis = - 1 )
42+ Z = Z - Z [2 ]
43+ M = M [:, order ]
44+ b = BinghamDistribution (Z , M )
45+ return b
46+
47+ @staticmethod
48+ def fit (samples , weights = None ):
49+ if weights is None :
50+ weights = np .ones ((1 , samples .shape [1 ])) / samples .shape [1 ]
51+ # Estimates parameters of SE2 distribution from samples.
52+ pass
0 commit comments