Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tooling
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FOCUS
Tooling
Commits
fa52bcad
Commit
fa52bcad
authored
1 year ago
by
Christoph von Oy
Browse files
Options
Downloads
Patches
Plain Diff
Fixes
parent
cdbffad3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dynamics/Dynamic.py
+6
-4
6 additions, 4 deletions
dynamics/Dynamic.py
with
6 additions
and
4 deletions
dynamics/Dynamic.py
+
6
−
4
View file @
fa52bcad
...
@@ -137,10 +137,10 @@ class TrivialDynamic(Dynamic):
...
@@ -137,10 +137,10 @@ class TrivialDynamic(Dynamic):
return
0
<=
index
and
index
<=
len
(
self
.
d_steps
)
return
0
<=
index
and
index
<=
len
(
self
.
d_steps
)
def
get_indices_within_p
(
self
,
p_start
,
p_end
):
def
get_indices_within_p
(
self
,
p_start
,
p_end
):
return
range
(
p_start
,
p_end
)
return
pd
.
RangeIndex
(
p_start
,
p_end
)
def
get_indices_within
(
self
,
i_start
,
i_end
):
def
get_indices_within
(
self
,
i_start
,
i_end
):
return
range
(
i_start
,
i_end
)
return
pd
.
RangeIndex
(
i_start
,
i_end
)
def
get_index_of
(
self
,
position
):
def
get_index_of
(
self
,
position
):
return
position
return
position
...
@@ -224,7 +224,7 @@ class BackedDynamic(Dynamic):
...
@@ -224,7 +224,7 @@ class BackedDynamic(Dynamic):
return
self
.
step_size_p
(
self
.
indices
.
index
(
index
))
return
self
.
step_size_p
(
self
.
indices
.
index
(
index
))
def
step_sizes
(
self
):
def
step_sizes
(
self
):
return
[
self
.
step_size_p
(
position
)
for
position
in
range
(
self
.
number_of_steps
)]
return
[
self
.
step_size_p
(
position
)
for
position
in
range
(
self
.
number_of_steps
()
)]
def
get_sub_dynamic_p
(
self
,
positions
):
def
get_sub_dynamic_p
(
self
,
positions
):
if
any
(
position
<
0
or
len
(
self
.
indices
)
<=
position
for
position
in
positions
):
if
any
(
position
<
0
or
len
(
self
.
indices
)
<=
position
for
position
in
positions
):
...
@@ -482,6 +482,8 @@ def resample_from_backed(values, dynamic, source_p_start, source_p_end, target_d
...
@@ -482,6 +482,8 @@ def resample_from_backed(values, dynamic, source_p_start, source_p_end, target_d
source_p_end
=
dynamic
.
get_position_of
(
target_i_end_prev
)
source_p_end
=
dynamic
.
get_position_of
(
target_i_end_prev
)
target_indices
=
target_dynamic
.
get_indices_within
(
target_i_end_prev
,
target_i_end
)
target_indices
=
target_dynamic
.
get_indices_within
(
target_i_end_prev
,
target_i_end
)
target_values
.
loc
[
target_indices
]
=
values
[
dynamic
.
indices
[
source_p_end
]]
target_values
.
loc
[
target_indices
]
=
values
[
dynamic
.
indices
[
source_p_end
]]
else
:
source_p_end
=
dynamic
.
get_position_of
(
target_i_end
)
for
source_position
in
range
(
source_p_start
,
source_p_end
):
for
source_position
in
range
(
source_p_start
,
source_p_end
):
target_indices
=
target_dynamic
.
get_indices_within
(
dynamic
.
indices
[
source_position
],
dynamic
.
indices
[
source_position
+
1
])
target_indices
=
target_dynamic
.
get_indices_within
(
dynamic
.
indices
[
source_position
],
dynamic
.
indices
[
source_position
+
1
])
target_values
.
loc
[
target_indices
]
=
values
[
dynamic
.
indices
[
source_position
]]
target_values
.
loc
[
target_indices
]
=
values
[
dynamic
.
indices
[
source_position
]]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment