Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
JOSSOUD Olivier
CFA Tools
Commits
29ffc61e
Commit
29ffc61e
authored
Dec 13, 2021
by
JOSSOUD Olivier
Browse files
Transition. Erf fitting. first/last datetime now optional
parent
4b651244
Pipeline
#152950
passed with stages
in 1 minute and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
cfatools/tsanalyser/transition.py
cfatools/tsanalyser/transition.py
+8
-4
No files found.
cfatools/tsanalyser/transition.py
View file @
29ffc61e
...
...
@@ -221,14 +221,18 @@ def get_transition_duration_gauss_sigma(df: pd.DataFrame,
def
get_transition_duration_erf
(
df
:
pd
.
DataFrame
,
first_datetime
:
datetime
.
datetime
,
last_datetime
:
datetime
.
datetime
,
first_datetime
:
datetime
.
datetime
=
None
,
last_datetime
:
datetime
.
datetime
=
None
,
col_value_name
:
str
=
"value"
,
debug_plot
:
bool
=
False
)
->
float
:
# Restrict the data to the transition area
df
=
df
[(
df
.
index
>=
first_datetime
)
&
(
df
.
index
<=
last_datetime
)]
df
=
df
.
copy
()
# Restrict the data to the transition area
if
first_datetime
is
not
None
:
df
=
df
[
df
.
index
>=
first_datetime
]
if
last_datetime
is
not
None
:
df
=
df
[
df
.
index
<=
last_datetime
]
def
erfunc
(
x
,
C1
,
C2
,
z0
,
sigma
):
return
(
C1
/
2
)
*
(
1
+
erf
((
x
-
z0
)
/
(
sigma
*
np
.
sqrt
(
2
))))
+
C2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment