我有两个大词典
spTetra(Dictionary1), length = 716816 elements, form = {2803549: [-2.7790037375, -3.2795817825, 2.8985697649999995],...,2848536: [-2.5112950224999997, 5.4304198025, 3.4988885525]}
spHexa(Dictionary1), length = 25874 elements, form = {1:[...],...25842: [0.5, 5.1, 4.1],...,25872: [2.1, 5.3, 4.1]}
问题是我想考虑所有spTetra
元素,它们属于每个spHexa
元素的立方体大小,这是在所有3个方向上均为0.1维大小的立方体。为此,我在python中编写了一个脚本,将两个字典都转换为项目形式,并运行如下循环
for spH in spHexa:#The loop runs for all the elements of the CT scan mesh
insideRad=[] #insideRad consists of all the tetrahedral FOT's which fall inisde the cube volume of the CT scan
for spT in spTetra:
if abs(spH[1][0]-spT[1][0]) <= dX:
if abs(spH[1][1]-spT[1][1]) <= dY:
if abs(spH[1][2]-spT[1][2]) <= dZ:
insideRad.append(spT)
现在对于小型spTetra
字典,它可以成功运行,但是当我考虑完整模型时,则rad内部始终为空{}。有关如何成功运行此程序的任何想法?