Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
signal_detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jäkel, Frank
signal_detection
Commits
4881f152
Commit
4881f152
authored
3 months ago
by
Jäkel, Frank
Browse files
Options
Downloads
Patches
Plain Diff
changed code to not use pandas.append anymore because its deprecated
parent
c4dab7fb
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
signal_detection.py
+7
-1
7 additions, 1 deletion
signal_detection.py
with
7 additions
and
1 deletion
signal_detection.py
+
7
−
1
View file @
4881f152
...
@@ -108,6 +108,7 @@ def setup(intensity,task,DEBUG=False):
...
@@ -108,6 +108,7 @@ def setup(intensity,task,DEBUG=False):
def
run_block
(
subject
,
intensity
,
p
=
0.5
,
num_of_blocks
=
1
,
task
=
'
yes-no
'
,
DEBUG
=
False
):
def
run_block
(
subject
,
intensity
,
p
=
0.5
,
num_of_blocks
=
1
,
task
=
'
yes-no
'
,
DEBUG
=
False
):
from
psychopy
import
core
,
visual
,
event
,
monitors
,
logging
from
psychopy
import
core
,
visual
,
event
,
monitors
,
logging
data
=
load_data
(
subject
)
data
=
load_data
(
subject
)
data_list
=
[]
if
len
(
data
)
>
0
:
if
len
(
data
)
>
0
:
block
=
data
[
'
block
'
].
max
()
+
1
block
=
data
[
'
block
'
].
max
()
+
1
else
:
else
:
...
@@ -210,13 +211,18 @@ def run_block(subject,intensity,p=0.5,num_of_blocks=1,task='yes-no',DEBUG=False)
...
@@ -210,13 +211,18 @@ def run_block(subject,intensity,p=0.5,num_of_blocks=1,task='yes-no',DEBUG=False)
'
false_alarm
'
:
int
(
not
(
s
)
and
r
),
'
false_alarm
'
:
int
(
not
(
s
)
and
r
),
'
correct
'
:
int
(
s
==
r
),
'
correct
'
:
int
(
s
==
r
),
'
RT
'
:
rt
}
'
RT
'
:
rt
}
data
=
data
.
append
(
ndata
,
ignore_index
=
True
)
# append has been deprecated and this should be done differently
# data = data.append(ndata, ignore_index=True)
# data.loc[len(data)] = ndata # this becomes slower with growing frame
data_list
.
append
(
ndata
)
# after a number of trials have been done save
# after a number of trials have been done save
if
((
i
+
1
)
%
params
[
'
num_of_trials
'
])
==
0
:
if
((
i
+
1
)
%
params
[
'
num_of_trials
'
])
==
0
:
data
=
pd
.
concat
([
data
,
pd
.
DataFrame
(
data_list
)])
data
.
to_csv
(
params
[
'
filename
'
],
header
=
True
,
index
=
False
)
data
.
to_csv
(
params
[
'
filename
'
],
header
=
True
,
index
=
False
)
pc
=
data
[
data
[
'
block
'
]
==
block
][
'
correct
'
].
mean
()
pc
=
data
[
data
[
'
block
'
]
==
block
][
'
correct
'
].
mean
()
text
=
'
%d of %d trials done. %.2f%% correct in last block.
\n
Any key to continue.
'
%
(
i
+
1
,
num_of_trials
,
pc
*
100
)
text
=
'
%d of %d trials done. %.2f%% correct in last block.
\n
Any key to continue.
'
%
(
i
+
1
,
num_of_trials
,
pc
*
100
)
block
=
block
+
1
block
=
block
+
1
data_list
=
[]
# clear data from last block
message
=
visual
.
TextStim
(
win
,
pos
=
[
0
,
100
],
text
=
text
)
message
=
visual
.
TextStim
(
win
,
pos
=
[
0
,
100
],
text
=
text
)
message
.
draw
()
message
.
draw
()
win
.
flip
()
win
.
flip
()
...
...
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