Gate的Phantom获取
Posted nuaazs
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gate的Phantom获取相关的知识,希望对你有一定的参考价值。
1. 文件说明
│ acquisition.mac
│ CTScanner.mac
│ GateMaterials.db
│ GateMaterialsGPU.db
│ getphantom.py
│ macs.py
│ output.mac
│ phantom.mac
│ phantom_box.mac
│ phantom_config.txt
│ physics.mac
│ source_140keV.mac
│ source_70keV.mac
│ verbose.mac
│ visu.mac
│ README.md
└─square
CTScanner_square.mac
source_140keV_square.mac
source_70keV_square.mac
2. 获取Phantom文件
from random import shuffle
organs = ["Spleen","Muscle","SpineBone","Blood","Heart","Kidney","Breast","Liver","Lymph","Pancreas","Skull","Intestine","Cartilage","Brain","Testis","Hypodermis","Water","Air"]
# 氢 # 碳 # 氮 # 氧 # 钠 # 磷 # 硫 # 氯 # 钾
Hydrogen = [0.103, 0.102, 0.063, 0.102, 0.104, 0.103, 0.5270, 0.102, 0.108, 0.106, 0.05, 0.106, 0.096, 0.107, 0.106000, 0.120, 0.111, 0.000 ]
Carbon = [0.113, 0.143, 0.261, 0.11, 0.139, 0.132, 0.3320, 0.139, 0.041, 0.169, 0.212, 0.115, 0.099, 0.145, 0.099000, 0.640, 0.000, 0.000124]
Nitrogen = [0.032, 0.034, 0.039, 0.033, 0.029, 0.03, 0.1060, 0.03, 0.011, 0.022, 0.04, 0.022, 0.022, 0.022, 0.020000, 0.008, 0.000, 0.755268]
Oxygen = [0.741, 0.71, 0.436, 0.745, 0.718, 0.724, 0.0300, 0.716, 0.832, 0.694, 0.435, 0.751, 0.744, 0.712, 0.766000, 0.229, 0.899, 0.231781]
Sodium = [0.001, 0.001, 0.001, 0.001, 0.001, 0.002, 0.0020, 0.002, 0.003, 0.002, 0.001, 0.001, 0.005, 0.002, 0.002000, 0.000, 0.000, 0.000 ]
Phosphor = [0.003, 0.002, 0.061, 0.001, 0.002, 0.002, 0.0010, 0.003, 0.00, 0.002, 0.081, 0.001, 0.022, 0.004, 0.001000, 0.002, 0.000, 0.000 ]
Sulfur = [0.002, 0.003, 0.003, 0.002, 0.002, 0.002, 0.0010, 0.003, 0.001, 0.001, 0.003, 0.001, 0.009, 0.002, 0.002000, 0.000, 0.000, 0.000 ]
Chlorine = [0.002, 0.001, 0.001, 0.003, 0.002, 0.002, 0.0010, 0.002, 0.004, 0.002, 0.00, 0.002, 0.003, 0.003, 0.002000, 0.000, 0.000, 0.000 ]
Potassium = [0.003, 0.004, 0.001, 0.002, 0.003, 0.002, 0, 0.003, 0.0, 0.002, 0.00, 0.001, 0.000, 0.003, 0.002000, 0.000, 0.000, 0.000 ]
file = open("phantom_config.txt","w")
text = """
##################
# Water Cylinder #
##################
/gate/world/daughters/name waterCylinder
/gate/world/daughters/insert cylinder
/gate/waterCylinder/geometry/setRmin 0. mm
/gate/waterCylinder/geometry/setRmax 35. mm
/gate/waterCylinder/geometry/setHeight 12. mm
/gate/waterCylinder/placement/setRotationAxis 1 0 0
/gate/waterCylinder/placement/setRotationAngle 90. deg
/gate/waterCylinder/setMaterial Air
###################
#Ball #1
###################
/gate/waterCylinder/daughters/name ball1
/gate/waterCylinder/daughters/insert sphere
/gate/ball1/placement/setTranslation 20.0 0. 0. mm
/gate/ball1/geometry/setRmin 0. mm
/gate/ball1/geometry/setRmax 3. mm
/gate/ball1/setMaterial {0}
###################
#Ball #2
###################
/gate/waterCylinder/daughters/name ball2
/gate/waterCylinder/daughters/insert sphere
/gate/ball2/placement/setTranslation 16.18 11.76 0. mm
/gate/ball2/geometry/setRmin 0. mm
/gate/ball2/geometry/setRmax 3.3 mm
/gate/ball2/setMaterial {1}
###################
#Ball #3
###################
/gate/waterCylinder/daughters/name ball3
/gate/waterCylinder/daughters/insert sphere
/gate/ball3/placement/setTranslation 6.18 19.02 0. mm
/gate/ball3/geometry/setRmin 0. mm
/gate/ball3/geometry/setRmax 3.6 mm
/gate/ball3/setMaterial {2}
###################
#Ball #4
###################
/gate/waterCylinder/daughters/name ball4
/gate/waterCylinder/daughters/insert sphere
/gate/ball4/placement/setTranslation -6.18 19.02 0. mm
/gate/ball4/geometry/setRmin 0. mm
/gate/ball4/geometry/setRmax 4.0 mm
/gate/ball4/setMaterial {3}
###################
#Ball #5
###################
/gate/waterCylinder/daughters/name ball5
/gate/waterCylinder/daughters/insert sphere
/gate/ball5/placement/setTranslation -16.18 11.76 0. mm
/gate/ball5/geometry/setRmin 0. mm
/gate/ball5/geometry/setRmax 4.3 mm
/gate/ball5/setMaterial {4}
###################
#Ball #6
###################
/gate/waterCylinder/daughters/name ball6
/gate/waterCylinder/daughters/insert sphere
/gate/ball6/placement/setTranslation -20.0 0. 0. mm
/gate/ball6/geometry/setRmin 0. mm
/gate/ball6/geometry/setRmax 4.6 mm
/gate/ball6/setMaterial {5}
###################
#Ball #7
###################
/gate/waterCylinder/daughters/name ball7
/gate/waterCylinder/daughters/insert sphere
/gate/ball7/placement/setTranslation -16.18 -11.76 0. mm
/gate/ball7/geometry/setRmin 0. mm
/gate/ball7/geometry/setRmax 5. mm
/gate/ball7/setMaterial {6}
###################
#Ball #8
###################
/gate/waterCylinder/daughters/name ball8
/gate/waterCylinder/daughters/insert sphere
/gate/ball8/placement/setTranslation -6.18 -19.02 0. mm
/gate/ball8/geometry/setRmin 0. mm
/gate/ball8/geometry/setRmax 5.3 mm
/gate/ball8/setMaterial {7}
###################
#Ball #9
###################
/gate/waterCylinder/daughters/name ball9
/gate/waterCylinder/daughters/insert sphere
/gate/ball9/placement/setTranslation 6.18 -19.02 0. mm
/gate/ball9/geometry/setRmin 0. mm
/gate/ball9/geometry/setRmax 5.6 mm
/gate/ball9/setMaterial {8}
###################
#Ball #10
###################
/gate/waterCylinder/daughters/name ball10
/gate/waterCylinder/daughters/insert sphere
/gate/ball10/placement/setTranslation 16.18 -11.76 0. mm
/gate/ball10/geometry/setRmin 0. mm
/gate/ball10/geometry/setRmax 6.0 mm
/gate/ball10/setMaterial {9}
"""
for i in range(50000):
shuffle(organs) #打乱
#print(organs)
#写入 phantom_config.txt
for organ in organs[:11]:
file.write(organ+",")
file.write("\\n")
out = text.format(organs[0],organs[1],organs[2],organs[3],organs[4],organs[5],organs[6],organs[7],organs[8],organs[9])
#生成mac文件
file2 = open(str(i)+".mac","w")
file2.write(out)
file2.write("\\n")
file2.close()
file.close()
以上是关于Gate的Phantom获取的主要内容,如果未能解决你的问题,请参考以下文章
使用 javascript 异步函数通过 json-rpc 请求获取 Phantom 钱包余额的问题?
如何通过 Phantom 钱包集成使用 Vanilla JS 和 JSON-RPC 获取 Solana 帐户信息和/或 SOL 余额?