"""Actually solve each prescribed history, including all source inventories and birth intervals.""" import signal signal.signal(signal.SIGALRM,lambda *_:(_ for _ in()).throw(TimeoutError('120s producer cap')));signal.alarm(120) import argparse,time from evolution import simulate from io_helpers import fixed_inputs,family,write_json from pathlib import Path def main(): parser=argparse.ArgumentParser();parser.add_argument('--output',type=Path,default=Path('results/records'));parser.add_argument('--save-every',type=float,default=.005);parser.add_argument('--tight',action='store_true');args=parser.parse_args();started=time.monotonic();identities=[] if args.save_every not in [.02,.01,.005,.0025]:raise ValueError('Only registered coarse/fine spacing') for case in family(): record=simulate(case,fixed_inputs(),args.save_every,args.tight) if args.save_every==.005: record['birthIntervalGyr']=.005;record['physicalSnapshotEveryGyr']=.05 for field in ['timeGyr','states','abundances','flows']:record[field]=record[field][::10] path=args.output/(case['name']+('.npz'if args.save_every<=.005 else'.json.gz'));identity=write_json(path,record);identities.append({'name':case['name'],**identity}) write_json(args.output/'receipt.json',{'actualSolvedRecords':identities,'wallSecondsAfterScientificImports':time.monotonic()-started,'tight':args.tight,'noAppCode':True});print('PASS: four whole histories newly solved') if __name__=='__main__':main()