I am trying to perform the following: I generate 4 4 by 4 arrays with random values: scan_plus_1 ... scan_plus_4
Next I want to remove rows from each of the previously generated arrays using the numpy.delete funtion. Rows should be deleted using the Offset_Left_Pos array; for instance, for scan_plus_1 rows starting from 0 to 2 should be removed, for scan_plus_2 rows starting from 0 to 1 should be reomoved and so on.
The code is removing rows but not the rows I want it to remove i.e. the first 0 to Offset_Left_Pos[n]rows.
Could you please let me know what is it that I am doing wrong here, or if you have a better solution for this problem?
Thanks in advance.
import numpy as np
Offsets_Left_Pos=[2,1,1,2]
scanlines_pos=[8, 6, 7, 3]
Range_SL=range(0,len(scanlines_pos),1)
for sl_count in Range_SL:
#globals()["scan_plus_" + str(sl_count + 1)] = np.zeros((4, 4))
globals()["scan_plus_" + str(sl_count + 1)] = np.random.rand(4,4)
for sl_count in Range_SL:
globals()["Xscan_plus_" + str(sl_count + 1)] = eval("np.delete("+"scan_plus_" + str(sl_count + 1)+",[0, Offsets_Left_Pos[sl_count]],axis=0)") # Delete first offsets components of array
#globals()["Xscan_plus_" + str(sl_count + 1)] = np.delete(eval("scan_plus_" + str(sl_count + 1)),(0,Offsets_Left_Pos[sl_count]),axis=0) # Delete first offsets components of array
print("scan_plus_1")
print(scan_plus_1)
print("Xscan_plus_1")
print(Xscan_plus_1)