@@ -99,22 +99,45 @@ def load_input_signals(file_path=None):
9999 directory_path = Path .cwd ()
100100 else :
101101 directory_path = Path (file_path )
102+ if not directory_path .is_dir ():
103+ raise ValueError (f"The provided file_path '{ file_path } ' is not a valid directory." )
102104
103105 values_list = []
104106 grid_list = []
105- current_grid = []
107+ #current_grid = []
108+ current_grid = None # Initialize as None
106109 for item in directory_path .iterdir ():
107110 if item .is_file ():
108- data = loadData (item .resolve ())
109- if current_grid and current_grid != data [:, 0 ]:
110- print (f"{ item .name } was ignored as it is not on a compatible grid." )
111- continue
111+ data = loadData (item .resolve ()) # Assuming loadData reads the XY data correctly
112+ x_values = data [:, 0 ] # First column as X values
113+ y_values = data [:, 1 ] # Second column as Y values
114+
115+ #data = loadData(item.resolve())
116+ #if current_grid is not None and not np.array_equal(current_grid, data[:, 0]):
117+ #print(f"{item.name} was ignored as it is not on a compatible grid.")
118+ #continue
119+ #if current_grid is not None and not np.array_equal(current_grid, x_values):
120+ #print(f"{item.name} was ignored as it is not on a compatible grid.")
121+ if current_grid is not None :
122+ if not np .array_equal (current_grid , x_values ):
123+ print (f"{ item .name } has incompatible grid: { x_values } " )
124+ continue
112125 else :
113- grid_list .append (data [:, 0 ])
114- current_grid = grid_list [- 1 ]
115- values_list .append (data [:, 1 ])
116-
117- grid_array = np .column_stack (grid_list )
118- grid_vector = np .unique (grid_array , axis = 1 )
126+ #grid_list.append(data[:, 0])
127+ #current_grid = grid_list[-1]
128+ #values_list.append(data[:, 1])
129+ current_grid = x_values # Update the current grid
130+ values_list .append (y_values ) # Store the Y values
131+
132+ if not grid_list :
133+ print ("No compatible grid found." )
134+ return None , None
135+
136+ # Stack Y values and create a unique grid array
119137 values_array = np .column_stack (values_list )
138+
139+ #grid_array = np.column_stack(grid_list)
140+ #grid_vector = np.unique(grid_array, axis=1)
141+ #values_array = np.column_stack(values_list)
142+ print (f"Grid vector shape: { grid_vector .shape } , Values array shape: { values_array .shape } " )
120143 return grid_vector , values_array
0 commit comments