My code currently has an array, lets say for example:
arr = np.ones((512, 512)).
There is an area of the array that interests me. I usually access it like this:
arr[50:200,150:350] #do stuff here.
I was wondering, is there some way to make a variable that holds [50:200,150:350]
? This way, if I need to slightly change my mask, I can do it once, on the top of the file, instead of everywhere it is accessed.
I tried mask = [50:200,150:350]
, arr[mask]
but Python syntax won't allow that.
Thanks for the help!