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
11c087e4
Commit
11c087e4
authored
1 month ago
by
Madeline Wade
Browse files
Options
Downloads
Patches
Plain Diff
Updating unit test to combine const int and float source
parent
e525a65e
No related branches found
Branches containing commit
No related tags found
1 merge request
!114
Add new mode to FakeSeriesSource
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sgnts/sources/fake_series.py
+5
-9
5 additions, 9 deletions
src/sgnts/sources/fake_series.py
tests/sources/test_fake_series.py
+4
-4
4 additions, 4 deletions
tests/sources/test_fake_series.py
with
9 additions
and
13 deletions
src/sgnts/sources/fake_series.py
+
5
−
9
View file @
11c087e4
...
...
@@ -36,15 +36,11 @@ class FakeSeriesSource(TSSource):
str, currently supported types: (1)
'
white
'
: white noise data. (2)
'
sin
'
or
'
sine
'
: sine wave data. (3)
'
impulse
'
: creates an impulse data, where the
value is one at one sample point, and everywhere else is zero.
(4)
'
const_int
'
or
'
constant_int
'
: constant int values as specified
by user. (5)
'
const_float
'
or
'
constant_float
'
: constant float values as
specified by user
(4)
'
const
'
: constant values as specified by user.
fsin:
float, the frequency of the sine wave if signal_type =
'
sin
'
const_int:
int, the constant int for output
cont_float:
float, the constant float for output
const:
int | float, the constant int or float for output
ngap:
int, the frequency to generate gap buffers, will generate a gap buffer every
ngap buffers. ngap=0: do not generate gap buffers. ngap=-1: generates gap
...
...
@@ -66,7 +62,7 @@ class FakeSeriesSource(TSSource):
sample_shape
:
tuple
[
int
,
...]
=
()
signal_type
:
str
=
"
white
"
fsin
:
float
=
5
const
t
:
[
int
|
float
]
=
1
const
:
[
int
|
float
]
=
1
ngap
:
int
=
0
random_seed
:
Optional
[
int
]
=
None
impulse_position
:
int
=
-
1
...
...
@@ -163,7 +159,7 @@ class FakeSeriesSource(TSSource):
elif
self
.
signal_type
==
"
impulse
"
:
return
self
.
create_impulse_data
(
offset
,
buf
.
samples
,
buf
.
sample_rate
)
elif
self
.
signal_type
==
"
const
"
:
return
np
.
full
(
buf
.
shape
,
self
.
const
_int
)
return
np
.
full
(
buf
.
shape
,
self
.
const
)
else
:
raise
ValueError
(
"
Unknown signal type
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/sources/test_fake_series.py
+
4
−
4
View file @
11c087e4
...
...
@@ -118,8 +118,8 @@ class TestFakeSeriesSource:
src
=
FakeSeriesSource
(
name
=
"
test
"
,
rate
=
16
,
signal_type
=
"
const
_int
"
,
const
_int
=
2
,
signal_type
=
"
const
"
,
const
=
2
,
t0
=
0
,
duration
=
1
,
source_pad_names
=
[
"
S1
"
],
...
...
@@ -153,8 +153,8 @@ class TestFakeSeriesSource:
src
=
FakeSeriesSource
(
name
=
"
test
"
,
rate
=
16
,
signal_type
=
"
const
_float
"
,
const
_float
=
3.4
,
signal_type
=
"
const
"
,
const
=
3.4
,
t0
=
0
,
duration
=
1
,
source_pad_names
=
[
"
S1
"
],
...
...
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