Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "SpectraFit"
version = "0.16.3"
version = "0.16.4"
description = "Fast fitting of 2D- and 3D-Spectra with established routines"
readme = "README.md"
authors = ["Anselm Hahn <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion spectrafit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""SpectraFit, fast command line tool for fitting data."""
__version__ = "0.16.3"
__version__ = "0.16.4"
65 changes: 59 additions & 6 deletions spectrafit/api/models_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class GaussianAPI(BaseModel):

amplitude: AmplitudeAPI = AmplitudeAPI()
center: CenterAPI = CenterAPI()
sigma: SigmaAPI = SigmaAPI()
fwhmg: FwhmgAPI = FwhmgAPI()


class LorentzianAPI(BaseModel):
Expand Down Expand Up @@ -224,27 +224,80 @@ class ConstantAPI(BaseModel):
amplitude: AmplitudeAPI = AmplitudeAPI()


class StepAPI(BaseModel):
class ErfAPI(BaseModel):
"""Definition of the Step of the models distributions."""

amplitude: AmplitudeAPI = AmplitudeAPI()
center: CenterAPI = CenterAPI()
sigma: SigmaAPI = SigmaAPI()


class HeavisideAPI(BaseModel):
"""Definition of the Step of the models distributions."""

amplitude: AmplitudeAPI = AmplitudeAPI()
center: CenterAPI = CenterAPI()
sigma: SigmaAPI = SigmaAPI()


class AtanAPI(BaseModel):
"""Definition of the Step of the models distributions."""

amplitude: AmplitudeAPI = AmplitudeAPI()
center: CenterAPI = CenterAPI()
sigma: SigmaAPI = SigmaAPI()


class LogAPI(BaseModel):
"""Definition of the Step of the models distributions."""

amplitude: AmplitudeAPI = AmplitudeAPI()
center: CenterAPI = CenterAPI()
sigma: SigmaAPI = SigmaAPI()
kind: str = Field(default="step", description="Kind of step function.")


class CGaussAPI(BaseModel):
"""Definition of the CGauss of the models distributions."""

amplitude: AmplitudeAPI = AmplitudeAPI()
center: CenterAPI = CenterAPI()
fwhmg: FwhmgAPI = FwhmgAPI()


class CLorentzAPI(BaseModel):
"""Definition of the CLorentz of the models distributions."""

amplitude: AmplitudeAPI = AmplitudeAPI()
center: CenterAPI = CenterAPI()
fwhml: FwhmlAPI = FwhmlAPI()


class CVoigtAPI(BaseModel):
"""Definition of the CVoigt of the models distributions."""

center: CenterAPI = CenterAPI()
fwhmv: FwhmvAPI = FwhmvAPI()
gamma: GammaAPI = GammaAPI()


class DistributionModelAPI(BaseModel):
"""Definition of the models distributions."""

pseudovoigt: PseudovoigtAPI = PseudovoigtAPI()
gaussian: GaussianAPI = GaussianAPI()
lorentzian: LorentzianAPI = LorentzianAPI()
voigt: VoigtAPI = VoigtAPI()
exponent: ExponentAPI = ExponentAPI()
pseudovoigt: PseudovoigtAPI = PseudovoigtAPI()
exponential: ExponentialAPI = ExponentialAPI()
power: PowerAPI = PowerAPI()
linear: LinearAPI = LinearAPI()
constant: ConstantAPI = ConstantAPI()
step: StepAPI = StepAPI()
erf: ErfAPI = ErfAPI()
heaviside: HeavisideAPI = HeavisideAPI()
atan: AtanAPI = AtanAPI()
log: LogAPI = LogAPI()
cgauss: CGaussAPI = CGaussAPI()
clorentz: CLorentzAPI = CLorentzAPI()
cvoigt: CVoigtAPI = CVoigtAPI()


class ConfIntervalAPI(BaseModel):
Expand Down
7 changes: 2 additions & 5 deletions spectrafit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from scipy.special import erf
from scipy.special import wofz
from scipy.stats import hmean
from spectrafit.api.models_model import DistributionModelAPI
from spectrafit.api.tools_model import AutopeakAPI
from spectrafit.api.tools_model import GlobalFittingAPI
from spectrafit.api.tools_model import SolverModelsAPI
Expand Down Expand Up @@ -498,11 +499,7 @@ def cvoigt(
class ReferenceKeys:
"""Reference keys for model fitting and peak detection."""

__models__ = [
func
for func in dir(DistributionModels)
if callable(getattr(DistributionModels, func)) and not func.startswith("_")
]
__models__ = list(DistributionModelAPI.schema()["properties"].keys())

__automodels__ = [
"gaussian",
Expand Down