If I understand correctly, you have an object that has numbered properties (OM01 through OM50). You can generate these attribute names with a loop, and use getattr to retrieve them from the object.
If your object is called root, as it is in your comment, you could do the following:
parameters = []
for i in range(1, 51):
parameter = getattr(root, 'OM%02d' % i)
parameters.append(parameter)
# now all of your parameters are in the parameter array
or, if you like list comprehensions (and who doesn't):
parameters = [getattr(root, 'OM%02d' % i) for i in range(1, 51)]
I guess you need to use these parameters with Fitter, which you could do as follows:
results = []
for i in range(1, 51):
parameter = getattr(hdf2.root, 'OM%02d' % i)
result = Fitter(parameter, plot=False)
results.append(result)
EDIT: If your files just have the names "hdf2.root.OM01", "hdf2.root.OM02", etc. you can just do this:
results = []
for i in range(1, 51):
filename = 'hdf2.root.OM%02d' % i
result = Fitter(filename, plot=False)
results.append(result)
fitter = Fitter('hdf2.01')?hdf2 = tables.openFile('waveforms.hdf5')fitter = Fitter(hdf2.root.OM01, plot=False)I'd like to modify this script so that I can loop through the "01" part.