File indexing completed on 2026-04-10 07:50:29
0001
0002 """
0003 U4TreeTest.py
0004 =================
0005
0006
0007 Dumping siblings which all have same parent::
0008
0009 n[np.where( n[:,3] == 65724 )[0]]
0010
0011
0012 In [7]: n[np.where( n[:,3] == 65724 )[0]]
0013 Out[7]:
0014 array([[ 65725, 4, 0, 65724, 0, -1, 65726, 18],
0015 [ 65726, 4, 1, 65724, 0, -1, 65727, 18],
0016 [ 65727, 4, 2, 65724, 0, -1, 65728, 18],
0017 [ 65728, 4, 3, 65724, 0, -1, 65729, 18],
0018 [ 65729, 4, 4, 65724, 0, -1, 65730, 18],
0019 ...,
0020 [336623, 4, 4516, 65724, 2, 336624, 336629, 134],
0021 [336629, 4, 4517, 65724, 2, 336630, 336635, 134],
0022 [336635, 4, 4518, 65724, 2, 336636, 336641, 134],
0023 [336641, 4, 4519, 65724, 2, 336642, 336647, 134],
0024 [336647, 4, 4520, 65724, 2, 336648, -1, 134]], dtype=int32)
0025
0026 In [8]: n[np.where( n[:,3] == 65724 )[0]][:,-1]
0027 Out[8]: array([ 18, 18, 18, 18, 18, ..., 134, 134, 134, 134, 134], dtype=int32)
0028
0029 In [9]: np.unique(n[np.where( n[:,3] == 65724 )[0]][:,-1], return_counts=True)
0030 Out[9]:
0031 (array([ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
0032 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 128, 134], dtype=int32),
0033 array([ 10, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 10, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
0034 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
0035 30, 30, 30, 30, 30, 30, 30, 30, 1, 2400]))
0036
0037 In [10]: s[18]
0038 Out[10]: 'GLw1.up10_up11_FlangeI_Web_FlangeII0x57931d0'
0039
0040 In [11]: s[19]
0041 Out[11]: 'GLw1.up09_up10_FlangeI_Web_FlangeII0x5794550'
0042
0043 In [12]: s[89]
0044 Out[12]: 'ZC2.A05_A05_FlangeI_Web_FlangeII0x57c3d70'
0045
0046 In [13]: s[128]
0047 Out[13]: 'sReflectorInCD0x58289b0'
0048
0049 In [14]: s[134]
0050 Out[14]: 'mask_PMT_20inch_vetosMask_virtual0x5f62e40'
0051
0052
0053 """
0054
0055 import numpy as np
0056 from opticks.ana.fold import Fold
0057
0058
0059 if __name__ == '__main__':
0060 t = Fold.Load()
0061 print(repr(t))
0062 print("index, depth, sibdex, parent, num_child, first_child, next_sibling, lvid ")
0063
0064 n = t.nds
0065 s = t.soname
0066
0067
0068