@@ -231,49 +231,30 @@ def get_density_from_cloud(sample_composition, mp_token=""):
231231 )
232232
233233
234- def compute_mu_using_xraydb (
235- sample_composition , energy , sample_mass_density = None , packing_fraction = None
236- ):
234+ def compute_mu_using_xraydb (sample_composition , energy , sample_mass_density ):
237235 """Compute the attenuation coefficient (mu) using the XrayDB
238236 database.
239237
240- Computes mu based on the sample composition and energy.
241- User should provide a sample mass density or a packing fraction .
242- If neither density nor packing fraction is specified,
243- or if both are specified, a ValueError will be raised.
244- Reference: https://xraypy.github.io/XrayDB/python.html#xraydb.material_mu.
238+ Computes mu based on the sample composition, X-ray energy, and
239+ sample mass density.
240+
241+ Reference:
242+ https://xraypy.github.io/XrayDB/python.html#xraydb.material_mu
245243
246244 Parameters
247245 ----------
248246 sample_composition : str
249247 The chemical formula of the material.
250248 energy : float
251- The energy of the incident x-rays in keV.
252- sample_mass_density : float, ``optional``
253- The mass density of the packed powder/sample in g/cm*3.
254- Default is None.
255- packing_fraction : float, ``optional``
256- The fraction of sample in the capillary (between 0 and 1).
257- Specify either sample_mass_density or packing_fraction but not both.
258- Default is None.
249+ The energy of the incident X-rays in keV.
250+ sample_mass_density : float
251+ The mass density of the sample in g/cm^3.
259252
260253 Returns
261254 -------
262255 mu : float
263- The attenuation coefficient mu in mm^{-1} .
256+ The attenuation coefficient μ in mm⁻¹ .
264257 """
265- if (sample_mass_density is None and packing_fraction is None ) or (
266- sample_mass_density is not None and packing_fraction is not None
267- ):
268- raise ValueError (
269- "You must specify either sample_mass_density or packing_fraction, "
270- "but not both. "
271- "Please rerun specifying only one."
272- )
273- if packing_fraction is not None :
274- sample_mass_density = (
275- get_density_from_cloud (sample_composition ) * packing_fraction
276- )
277258 energy_eV = energy * 1000
278259 mu = (
279260 material_mu (
0 commit comments