ehsteve / roentgen

A Python package for the quantitative analysis of the interaction of x-rays with matter.
12 stars 5 forks source link

Weird transmission index for air #55

Closed pymilo closed 8 months ago

pymilo commented 9 months ago

Hi there!

When using the LBL platform to estimate the absorption of air for different energies and distances, we got the following:

http://sprg.ssl.berkeley.edu/~shilaire/ref_plots/responses/x-ray_attenuation_though_air__2.png

Trying to corroborate such curves, we found something 300 orders of magnitude different. We are using the following code:

`import numpy as np import matplotlib.pyplot as plt

import astropy.units as u from astropy.visualization import quantity_support quantity_support()

from roentgen.absorption import Material

thickness = u.Quantity(np.logspace(-2,2,100), 'm') energy = u.Quantity([1, 3, 5, 8, 10, 15, 20], 'keV') material = 'air'

for e in energy: mat = Material(material, thickness) plt.plot(thickness, mat.transmission(e), label=int(e.value))

plt.title(f"Source Optics distance") plt.ylabel('Transmission') plt.legend(loc='lower right') plt.yscale('log') plt.xscale('log') plt.show()`

Any help understanding this issue is welcome! 🤓

ehsteve commented 9 months ago

If I use your code and limit the y scale to the same scale that you used in your plot, i don't see a discrepancy though it is hard to tell by just comparing the two plots by eye. I compare the transmission curve of air specifically on the following page of the documentation cxro_compare.html and there is very little difference.

3331dbaa-7241-43ca-ac98-e7fae7d392e9 x-ray_attenuation_though_air__2

If you provide the data we could plot the two datasets on top of each other.

pymilo commented 8 months ago

Oh! I'm so dumb. Thanks, Steve, for clarifying this. Easy fix!