if stepmon: stepmon = LoggingMonitor(1) # montor for all runs itermon = LoggingMonitor(1, filename='inv.txt') #XXX: log.txt? else: stepmon = itermon = None if archive: #python2.5 ar_name = '__%s_%sD_cache__' % (model.__self__.__class__.__name__,ndim) archive = dir_archive(ar_name, serialized=True, cached=False) ar_name = '__%s_%sD_invcache__' % (model.__self__.__class__.__name__,ndim) ivcache = dir_archive(ar_name, serialized=True, cached=False) else: archive = ivcache = None from mystic.search import Searcher #XXX: init w/ archive, then UseArchive? sampler = Searcher(npts, retry, tol, mem, _map, archive, sprayer, seeker) sampler.Verbose(disp) sampler.UseTrajectories(traj) ### doit ### maxpts = 1000. #10000. surface = Surface(model, sampler, maxpts=maxpts, dim=ndim) surface.UseMonitor(stepmon, itermon) surface.UseArchive(archive, ivcache) density = 9 shift = 0 scale = 0 step = 200 args = { 'smooth': 0, 'function': 'thin_plate',
else: archive = None # configure a Searcher to use a "trajectory cache" searcher = Searcher(npts, retry, tol, mem, size, _map, None, archive, sprayer, seeker, repeat=repeat) searcher.Verbose(disp) searcher.UseTrajectories(traj) searcher.Reset(archive, inv=False) searcher.Search(model, bounds, stop=stop, monitor=stepmon) searcher._summarize() ##### extract results ##### xyz = searcher.Samples() ##### invert the model, and get the maxima ##### imodel = lambda *args, **kwds: -model(*args, **kwds) #CUTE: 'configure' monitor and archive if they are desired if stepmon not in (None, False): itermon = LoggingMonitor(1, filename='inv.txt') #XXX: log.txt?