Skip to content

Commit ed07841

Browse files
committed
Start writing documentation for cost2thresh.
1 parent f8469d9 commit ed07841

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

brainx/util.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -420,21 +420,40 @@ def replace_diag(arr,val=0):
420420
return arr
421421

422422

423-
def cost2thresh(cost,sub,bl,lk,last,idc = [],costlist=[]):
424-
"""A definition for loading the lookup table and finding the threshold associated with a particular cost for a particular subject in a particular block
423+
def cost2thresh(cost, sub, bl, lk, last, idc=[], costlist=[]):
424+
"""Return the threshold associated with a particular cost.
425+
426+
The cost is assessed with regard to block 'bl' and subject 'sub'.
425427
426-
inputs:
427-
cost: cost value for which we need the associated threshold
428-
sub: subject number
429-
bl: block number
430-
lk: lookup table (block x subject x cost
431-
last: last threshold value
428+
Parameters
429+
----------
430+
cost: float
431+
Cost value for which the associated threshold will be returned.
432432
433-
output:
434-
th: threshold value for this cost"""
433+
sub: integer
434+
Subject number.
435435
436-
#print cost,sub,bl
436+
bl: integer
437+
Block number.
438+
439+
lk: numpy array
440+
Lookup table with blocks X subjects X 2 (threshold or cost) X #
441+
costs/thresholds.
442+
443+
last:
444+
last threshold value
445+
446+
idc:
447+
448+
costlist:
437449
450+
451+
Returns
452+
-------
453+
th:
454+
threshold value for this cost
455+
456+
"""
438457
ind=np.where(lk[bl][sub][1]==cost)
439458
th=lk[bl][sub][0][ind]
440459

0 commit comments

Comments
 (0)