Skip to content

Commit

Permalink
fix: handle units
Browse files Browse the repository at this point in the history
  • Loading branch information
jokasimr committed Sep 23, 2024
1 parent 00e6738 commit a1d7079
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/scippneutron/absorption/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ class Material:
effective_sample_number_density: sc.Variable

def attenuation_coefficient(self, wavelength):
return (
self.effective_sample_number_density
* (
self.scattering_cross_section
+ self.attenuation_cross_section
'''Computes marginal attenuation per distance for
the given neutron wavelength.'''
return self.effective_sample_number_density * (
self.scattering_cross_section
+ (
self.attenuation_cross_section
* (
wavelength
/ sc.scalar(1.7982, unit='angstrom').to(unit=wavelength.unit)
)
)
).to(unit='1/cm')
).to(unit=self.scatter_cross_section.unit)
)

0 comments on commit a1d7079

Please sign in to comment.