Skip to content

Commit

Permalink
1.4.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kklmn committed Feb 20, 2023
1 parent eebcde1 commit c5b87fc
Show file tree
Hide file tree
Showing 36 changed files with 1,201 additions and 33,919 deletions.
24 changes: 14 additions & 10 deletions XAFSmass/XAFSmassCalc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
__author__ = "Konstantin Klementiev, Roman Chernikov"
__date__ = "17 Aug 2015"
__date__ = "20 Feb 2023"

from math import log10, floor
import itertools
Expand Down Expand Up @@ -84,9 +84,9 @@ def sum_by_element(tokens):
dopewtPercentsSum = sum(dopewtPercents)
for dg, m, wt in zip(dopeGroups, dopeUnitMasses, dopewtPercents):
if wt > 0: # without 'x' or 'y'
# Ni%1Rh%1((SiO2)%10Al2O3)
# Ni%1Rh%1(Al2O3)
# (Si0.8Er0.2O2)%10Al2O3
# Ni%1Rh%1((SiO2)%10Al2O3)
# Ni%1Rh%1(Al2O3)
# (Si0.8Er0.2O2)%10Al2O3
dopeMass = matrixMass * wt / (100. - dopewtPercentsSum)
for e in dopes:
if e[1] == dg:
Expand Down Expand Up @@ -133,9 +133,12 @@ def _simple_line(x1, x2, y1, y2):


def find_edge_step(E, element):
mask = np.abs(E - element.E) < 250 # eV
f2 = element.f2[mask]
ef2 = element.E[mask]
lenArr, dE = 0, 10
while lenArr < 2:
mask = np.abs(E - element.E) < (250 + dE) # eV
f2 = element.f2[mask]
ef2 = element.E[mask]
lenArr = len(ef2)
df2 = np.diff(f2)
dSigma2 = 0
f2jump = 0
Expand All @@ -148,7 +151,8 @@ def find_edge_step(E, element):
ef2jump = ef2[iEdge+1]
dSigma2 = f2jump * crossSection / ef2jump
sigma2x = f2[iEdge+1] * crossSection / ef2jump
except IndexError:
except IndexError as e:
print(e)
pass
return dSigma2, f2jump, sigma2x

Expand Down Expand Up @@ -206,7 +210,7 @@ def calculate_powder(formulaList, E, muTd, area=None, rho=None,
el.append(muTd / sumSigma2 * el[2] * el[3]) # jump

if area:
return nu*1e3, mass, thickness, elementsDict
return nu*1e3, mass, thickness, elementsDict
else:
return thickness, elementsDict

Expand Down Expand Up @@ -256,7 +260,7 @@ def calculate_x(formulaList, E, muTd, Deltamud, deltamud=None,


def test_formula():
tests = """\
tests = """
H
NaCl
HO
Expand Down
8 changes: 4 additions & 4 deletions XAFSmass/XAFSmassQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
except ImportError:
from matplotlib.backends import qt4_compat
qt_compat = qt4_compat
use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE
use_pyside = qt_compat.QT_API.startswith("PySide")
if use_pyside:
QtName = "PySide"
import PySide
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__(self, parent=None, width=5, height=0.4):
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.updateGeometry()
fm = QtGui.QFontMetrics(self.font())
self.fontsize = int(fm.height()) / 1.25
self.fontsize = int(fm.height()) / 1.33
self.setStyleSheet("background-color:transparent;")

def update_formula(self, formula=None):
Expand All @@ -133,7 +133,7 @@ def __init__(self, parent=None, width=6, height=5):
self.setParent(parent)
self.updateGeometry()
fm = QtGui.QFontMetrics(self.font())
self.fontsize = int(fm.height()) / 1.25
self.fontsize = int(fm.height()) / 1.33

def plot(self, compound, E, table):
self.axes.cla()
Expand Down Expand Up @@ -176,7 +176,7 @@ def __init__(self, parent, compound, E, table):
pg = parent.frameGeometry()
self.move(parent.x()+pg.width(), parent.y())
pg = parent.geometry()
self.resize(pg.width()*1.5, pg.height())
self.resize(int(pg.width()*1.5), int(pg.height()))
self.setWindowTitle("plots of f''")
self.setWindowFlags(QtCore.Qt.Window)
self.show()
Expand Down
18 changes: 9 additions & 9 deletions XAFSmass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@
offers the edge positions plus 50 eV. You are free to specify any energy
within the range of the selected tabulation.
A typical application is the calculation of the mass for a powder sample. The
optimal *optical* sample thickness μd depends on the absorption levels selected
for the ionization chambers (see below). Typically, μd is between 2 and 3 (e.g.
for a 17.4% absorption level for the 1st chamber and a 50% level for the 2nd
chamber, the optimal thickness is 2.42). However, if you get the absorption
step more that 1.5 (reported by the drop-down list "absorptance step = "), it
is recommended to reduce the sample mass to avoid the potential thickness
The most typical application is the calculation of the mass of a powder sample.
The optimal *optical* sample thickness μd depends on the absorption levels
selected for the ionization chambers (see below). Typically, μd is between 2
and 3 (e.g. for a 17.4% absorption level for the 1st chamber and a 50% level
for the 2nd chamber, the optimal thickness is 2.42). However, if you get the
absorption step > 1.5 (reported by the drop-down list "absorptance step = "),
it is recommended to reduce the sample mass to avoid the potential thickness
effect due to possible inhomogeneity in the wafer. If your sample is diluted
and you get a very low absorption step, do not try to make the wafer thicker
hoping that you will get better spectra -- you will not: the optimal thickness
Expand Down Expand Up @@ -195,12 +195,12 @@
"""
__module__ = "XAFSmass"
__versioninfo__ = (1, 3, 9)
__versioninfo__ = (1, 4, 2)
__version__ = '.'.join(map(str, __versioninfo__))
__author__ = \
"Konstantin Klementiev (MAX IV Laboratory), " +\
"Roman Chernikov (Canadian Light Source)"
__email__ = \
"[email protected], [email protected]"
__date__ = "09 Jul 2019"
__date__ = "20 Feb 2023"
__license__ = "MIT license"
Binary file removed XAFSmass/help/_static/ajax-loader.gif
Binary file not shown.
Loading

0 comments on commit c5b87fc

Please sign in to comment.