1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-22 18:28:51 -05:00
This commit is contained in:
hrocho 2022-03-23 15:41:03 +01:00
parent 2dbab43646
commit 8e0140a140

View File

@ -1,375 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "fb77d2c3-50ab-4df4-8a84-9df4f830e1a6",
"metadata": {},
"outputs": [],
"source": [
"import pycatima as catima"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "fddd4482-ab09-4b9b-9a22-c16765d97e07",
"metadata": {},
"outputs": [],
"source": [
"p = catima.Projectile(11.9967 ,6) "
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "22685960-8bee-4b0a-a527-020cbb8cb55f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<pycatima.Projectile at 0x7f071c5879f0>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"p"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "d908af17-0b14-437a-ab44-55f03ace6ddd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11.9967"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"p.A()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "439992b6-44c2-4874-853a-38c32698c8b1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"p.T()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "6987ad92-786d-4e72-af63-b96d30734b56",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<pycatima.Material at 0x7f071c125d70>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c_mat = catima.get_material(6)\n",
"c_mat.thickness(0.1) # set to 0.1g/cm2 \n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "5638c740-bdae-4058-b8d8-e85559f7f711",
"metadata": {},
"outputs": [],
"source": [
"water = catima.get_material(catima.material.Water)\n",
"water.thickness(1.0)\n",
"p = catima.Projectile(1,1)\n",
"p.T(1000) # set projectile energy to 1000MeV/u\n",
"\n",
"res = catima.calculate(p,water) # now res contains results\n",
"d = res.get_dict() # get results as dictionary"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "ceed5bed-8fb9-486b-b6d5-684ab76a0cb2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'Ein': 1000.0, 'Eout': 997.7692418128505, 'Eloss': 2.2307581871494904, 'range': 323.0500169119558, 'dEdxi': 2.230252029979203, 'dEdxo': 2.2312658737371893, 'sigma_E': 0.4816776588879672, 'sigma_r': 2.8385797234616956, 'sigma_a': 0.0015850149758312381, 'sigma_x': 0.0009146866917885723, 'tof': 0.03808365330973146, 'sp': 0.9857382500219312}"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "f491da2d-52f0-40d0-af1c-5b4ebf3f0098",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'Ein': 1000.0,\n",
" 'Eout': 997.7692418128505,\n",
" 'Eloss': 2.2307581871494904,\n",
" 'range': 323.0500169119558,\n",
" 'dEdxi': 2.230252029979203,\n",
" 'dEdxo': 2.2312658737371893,\n",
" 'sigma_E': 0.4816776588879672,\n",
" 'sigma_r': 2.8385797234616956,\n",
" 'sigma_a': 0.0015850149758312381,\n",
" 'sigma_x': 0.0009146866917885723,\n",
" 'tof': 0.03808365330973146,\n",
" 'sp': 0.9857382500219312}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "5f83c7a6-7866-4eab-ad86-4107e751449c",
"metadata": {},
"outputs": [],
"source": [
"layers = catima.Layers()\n",
"\n",
"# define some materials\n",
"graphite = catima.get_material(6)\n",
"graphite.thickness(0.2)\n",
"p10 = catima.get_material(catima.material.P10)\n",
"p10.thickness_cm(2.0)\n",
"air = catima.get_material(catima.material.Air)\n",
"air.thickness_cm(2.0)\n",
"\n",
"# now add materials to layers\n",
"layers.add(graphite)\n",
"layers.add(air)\n",
"graphite.thickness(0.1) # change thickness for next layer\n",
"layers.add(graphite)\n",
"layers.add(p10)\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "02c81c5a-1242-4f03-962b-cef69aeaad99",
"metadata": {},
"outputs": [],
"source": [
"res = catima.calculate(p(1000),layers)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "ccb350dd-8d1f-407a-8f9a-d53de42fc654",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'result': {'Ein': 1000.0, 'Eout': 999.4113223554237, 'Eloss': 0.5886776445762507, 'range': 0.0, 'dEdxi': 0.0, 'dEdxo': 0.0, 'sigma_E': 0.25258015892534263, 'sigma_r': 0.0, 'sigma_a': 0.0008105438781825326, 'sigma_x': 0.0028414668152919806, 'tof': 0.15803112260593277, 'sp': 0.9960612923096187}, 'partial': [{'Ein': 1000.0, 'Eout': 999.6144088178809, 'Eloss': 0.38559118211912846, 'range': 370.34107871008774, 'dEdxi': 1.9279559105959254, 'dEdxo': 1.9281222645760208, 'sigma_E': 0.2043916761400348, 'sigma_r': 3.320054098523407, 'sigma_a': 0.0006511083630327794, 'sigma_x': 3.7589642138821556e-05, 'tof': 0.0038076499236034604, 'sp': 0.9973943311229859}, {'Ein': 999.6144088178809, 'Eout': 999.6096791284646, 'Eloss': 0.004729689416308247, 'range': 367.54726599902557, 'dEdxi': 1.9625267287729011, 'dEdxo': 1.9625285937327144, 'sigma_E': 0.022426056181820767, 'sigma_r': 3.2641418575527372, 'sigma_a': 7.719573732472228e-05, 'sigma_x': 8.91381137967358e-05, 'tof': 0.07615857885144703, 'sp': 0.9999704176008014}, {'Ein': 999.6096791284646, 'Eout': 999.4168666978572, 'Eloss': 0.19281243060731867, 'range': 370.13863433517764, 'dEdxi': 1.9281243060736846, 'dEdxo': 1.9282075509751584, 'sigma_E': 0.14450724143913393, 'sigma_r': 3.318340585835106, 'sigma_a': 0.00046052059024485003, 'sigma_x': 1.3293727874383622e-05, 'tof': 0.0019039537532974601, 'sp': 0.9986963076302396}, {'Ein': 999.4168666978572, 'Eout': 999.4113223554237, 'Eloss': 0.005544342433495331, 'range': 434.2162832834797, 'dEdxi': 1.6699826606974904, 'dEdxo': 1.6699844480490684, 'sigma_E': 0.025209295571279575, 'sigma_r': 3.9998174793027084, 'sigma_a': 0.00012247808843781765, 'sigma_x': 0.0001414257590907637, 'tof': 0.07616094007758482, 'sp': 0.9999967104714518}]}"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "82bcd70b-6eed-4406-94a7-e1f0c5102fdd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'result': {'Ein': 1000.0,\n",
" 'Eout': 999.4113223554237,\n",
" 'Eloss': 0.5886776445762507,\n",
" 'range': 0.0,\n",
" 'dEdxi': 0.0,\n",
" 'dEdxo': 0.0,\n",
" 'sigma_E': 0.25258015892534263,\n",
" 'sigma_r': 0.0,\n",
" 'sigma_a': 0.0008105438781825326,\n",
" 'sigma_x': 0.0028414668152919806,\n",
" 'tof': 0.15803112260593277,\n",
" 'sp': 0.9960612923096187},\n",
" 'partial': [{'Ein': 1000.0,\n",
" 'Eout': 999.6144088178809,\n",
" 'Eloss': 0.38559118211912846,\n",
" 'range': 370.34107871008774,\n",
" 'dEdxi': 1.9279559105959254,\n",
" 'dEdxo': 1.9281222645760208,\n",
" 'sigma_E': 0.2043916761400348,\n",
" 'sigma_r': 3.320054098523407,\n",
" 'sigma_a': 0.0006511083630327794,\n",
" 'sigma_x': 3.7589642138821556e-05,\n",
" 'tof': 0.0038076499236034604,\n",
" 'sp': 0.9973943311229859},\n",
" {'Ein': 999.6144088178809,\n",
" 'Eout': 999.6096791284646,\n",
" 'Eloss': 0.004729689416308247,\n",
" 'range': 367.54726599902557,\n",
" 'dEdxi': 1.9625267287729011,\n",
" 'dEdxo': 1.9625285937327144,\n",
" 'sigma_E': 0.022426056181820767,\n",
" 'sigma_r': 3.2641418575527372,\n",
" 'sigma_a': 7.719573732472228e-05,\n",
" 'sigma_x': 8.91381137967358e-05,\n",
" 'tof': 0.07615857885144703,\n",
" 'sp': 0.9999704176008014},\n",
" {'Ein': 999.6096791284646,\n",
" 'Eout': 999.4168666978572,\n",
" 'Eloss': 0.19281243060731867,\n",
" 'range': 370.13863433517764,\n",
" 'dEdxi': 1.9281243060736846,\n",
" 'dEdxo': 1.9282075509751584,\n",
" 'sigma_E': 0.14450724143913393,\n",
" 'sigma_r': 3.318340585835106,\n",
" 'sigma_a': 0.00046052059024485003,\n",
" 'sigma_x': 1.3293727874383622e-05,\n",
" 'tof': 0.0019039537532974601,\n",
" 'sp': 0.9986963076302396},\n",
" {'Ein': 999.4168666978572,\n",
" 'Eout': 999.4113223554237,\n",
" 'Eloss': 0.005544342433495331,\n",
" 'range': 434.2162832834797,\n",
" 'dEdxi': 1.6699826606974904,\n",
" 'dEdxo': 1.6699844480490684,\n",
" 'sigma_E': 0.025209295571279575,\n",
" 'sigma_r': 3.9998174793027084,\n",
" 'sigma_a': 0.00012247808843781765,\n",
" 'sigma_x': 0.0001414257590907637,\n",
" 'tof': 0.07616094007758482,\n",
" 'sp': 0.9999967104714518}]}"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res.get_dict()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "030baf84-745f-41dc-bcec-a5d5d9455974",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'Ein': 1000.0,\n",
" 'Eout': 997.7692418128505,\n",
" 'Eloss': 2.2307581871494904,\n",
" 'range': 323.0500169119558,\n",
" 'dEdxi': 2.230252029979203,\n",
" 'dEdxo': 2.2312658737371893,\n",
" 'sigma_E': 0.4816776588879672,\n",
" 'sigma_r': 2.8385797234616956,\n",
" 'sigma_a': 0.0015850149758312381,\n",
" 'sigma_x': 0.0009146866917885723,\n",
" 'tof': 0.03808365330973146,\n",
" 'sp': 0.9857382500219312}"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5448c9a5-db62-4c0c-8718-8213235b1b3a",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}