Module rpps.viz.rt.matrix
Functions
def cdot(x, y, psds, yt=0.05, yb=0.05)-
Expand source code
def cdot(x, y, psds, yt=0.05, yb=0.05): hist, (amp_min, amp_max) = dot(x, y, psds, yt, yb) return _fill(hist), (amp_min, amp_max) def cvec(x, y, psds, yt=0.05, yb=0.05, interp=10)-
Expand source code
def cvec(x, y, psds, yt=0.05, yb=0.05, interp=10): hist, (amp_min, amp_max) = vec(x, y, psds, yt, yb, interp) return _fill(hist), (amp_min, amp_max) def dot(x, y, psds, yt=0.05, yb=0.05)-
Expand source code
def dot(x, y, psds, yt=0.05, yb=0.05): """Dot Matrix Each PSD's x/y mapped to histogram x/y """ hist = np.zeros((y, x), dtype=np.int8) amp_min, amp_max = np.min(psds), np.max(psds) amp_min = amp_min*(1+yb) if amp_min < 0 else amp_min*(1-yb) amp_max = amp_max*(1-yt) if amp_max < 0 else amp_max*(1+yt) amp_rng = abs(abs(amp_max) - abs(amp_min)) amp_off = amp_min if amp_min > 0 else -amp_min x_ratio = x/psds.shape[0] y_ratio = y/amp_rng x_idx = np.floor(np.arange(0, psds.shape[0])*x_ratio).astype(int) y_idx = np.floor((psds+amp_off)*y_ratio).astype(int) for i in range(psds.shape[1]): hist[y_idx[:,i], x_idx] += 1 return hist, (amp_min, amp_max)Dot Matrix Each PSD's x/y mapped to histogram x/y
def sdot(x, y, psds, yt=0.05, yb=0.05)-
Expand source code
def sdot(x, y, psds, yt=0.05, yb=0.05): """(Slow) Dot Matrix Map each PSD to the matrix, then merge each matrix """ mats, (amp_min, amp_max) = _matrix_dot(x, y, psds, yt=0.05, yb=0.05) return _merge(mats), (amp_min, amp_max)(Slow) Dot Matrix Map each PSD to the matrix, then merge each matrix
def svec(x, y, psds, yt=0.05, yb=0.05)-
Expand source code
def svec(x, y, psds, yt=0.05, yb=0.05): """(Slow) Vector Matrix On each matrix, insert 1s between x-1's y and x's y """ mats, (amp_min, amp_max) = _matrix_dot(x, y, psds, yt=0.05, yb=0.05) for i in range(mats.shape[0]): mats[i] = dot_vector(mats[i]) return _merge(mats), (amp_min, amp_max)(Slow) Vector Matrix On each matrix, insert 1s between x-1's y and x's y
def vec(x, y, psds, yt=0.05, yb=0.05, interp=32)-
Expand source code
def vec(x, y, psds, yt=0.05, yb=0.05, interp=32): """Vector Matrix Interpolate between PSD x/y to mimic vector matrix """ y_int = np.zeros((psds.shape[0]*interp, psds.shape[1])) t = np.arange(psds.shape[0])*interp t_int = np.arange(psds.shape[0]*interp)-1 for i in range(psds.shape[1]): y_int[:,i] = np.interp(t_int, t, psds[:,i]) return dot(x, y, y_int, yt, yb)Vector Matrix Interpolate between PSD x/y to mimic vector matrix