I have several csv files of a name sequence where the numbers change
I need to call a function that takes all these file at once
I tried to do it as following:
names = ["orm_x_CXY_" + str(i) + ".csv" for i in range(0,40)]
The function is defined as following
import pandas as pd
import numpy as np
def getBpms(filename, ipage):
    twiss = pd.read_csv(filename, skiprows=1,
                        names=['s_pos', 'beta_x', 'beta_y', 'dx', 'dy', 'closed_orbitx', 'closed_orbity', 'element_type', 'elements_strength'],
                        header=None, index_col=0)
    s = twiss.s_pos
    x = twiss.closed_orbitx
    y = twiss.closed_orbity
    etype = twiss.element_type
    xs = []
    ys = []
    i=0
    for i in range(len(etype)):
        if(etype[i] == 'BPM'):
           xs.append('BPM'+str(i))
           ys.append('BPM'+str(i))
    return np.array(xs), np.array(ys)
when i tried to call the function with "names" as input as following
x, y =getBpms(names, 0)
I seems to inter in an infinite loop and no output was shown.
 
     
    