tidy terma profile plot
"metadata": {},
"outputs": [],
"source": [
- "def terma_profile_at_depth(depth):\n",
+ "def terma_profile_at_depth(x_i, depth):\n",
" terma = [\n",
" get_scaled_spectrum_terma([depth], x_val)[0]\n",
- " for depth, x_val in zip(get_distance_to_surface(depth), radial_fluence_x)\n",
+ " for depth, x_val in zip(get_distance_to_surface(depth), x_i)\n",
" ]\n",
" \n",
" return terma\n",
"\n",
+ "x_i = np.linspace(0, 170)\n",
"\n",
"# Approximate half profile of TERMA at 10 cm depth\n",
- "plt.plot(radial_fluence_x, terma_profile_at_depth(100))"
+ "plt.plot(x_i, terma_profile_at_depth(x_i, 100))"
]
},
{
"metadata": {},
"outputs": [],
"source": [
- "for depth in [0, 20, 50, 100, 200, 400]:\n",
- " plt.plot(radial_fluence_x, terma_profile_at_depth(depth), label=\"depth = {} mm\".format(depth))\n",
+ "fig = plt.figure()\n",
+ "ax = plt.subplot(111)\n",
"\n",
- "plt.legend()"
+ "for depth in np.arange(0, 225, 25):\n",
+ " terma = terma_profile_at_depth(x_i, depth)\n",
+ " ax.plot(\n",
+ " np.concatenate([-x_i[-1::-1], x_i]), \n",
+ " np.concatenate([terma[-1::-1], terma]), \n",
+ " label=\"depth = {} mm\".format(depth))\n",
+ " \n",
+ "\n",
+ "box = ax.get_position()\n",
+ "ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])\n",
+ "ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
