I have created a for loop where the final result in the loop is an array called dataNew as seen below:
flatID = [flat1, flat2, flat3, flat4, flat5, flat6, flat7, flat8, flat9, flat10, flat11, flat12, flat13, flat14, flat15]
oscimg = ["none"]*15
for i in range(0,14):
fakeBias = flatID[i]
#Biascorrection?
fakeData = np.zeros((636.,2400 ), dtype = "float")
fakeData.shape
biasPerRow=np.median(fakeBias[:,598:636],axis=1)
biasPerRow.shape
dataNew=fakeData[0:598,:]
dataNew.shape
for i in range(635):
dataNew[ : , i ] -= biasPerRow[ i ]
oscimg[i] = dataNew
I am working with various fits files where each of the data in the fits file is set to a element in the flatID list.
Where my issue lies is in setting the dataNew array to a string or a list element where that for each iteration of the loop, I can set the final values of dataNew array to either a string which changes with every iteration such that the final result will be 15 different variations of dataNew arrays being set to strings which I can use. However I am wrong in the sense of using oscimg[i] to set the string element as I return the following error.
IndexError Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
202 else:
203 filename = fname
--> 204 __builtin__.execfile(filename, *where)
/home/*****/Python/Assignment/Ag3.py in <module>()
110 for i in range(635):
111 dataNew[ : , i ] -= biasPerRow[ i ]
--> 112 oscimg[i] = dataNew
113
114 # Example 11.3: Read in dark frames, bias subtract and createmaster darks
IndexError: list assignment index out of range
I am not sure how to proceed from here so any input would be greatly appreciated.