pcdshub / pcdscalc

PCDS control system-agnostic scientific calculation routines
Other
0 stars 6 forks source link

Darwin width #25

Closed vespos closed 1 year ago

vespos commented 1 year ago

Description

Port the Darwin Width and transmission calculation from the old python

Motivation and Context

Requested by the scientists. This will make them less dependent on the old python.

How Has This Been Tested?

Tested by comparing results of calculation to the old python results. Good to the 6-8 decimal: New:

In [3]: x.transmission('Si', 500e-6, 35000, compton=True)
Out[3]: 0.9039325738447298

In [4]: x.transmission('Si', 500e-6, 35000, compton=False)
Out[4]: 0.9201090484977262

In [11]: diff.darwin_width('C*', (1,1,1), 7000)
Out[11]: 0.002458394378392471

In [5]: diff.darwin_width('Si', (4,4,0), 12000)
Out[5]: 0.0005175295012206108

Old:

XPP NEW In [53]: Transmission('Si', 500e-6, 35000)
XPP NEW Out[53]: 0.90393261177076734

XPP NEW In [54]: Transmission_noCompton('Si', 500e-6, 35000)
XPP NEW Out[54]: 0.92010908791770818

XPP NEW In [55]: DarwinWidth('C*', (1,1,1), 7000)
XPP NEW Out[55]: 0.0024583942238442626

XPP NEW In [56]: DarwinWidth('Si', (4,4,0), 12000)
XPP NEW Out[56]: 0.00051752946854897292

Where Has This Been Documented?

Docstring

vespos commented 1 year ago

I actually going to add the transmission calculation as well. Incoming soon

ZLLentz commented 1 year ago

Seems like xraylib simply is not pip-installable right now on python 3.11, despite being compatible and working in conda. Let's ignore that build for the time being, all the other builds are healthy.

vespos commented 1 year ago

Oh I overlooked the unittest comment, sorry. I will do that in a separate PR, as to get these changes into the next release