funcnodes-span 0.1.5__tar.gz → 0.1.7__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.5 → funcnodes_span-0.1.7}/PKG-INFO +1 -1
- {funcnodes_span-0.1.5 → funcnodes_span-0.1.7}/funcnodes_span/__init__.py +1 -1
- {funcnodes_span-0.1.5 → funcnodes_span-0.1.7}/funcnodes_span/peak_analysis.py +10 -10
- {funcnodes_span-0.1.5 → funcnodes_span-0.1.7}/pyproject.toml +1 -1
- {funcnodes_span-0.1.5 → funcnodes_span-0.1.7}/README.md +0 -0
- {funcnodes_span-0.1.5 → funcnodes_span-0.1.7}/funcnodes_span/normalization.py +0 -0
- {funcnodes_span-0.1.5 → funcnodes_span-0.1.7}/funcnodes_span/smoothing.py +0 -0
|
@@ -179,7 +179,7 @@ def compute_peak_properties(
|
|
|
179
179
|
return peak_properties
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
@NodeDecorator(id="span.basics.peaks", name="Peak finder
|
|
182
|
+
@NodeDecorator(id="span.basics.peaks", name="Peak finder")
|
|
183
183
|
@controlled_wrapper(find_peaks, wrapper_attribute="__fnwrapped__")
|
|
184
184
|
def peak_finder(
|
|
185
185
|
x_array: np.ndarray,
|
|
@@ -310,14 +310,14 @@ class FittingModel(Enum):
|
|
|
310
310
|
Moffat = "Moffat"
|
|
311
311
|
Pearson4 = "Pearson4"
|
|
312
312
|
Pearson7 = "Pearson7"
|
|
313
|
+
SkewedGaussian = "Skewed Gaussian"
|
|
314
|
+
SkewedVoigt = "Skewed Voigt"
|
|
313
315
|
StudentsT = "StudentsT"
|
|
314
316
|
BreitWigner = "Breit-Wigner"
|
|
315
317
|
LogNormal = "Log-Normal"
|
|
316
318
|
DampedOscillator = "Damped Oscillator"
|
|
317
319
|
DampedHarmonicOscillator = "Damped Harmonic Oscillator"
|
|
318
320
|
ExponentialGaussian = "Exponential Gaussian"
|
|
319
|
-
SkewedGaussian = "Skewed Gaussian"
|
|
320
|
-
SkewedVoigt = "Skewed Voigt"
|
|
321
321
|
ThermalDistribution = "Thermal Distribution"
|
|
322
322
|
Doniach = "Doniach"
|
|
323
323
|
PowerLaw = "Power Law"
|
|
@@ -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
|