Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin-GUI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
yehaojie
plugin-GUI
Commits
2b3e1058
Commit
2b3e1058
authored
12 years ago
by
Stuart Layton
Browse files
Options
Downloads
Patches
Plain Diff
fixed the SignalGenerator to decrease the rate of spike generation
parent
b26f6d39
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/Processors/SignalGenerator.cpp
+7
-3
7 additions, 3 deletions
Source/Processors/SignalGenerator.cpp
Source/Processors/Visualization/SpikeDisplayCanvas.cpp
+4
-4
4 additions, 4 deletions
Source/Processors/Visualization/SpikeDisplayCanvas.cpp
with
11 additions
and
7 deletions
Source/Processors/SignalGenerator.cpp
+
7
−
3
View file @
2b3e1058
...
...
@@ -32,7 +32,7 @@ SignalGenerator::SignalGenerator()
defaultFrequency
(
10.0
),
defaultAmplitude
(
100.0
f
),
nOut
(
5
),
previousPhase
(
1000
),
spikeDelay
(
-
1
)
nOut
(
5
),
previousPhase
(
1000
),
spikeDelay
(
0
)
{
...
...
@@ -273,12 +273,16 @@ float SignalGenerator::generateSpikeSample(double amp, double phase, double nois
// if the current phase is less than the previous phase we've probably wrapped and its time to select a new spike
// if we've delayed long enough then draw a new spike otherwise wait until spikeDelay==0
if
(
phase
<
previousPhase
){
spikeIdx
=
rand
()
%
5
;
spikeDelay
=
rand
()
%
100
;
if
(
spikeDelay
<=
0
)
spikeDelay
=
rand
()
%
200
+
50
;
if
(
spikeDelay
>
0
)
spikeDelay
--
;
}
previousPhase
=
phase
;
...
...
This diff is collapsed.
Click to expand it.
Source/Processors/Visualization/SpikeDisplayCanvas.cpp
+
4
−
4
View file @
2b3e1058
...
...
@@ -28,7 +28,7 @@ SpikeDisplayCanvas::SpikeDisplayCanvas(SpikeDisplayNode* n) :
plotsInitialized
(
false
),
newSpike
(
false
),
processor
(
n
),
totalScrollPix
(
0
)
{
nCols
=
8
;
nCols
=
6
;
update
();
...
...
@@ -137,7 +137,7 @@ void SpikeDisplayCanvas::repositionSpikePlots(){
int
w
,
h
;
int
yIncrement
=
0
;
bool
loopCheck
=
false
;
std
::
cout
<<
"Positioning Spike Plots"
<<
std
::
endl
;
//
std::cout<<"Positioning Spike Plots"<<std::endl;
while
(
p
<
plots
.
size
()){
// Ask the current plot for its desired dims
...
...
@@ -147,7 +147,7 @@ void SpikeDisplayCanvas::repositionSpikePlots(){
// Check to see if plot exceeds width of canvas, if yes, set x back to 0 and go to the bottom most plot on the canvas
if
(
(
x
+
w
+
xBuffer
>
canvasWidth
-
xBuffer
)
&&
!
loopCheck
){
std
::
cout
<<
"Collision with the edge of the canvas, going down a row"
<<
std
::
endl
;
//
std::cout<<"Collision with the edge of the canvas, going down a row"<<std::endl;
x
=
xBuffer
;
y
=
y
-
yIncrement
-
yBuffer
;
yIncrement
=
0
;
...
...
@@ -156,7 +156,7 @@ void SpikeDisplayCanvas::repositionSpikePlots(){
}
// else place the plot
else
{
std
::
cout
<<
"Positioning p:"
<<
p
<<
" at "
<<
x
<<
","
<<
y
-
h
<<
" "
<<
w
<<
","
<<
h
<<
std
::
endl
;
//
std::cout<<"Positioning p:"<<p<<" at "<<x<<","<<y - h<<" "<<w<<","<<h<<std::endl;
plots
[
p
]
->
setPosition
(
x
,
y
-
h
+
getScrollAmount
(),
w
,
h
);
x
=
x
+
w
+
xBuffer
;
...
...
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