Coding or input error.... applying code to an image to randomize the placement of the image

Hello,
My lab PI created this code from Matlab and wants me to apply it to an image. The experiment crashes when run and I put the code down below.
Error:
3.7567 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
11.1048 WARNING User requested fullscreen with size [1368 912], but screen is actually [2736, 1824]. Using actual size
Traceback (most recent call last):
File “C:\Users\steph\Downloads\codingtester_lastrun.py”, line 187, in
texRes=128.0, interpolate=True, depth=-1.0)
File “C:\Users\steph\PsychoPy_Install\lib\site-packages\psychopy\visual\image.py”, line 89, in init
self.pos = numpy.array(pos, float)
File “C:\Users\steph\PsychoPy_Install\lib\site-packages\psychopy\tools\attributetools.py”, line 32, in set
newValue = self.func(obj, value)
File “C:\Users\steph\PsychoPy_Install\lib\site-packages\psychopy\visual\basevisual.py”, line 1640, in pos
self.dict[‘pos’] = val2array(value, False, False)
File “C:\Users\steph\PsychoPy_Install\lib\site-packages\psychopy\tools\arraytools.py”, line 195, in val2array
raise ValueError(msg % (str(length), str(len(value))))
ValueError: Invalid parameter. Should be length 2 but got length 2 dumb

Experiment ended.

Code:

#!/usr/bin/env python3

-- coding: utf-8 --

“”"
Created on Wed Oct 28 14:16:55 2020

@author: sadamo
“”"

import random
import numpy
import math
Master_H= #Presetting variables so I can get a list of coordinates the length of the number of items I want in the search display
Master_V=
WhichArray=2; #1=Circle and 2=Grid
Radius=120 #Circle size
SetSize=25 #How many items you want
Coords_H=
Coords_V=
Jitter_Dipsplay=1 #Do you want to jitter the items off the grid?
CenterX=0 #Where is the center of the screen x coord. Archi…I used to set this to the dead center of my screen in pixels. You may need to play with this for normalized reasons
CenterY=0
ItemWidth=100 #How big are your pictures in pixels
ItemHeight=100
GridWidth=1000 #How high and wide is your grid in pixels…Ar
GridHeight=1000
Rows=7; #How many potential cells do you want (Rows x columns). Mess with this to get more space between items, but will be easier to search the less there are I believe
Columns=8#;
SpacingBetweenGrid=5 #How much space do you want between your theoretical grid you are making

CenterSpaceSavedForFixation=0 # Do you want the center as a possible value where the target can appear. Most people don’t since it is too easy to find there

CellWidth=(GridWidth- ((Rows-1)*SpacingBetweenGrid))/Rows#;
CellHeight=(GridHeight - ((Columns -1)*SpacingBetweenGrid))/Columns

X_Space = GridWidth/Rows;
Y_Space = GridHeight/Columns#;

count= 0#;
NumberPositions= 0#;

if WhichArray==1:
for i in range(1,(SetSize)):
Coords_H.append(round(CenterX+ Radius * math.cos(2math.pi/SetSize * (i-1) - math.pi/2)))#;
Coords_V.append(round(CenterY+ Radius * math.sin(2
math.pi/SetSize * (i-1) - math.pi/2)))#;

else:
for i in range(1,Columns+1):
for j in range(1,Rows+1):

        if CenterSpaceSavedForFixation == 1 and Rows%2 == 1 and Columns%2== 1 and count==(round(Rows*Columns/2)):
            count += 1
        else:#logic for coordinates. The above just skips the center as a possible place to put target
            #a counter to keep track of how many postitions you have based off the length and width of you screen
            Coords_H.append(CenterX - ((Rows-1)/2) * X_Space + (j-1) * X_Space) #Getting the precise x locations of the grid
            Coords_V.append(CenterY - ((Columns-1)/2) * Y_Space + (i-1) * Y_Space) #Getting the precise y locations
            count +=1
            NumberPositions +=1 

#Determining if we can jitter the items in the x and y direction
if 0 >= ((CellHeight - ItemHeight)/2):
Y_Jitter = 0
else:
Y_Jitter = round(((CellHeight - ItemHeight)/2)) #May need to go to floor if there is overlap

if 0 >= ((CellWidth- ItemWidth)/2):
X_Jitter = 0
else:
X_Jitter = round(((CellWidth- ItemWidth)/2))
x=random.sample(range(len(Coords_H)), len(Coords_H)) #Generating a list of numbers the length of the number of possible coordinates
randlocations=numpy.array(x)-1 #subtracting 1 from each so I can call that place in the array of cords

for i in range(0,SetSize):
if Jitter_Dipsplay==1: #Add Jitter
NumberX = random.randint(round(-X_Jitter),round( X_Jitter)) #Getting a negative or positive value from the jitter and additing it to the coordinate
NumberY = random.randint(round(-Y_Jitter),round( Y_Jitter))
Master_H.append(round(Coords_H[randlocations[i]] + NumberX)) #h coordinates based on random set of master coordinates, plus jitter
Master_V.append(round(Coords_V[randlocations[i]] + NumberY))
else:

        Master_H.append(round(Coords_H[randlocations[i]])) #h coordinates based on random set of master coordinates, plus jitter
        Master_V.append(round(Coords_H[randlocations[i]])) 

TransformedX_Y_List=
for i in range(0,SetSize): #Formatted how you had it Archi
TransformedX_Y_List.append(Master_H[i])
TransformedX_Y_List.append(Master_V[i])

This screenshot shows the coordinates for the image in Spyder

I’m not really sure what to do to fix this or how the code is even finding Master H and V without a file…