-
Notifications
You must be signed in to change notification settings - Fork 206
/
arctan.py
68 lines (55 loc) · 1.93 KB
/
arctan.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
# Copyright 2007-2021 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# HyperSpy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with HyperSpy. If not, see <http://www.gnu.org/licenses/>.
from hyperspy._components.expression import Expression
class Arctan(Expression):
r"""Arctan function component.
.. math::
f(x) = A \cdot \arctan \left[ k \left( x-x_0 \right) \right]
============ =============
Variable Parameter
============ =============
:math:`A` A
:math:`k` k
:math:`x_0` x0
============ =============
Parameters
-----------
A : float
Amplitude parameter. :math:`\lim_{x\to -\infty}f(x)=-A` and
:math:`\lim_{x\to\infty}f(x)=A`
k : float
Slope (steepness of the step). The larger :math:`k`, the sharper the
step.
x0 : float
Center parameter (position of zero crossing :math:`f(x_0)=0`).
"""
def __init__(self, A=1., k=1., x0=1., module=["numpy", "scipy"], **kwargs):
# Not to break scripts once we remove the legacy Arctan
if "minimum_at_zero" in kwargs:
del kwargs["minimum_at_zero"]
super(Arctan, self).__init__(
expression="A * arctan(k * (x - x0))",
name="Arctan",
A=A,
k=k,
x0=x0,
position="x0",
module=module,
autodoc=False,
**kwargs,
)