Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sgn-ts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
greg
sgn-ts
Commits
d46c1cac
Commit
d46c1cac
authored
2 months ago
by
Hanna
Browse files
Options
Downloads
Patches
Plain Diff
formatting
parent
167b7365
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#703879
passed
2 months ago
Stage: build
Stage: test
Stage: deploy
Stage: .post
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/sgnts/sources/fake_series.py
+3
-1
3 additions, 1 deletion
src/sgnts/sources/fake_series.py
src/sgnts/transforms/median.py
+7
-2
7 additions, 2 deletions
src/sgnts/transforms/median.py
tests/test_median.py
+2
-2
2 additions, 2 deletions
tests/test_median.py
with
12 additions
and
5 deletions
src/sgnts/sources/fake_series.py
+
3
−
1
View file @
d46c1cac
...
...
@@ -144,7 +144,9 @@ class FakeSeriesSource(TSSource):
return
np
.
random
.
randn
(
*
buf
.
shape
)
elif
self
.
signal_type
==
"
sin
"
or
self
.
signal_type
==
"
sine
"
:
return
np
.
sin
(
2
*
np
.
pi
*
self
.
fsin
2
*
np
.
pi
*
self
.
fsin
*
np
.
tile
(
buf
.
tarr
,
self
.
sample_shape
+
(
1
,),
...
...
This diff is collapsed.
Click to expand it.
src/sgnts/transforms/median.py
+
7
−
2
View file @
d46c1cac
from
dataclasses
import
dataclass
from
sgnts.base
import
TSTransform
,
TSFrame
,
AdapterConfig
,
Offset
import
numpy
from
sgnts.base
import
AdapterConfig
,
Offset
,
TSFrame
,
TSTransform
@dataclass
class
Median
(
TSTransform
):
"""
Computes a running median over the previous and afterward
...
...
@@ -12,7 +15,9 @@ class Median(TSTransform):
def
__post_init__
(
self
):
# FIXME: When this option is available, fill the gap buffers with nan's (instead of 0's)
self
.
adapter_config
=
AdapterConfig
(
overlap
=
self
.
overlap_offsets
,
pad_zeros_startup
=
False
,
stride
=
Offset
.
SAMPLE_STRIDE_AT_MAX_RATE
overlap
=
self
.
overlap_offsets
,
pad_zeros_startup
=
False
,
stride
=
Offset
.
SAMPLE_STRIDE_AT_MAX_RATE
,
)
super
().
__post_init__
()
# This element is written to assume one channel, one source pad and one sink pad
...
...
This diff is collapsed.
Click to expand it.
tests/test_median.py
+
2
−
2
View file @
d46c1cac
...
...
@@ -4,7 +4,7 @@ from sgn.apps import Pipeline
from
sgn.sinks
import
NullSink
from
sgnts.sources
import
FakeSeriesSource
from
sgnts.transforms
import
Median
from
sgnts.transforms
import
Median
def
test_median
():
...
...
@@ -40,7 +40,7 @@ def test_median():
name
=
"
trans1
"
,
source_pad_names
=
(
"
H1
"
,),
sink_pad_names
=
(
"
H1
"
,),
overlap_offsets
=
(
512
,
0
),
overlap_offsets
=
(
512
,
0
),
),
NullSink
(
name
=
"
snk1
"
,
...
...
This diff is collapsed.
Click to expand it.
James Kennington
@james.kennington
mentioned in commit
2d5665d0
·
2 months ago
mentioned in commit
2d5665d0
mentioned in commit 2d5665d08db1dbca8fd98e0e09b916fb29c99c21
Toggle commit list
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