Skip to content

Commit 16b6c96

Browse files
committed
added a line to filter userwarnings, which get raised to say kernel length was given as a not-odd number pretty often in the optimization process, in the main thread, because apparently it sensible also does some of the work in an all hands on deck fashion, and that was resulting in some annoying warnings slipping through
1 parent e9e5a41 commit 16b6c96

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

pynumdiff/optimize/_optimize.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def optimize(func, x, dt, dxdt_truth=None, tvgamma=1e-2, search_space_updates={}
178178
None for k,v in search_space_types.items()] # None means no bound on a dimension
179179

180180
results = []
181+
filterwarnings("ignore", '', UserWarning) # An extra filtering call, because some worker work can actually be done in the main process
181182
with Pool(initializer=filterwarnings, initargs=["ignore", '', UserWarning]) as pool: # The heavy lifting
182183
for categorical_combo in categorical_combos:
183184
# wrap the objective and scipy.optimize.minimize to pass kwargs and a host of other things that remain the same

0 commit comments

Comments
 (0)