Open badulion opened 1 month ago
When using constant IC in a composite setting, the composite wrapper calls generate for each component. When constant IC is used it throws an error, as it does not have the argument "random_state"
`--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[2], line 16 14 intitial = Composite(WrappedGaussians(components=5), Constant()) 15 solver = PyPDESolver(equation=pde_equation, grid=grid, initial_generator=intitial, parameters={'method': "RK23"}) ---> 16 solver.solve(t_span=[0, 100], dt_eval=1)
File ~/coding/work/research/grind/.venv/lib/python3.12/site-packages/dynabench/solver/_pypde.py:67, in PyPDESolver.solve(self, random_state, t_span, dt_eval, out_dir) 64 save_path = self.generate_filename(t_span=t_span, dt_eval=dt_eval, seed=random_state) 66 pypde_eq = self.equation.export_as_pypde_equation() ---> 67 initial_condition = self.initial_generator.generate(self.grid, random_state=random_state) 68 pypde_grid = self.grid.export_as_pypde_grid() 70 # Create tracker and file storage
File ~/coding/work/research/grind/.venv/lib/python3.12/site-packages/dynabench/initial.py:81, in Composite.generate(self, grid, random_state) 79 np.random.seed(random_state) 80 seeds = np.random.randint(0, 1e6, len(self.components)) ---> 81 return [component(grid, random_state=seed) for component, seed in zip(self.components, seeds)]
File ~/coding/work/research/grind/.venv/lib/python3.12/site-packages/dynabench/initial.py:55, in InitialCondition.call(self, grid, *args, kwargs) 54 def call(self, grid: dynabench.grid.Grid, *args, *kwargs): ---> 55 return self.generate(grid, args, kwargs)
TypeError: Constant.generate() got an unexpected keyword argument 'random_state'`
When using constant IC in a composite setting, the composite wrapper calls generate for each component. When constant IC is used it throws an error, as it does not have the argument "random_state"
`--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[2], line 16 14 intitial = Composite(WrappedGaussians(components=5), Constant()) 15 solver = PyPDESolver(equation=pde_equation, grid=grid, initial_generator=intitial, parameters={'method': "RK23"}) ---> 16 solver.solve(t_span=[0, 100], dt_eval=1)
File ~/coding/work/research/grind/.venv/lib/python3.12/site-packages/dynabench/solver/_pypde.py:67, in PyPDESolver.solve(self, random_state, t_span, dt_eval, out_dir) 64 save_path = self.generate_filename(t_span=t_span, dt_eval=dt_eval, seed=random_state) 66 pypde_eq = self.equation.export_as_pypde_equation() ---> 67 initial_condition = self.initial_generator.generate(self.grid, random_state=random_state) 68 pypde_grid = self.grid.export_as_pypde_grid() 70 # Create tracker and file storage
File ~/coding/work/research/grind/.venv/lib/python3.12/site-packages/dynabench/initial.py:81, in Composite.generate(self, grid, random_state) 79 np.random.seed(random_state) 80 seeds = np.random.randint(0, 1e6, len(self.components)) ---> 81 return [component(grid, random_state=seed) for component, seed in zip(self.components, seeds)]
File ~/coding/work/research/grind/.venv/lib/python3.12/site-packages/dynabench/initial.py:55, in InitialCondition.call(self, grid, *args, kwargs) 54 def call(self, grid: dynabench.grid.Grid, *args, *kwargs): ---> 55 return self.generate(grid, args, kwargs)
TypeError: Constant.generate() got an unexpected keyword argument 'random_state'`