@Reptorian
step by step, looking at the if __name __ == "__main__":
conditional block:
mesh = makeCircleWellMatrix (N, inWell, outWell) #globals: N=200,inWell=1,outWell=0
you want a makeCircleWellMatrix (N, inWell, outWell)
Python to G’MIC reimplementation:
def makeCircleWellMatrix (n, inW, outW):
well_matrix = np.empty((n, n))
#00100
#01110
#00100
for i in range(0, n):
for j in range(0, n):
if math.dist([i, j], [(n-1)/2, (n-1)/2]) <= (n-1)/2 :
well_matrix[i][j] = inW
else:
well_matrix[i][j] = outW
return well_matrix
Just looking at the 3 lines of comment + the if math.dist() statement seem to imply that the function creates a matrix of N x N zeros, with a 1.0 filled borderless circle that is N/2 diameter wide. Note that the for someVariable in range(min, max):
loop header in Python can be understood as `for someVariable spanning from min to max with a step 1.
Here is a G’MIC command line reimplementation try for N=2:
gmic 200,200,1,1 circle 50\%,50\%,50,1,1.0
Here is a G’MIC file syntax variant with variables assignment:
N=100
inWell=1
outWell=0
makeCircleWellMatrix:
$1,$1,1,1 fill_color $3 circle 50%,50%,N/4,1,$2
rep_hamiltonian:
makeCircleWellMatrix $N,$inWell,$outWell
but I get an error but I do not know G’MIC’s syntax well…:
[gmic]-0./rep_hamiltonian/ *** Error (file 'aa.gmic', line #15) *** Command 'makeCircleWellMatrix': Undefined argument '$1', in expression '$1' (for 2 arguments specified).