funcnodes-span 0.1.4__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {funcnodes_span-0.1.4 → funcnodes_span-0.1.6}/PKG-INFO +1 -1
- {funcnodes_span-0.1.4 → funcnodes_span-0.1.6}/funcnodes_span/__init__.py +2 -2
- {funcnodes_span-0.1.4 → funcnodes_span-0.1.6}/funcnodes_span/peak_analysis.py +7 -7
- {funcnodes_span-0.1.4 → funcnodes_span-0.1.6}/pyproject.toml +1 -1
- {funcnodes_span-0.1.4 → funcnodes_span-0.1.6}/README.md +0 -0
- {funcnodes_span-0.1.4 → funcnodes_span-0.1.6}/funcnodes_span/normalization.py +0 -0
- {funcnodes_span-0.1.4 → funcnodes_span-0.1.6}/funcnodes_span/smoothing.py +0 -0
|
@@ -2,9 +2,9 @@ import funcnodes as fn
|
|
|
2
2
|
|
|
3
3
|
from .normalization import NORM_NODE_SHELF as NORM
|
|
4
4
|
from .smoothing import SMOOTH_NODE_SHELF as SMOOTH
|
|
5
|
-
from .peak_analysis import
|
|
5
|
+
from .peak_analysis import PEAKS_NODE_SHELF as PEAK
|
|
6
6
|
|
|
7
|
-
__version__ = "0.1.
|
|
7
|
+
__version__ = "0.1.6"
|
|
8
8
|
|
|
9
9
|
NODE_SHELF = fn.Shelf(
|
|
10
10
|
name="Spectral Analysis",
|
|
@@ -337,7 +337,7 @@ def fit_1D(
|
|
|
337
337
|
x_array: np.ndarray,
|
|
338
338
|
y_array: np.ndarray,
|
|
339
339
|
basic_peaks: List[PeakProperties],
|
|
340
|
-
|
|
340
|
+
model_name: FittingModel = FittingModel.default(),
|
|
341
341
|
) -> List[PeakProperties]:
|
|
342
342
|
# """
|
|
343
343
|
# Fit a 1D model to the given data.
|
|
@@ -357,8 +357,8 @@ def fit_1D(
|
|
|
357
357
|
# A tuple containing a dictionary of evaluated components of the fit and additional information about the fit, and an optional figure for the plot.
|
|
358
358
|
|
|
359
359
|
# """
|
|
360
|
-
if isinstance(
|
|
361
|
-
|
|
360
|
+
if isinstance(model_name, FittingModel):
|
|
361
|
+
model_name = model_name.value
|
|
362
362
|
peaks = copy.deepcopy(basic_peaks)
|
|
363
363
|
y = y_array
|
|
364
364
|
x = x_array
|
|
@@ -392,7 +392,7 @@ def fit_1D(
|
|
|
392
392
|
# ['Constant', 'Complex Constant', 'Linear', 'Quadratic', 'Polynomial', 'Spline', 'Gaussian', 'Gaussian-2D', 'Lorentzian', 'Split-Lorentzian', 'Voigt', 'PseudoVoigt', 'Moffat', 'Pearson4', 'Pearson7', 'StudentsT', 'Breit-Wigner', 'Log-Normal', 'Damped Oscillator', 'Damped Harmonic Oscillator', 'Exponential Gaussian', 'Skewed Gaussian', 'Skewed Voigt', 'Thermal Distribution', 'Doniach', 'Power Law', 'Exponential', 'Step', 'Rectangle', 'Expression']
|
|
393
393
|
# peak like models are: GaussianModel, LorentzianModel, VoigtModel and their modified versions
|
|
394
394
|
|
|
395
|
-
fitting_model = lmfit.models.__dict__["lmfit_models"][
|
|
395
|
+
fitting_model = lmfit.models.__dict__["lmfit_models"][model_name]
|
|
396
396
|
# bkg1 = lmfit.models.__dict__["lmfit_models"]["Spline"](prefix="baseline", xknots=np.concatenate((x[:lowest_index], x[highest_index:])))
|
|
397
397
|
bkg2 = lmfit.models.__dict__["lmfit_models"]["Exponential"](prefix="baseline")
|
|
398
398
|
|
|
@@ -412,7 +412,7 @@ def fit_1D(
|
|
|
412
412
|
)
|
|
413
413
|
pars[f"peak{index+1}_amplitude"].set(value=y[peak["index"]], min=0)
|
|
414
414
|
|
|
415
|
-
if
|
|
415
|
+
if model_name == "Exponential Gaussian" or model_name == "Skewed Gaussian":
|
|
416
416
|
pars[f"peak{index+1}_gamma"].set(value=1)
|
|
417
417
|
|
|
418
418
|
f += model
|
|
@@ -436,7 +436,7 @@ def fit_1D(
|
|
|
436
436
|
value=out.__dict__["best_values"][f"peak{index+1}_amplitude"], min=0
|
|
437
437
|
)
|
|
438
438
|
|
|
439
|
-
if
|
|
439
|
+
if model_name == "Exponential Gaussian" or model_name == "Skewed Gaussian":
|
|
440
440
|
pars[f"peak{index+1}_gamma"].set(
|
|
441
441
|
value=out.__dict__["best_values"][f"peak{index+1}_gamma"]
|
|
442
442
|
)
|
|
@@ -446,7 +446,7 @@ def fit_1D(
|
|
|
446
446
|
out = f.fit(y, pars, x=x)
|
|
447
447
|
com = out.eval_components(x=x)
|
|
448
448
|
info_dict = out.__dict__
|
|
449
|
-
info_dict["model_name"] =
|
|
449
|
+
info_dict["model_name"] = model_name
|
|
450
450
|
|
|
451
451
|
peak_properties_list = []
|
|
452
452
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|