Skip to content

Commit

Permalink
Merge pull request #83 from Julian-Hochhaus/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Julian-Hochhaus authored Jul 19, 2023
2 parents bc93236 + 3e17ad3 commit 0857169
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 1,015 deletions.
93 changes: 0 additions & 93 deletions Python/elements.csv

This file was deleted.

67 changes: 66 additions & 1 deletion Python/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
BreitWignerModel, LognormalModel
from lmfit.models import GaussianModel, LorentzianModel, VoigtModel, PseudoVoigtModel, ThermalDistributionModel, \
PolynomialModel, StepModel
from usrmodel import ConvGaussianDoniachDublett, ConvGaussianDoniachSinglett, FermiEdgeModel, singlett, fft_convolve
from lmfitxps.models import ConvGaussianDoniachDublett, ConvGaussianDoniachSinglett, FermiEdgeModel, singlett, fft_convolve
from PyQt5 import QtWidgets, QtCore
import numpy as np
import os
Expand Down Expand Up @@ -458,3 +458,68 @@ def __init__(self, name=None, atomic_number=None, tb=None, tc=None, tcd=None, td
def cross_section():
window_cross_section = Window_CrossSection()
window_cross_section.show()
# from numpy import amax, amin
# make x and y lists (arrays) in the range between xmin and xmax
import numpy as np


def fit_range(x, y, xmin, xmax):
# print(xmin, xmax)
if xmin > xmax:
xmin0 = xmin
xmin = xmax
xmax = xmin0

if x[0] < x[-1]:
# XAS in photon energy scale or XPS in kinetic energy scale
if x[0] < xmin or xmax < x[len(x) - 1]:
if xmax < x[len(x) - 1]:
for i in range(len(x) - 1, -1, -1):
if x[i] <= xmax:
rmidx = i
break
else:
rmidx = len(x) - 1

if x[0] < xmin:
for i in range(0, len(x) - 1):
if x[i] >= xmin:
lmidx = i
break
else:
lmidx = 0

xn = x[lmidx:rmidx + 1].copy()
yn = y[lmidx:rmidx + 1].copy()
# print(len(x), len(xn), xn[0], xn[len(xn)-1])
else:
xn = x
yn = y
else:
# XPS in binding energy scale
if x[len(x) - 1] < xmin or xmax < x[0]:
if xmax < x[0]:
for i in range(0, len(x) - 1):
if x[i] <= xmax:
lmidx = i
break
else:
lmidx = 0

if x[len(x) - 1] < xmin:
for i in range(len(x) - 1, -1, -1):
if x[i] >= xmin:
rmidx = i
break
else:
rmidx = len(x) - 1

xn = x[lmidx:rmidx + 1].copy()
yn = y[lmidx:rmidx + 1].copy()
# print(len(x), len(xn), xn[0], xn[len(xn)-1])
else:
xn = x
yn = y

# return [array(xn), array(yn)]
return [xn, yn]
165 changes: 87 additions & 78 deletions Python/main.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Python/periodictable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os


data = pd.read_csv(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'elements.csv'))
data = pd.read_csv(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../Databases/elements.csv'))

class PeriodicTable(QWidget):
def __init__(self):
Expand Down
Loading

0 comments on commit 0857169

Please sign in to comment.