Skip to content

Error returned when extrapolating cross section values #204

Closed
@keeble

Description

@keeble

Hi Tom, hope you're well.

I'm updating some dependencies and found an issue with calculating cross section data for low energies. The error resembles #187 in that it's related to extrapolation of the source data. I have seen this affecting CS_Photo, CS_Compt, CS_Rayl, and their various children CS_Total, *_CP etc.

Using the python bindings, version 3.3.0 gave:

>>> import xraylib
>>> xraylib.__version__
'3.3.0'
>>> xraylib.CS_Photo(10, 0.01)
119431.70730436413

and with the up-to-date version:

>>> import xraylib
>>> xraylib.__version__
'4.1.2'
>>> xraylib.CS_Photo(10, 0.01)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/scratch/xraylib/env/lib/python3.10/site-packages/xraylib.py", line 2252, in CS_Photo
    return _xraylib.CS_Photo(*args)
ValueError: Spline extrapolation is not allowed

For #187 the fix appears to be linear ln-ln extrapolation from the lowest 2 energies. I'm happy to put in a PR to apply a similar fix to these 3 functions, but I'm not 100% sure whether this is physically meaningful in this case; or whether it's preferable to just return the lowest value in the source data. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions