Changeset 836
- Timestamp:
- 10/15/15 19:57:49 (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/mystic/scripts.py
r835 r836 31 31 """ 32 32 try: # if it's a logfile, it might be multi-id 33 step, param, cost = logfile_reader(source) 33 if isinstance(source, basestring): 34 step, param, cost = logfile_reader(source) 35 else: 36 step = enumerate(source.id) 37 if len(source) == source.id.count(None): 38 step = [(i,) for (i,j) in step] 39 else: 40 step = list(step) 41 param, cost = source.x, source.y 34 42 except: # it's not a logfile, so read and return 35 43 param, cost = read_history(source) … … 362 370 _solver = None 363 371 372 instance = None 364 373 # handle the special case where list is provided by sys.argv 365 374 if isinstance(model, (list,tuple)) and not logfile and not kwds: … … 398 407 399 408 # handle logfile if given 400 if logfile: model += ' ' + logfile 409 if logfile: 410 if isinstance(logfile, basestring): 411 model += ' ' + logfile 412 else: # special case of passing in monitor instance 413 instance = logfile 401 414 402 415 # process "commandline" arguments … … 566 579 #FIXME: does grid=False still make sense here...? 567 580 if reducer: reducer = _reducer or _get_instance(reducer) 568 if solver and (not source or not model): 581 if solver and (not source or not model): #XXX: not instance? 569 582 raise RuntimeError('a model and results filename are required') 570 elif not source and not model :583 elif not source and not model and not instance: 571 584 raise RuntimeError('a model or a results file is required') 572 585 if model: … … 585 598 initial = [0]*xlen 586 599 from mystic.monitors import VerboseLoggingMonitor 587 itermon = VerboseLoggingMonitor(filename=source, new=True) 600 if instance: 601 itermon = VerboseLoggingMonitor(new=True) 602 itermon.prepend(instance) 603 else: 604 itermon = VerboseLoggingMonitor(filename=source, new=True) 588 605 # explicitly constrain parameters 589 606 model = partial(mask)(model) … … 613 630 fig = None 614 631 632 if instance: source = instance 615 633 if source: 616 634 # params are the parameter trajectories … … 703 721 else: # special case of passing in monitor instance 704 722 instance = filename 705 cmdargs = ['^1203@magic*key311&'] +shlex.split(cmdargs)723 cmdargs = shlex.split(cmdargs) 706 724 707 725 #XXX: note that 'argparse' is new as of python2.7
Note: See TracChangeset
for help on using the changeset viewer.