File indexing completed on 2026-04-09 07:49:23
0001
0002 """
0003 stree_sensor_test.py
0004 ======================
0005
0006 Count the repeat_index nodes, checking consistent with product of instance count
0007 and subtree nodes within each instance::
0008
0009 In [4]: np.unique( st.nds.repeat_index, return_counts=True )
0010 Out[4]:
0011 (array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=int32),
0012 array([ 3089, 128000, 88305, 34979, 14400, 590, 590, 590, 590, 65520]))
0013
0014 In [7]: st.f.factor[:,:4]
0015 Out[7]:
0016 array([[ 0, 25600, 25600, 5],
0017 [ 1, 12615, 12615, 7],
0018 [ 2, 4997, 4997, 7],
0019 [ 3, 2400, 2400, 6],
0020 [ 4, 590, 0, 1],
0021 [ 5, 590, 0, 1],
0022 [ 6, 590, 0, 1],
0023 [ 7, 590, 0, 1],
0024 [ 8, 504, 0, 130]], dtype=int32)
0025
0026 In [10]: np.c_[st.f.factor[:,:4], st.f.factor[:,1]*st.f.factor[:,3]]
0027 Out[10]:
0028 array([[ 0, 25600, 25600, 5, 128000],
0029 [ 1, 12615, 12615, 7, 88305],
0030 [ 2, 4997, 4997, 7, 34979],
0031 [ 3, 2400, 2400, 6, 14400],
0032 [ 4, 590, 0, 1, 590],
0033 [ 5, 590, 0, 1, 590],
0034 [ 6, 590, 0, 1, 590],
0035 [ 7, 590, 0, 1, 590],
0036 [ 8, 504, 0, 130, 65520]], dtype=int32)
0037
0038 """
0039 import numpy as np
0040 from opticks.ana.fold import Fold
0041 from opticks.sysrap.stree import stree
0042
0043 if __name__ == '__main__':
0044 f = Fold.Load("$BASE/stree", symbol="f")
0045 st = stree(f)
0046 print(repr(st))
0047 pass