import sys,os from hillTau import * def file_choices(choices,fname,iotype): ext = (os.path.splitext(fname)[1][1:]).lower() if iotype == "outputfile": if ext not in choices: parser.error("Requires output filetype {}".format(choices)) else: if ext != "json": parser.error("Requires HillTau file in JSON format ") return fname if __name__ == "__main__": parser = argparse.ArgumentParser( description = 'This program generates a db list for a HillTau model. It converts the specified HillTau file in JSON format, to the db format for the database\n') parser.add_argument('model',type=lambda s:file_choices(("json"),s,"input"), help='Required: filename of model, in JSON format.') args = parser.parse_args() jsonDict = loadHillTau( args.model ) modelpath = parseModel( jsonDict ) # print("molecules list from the group") # for molname, mol in ( modelpath.molInfo.items() ): # print(mol.grp, molname,mol.concInit) for e,t in modelpath.eqnInfo.items(): print( "name =",e," eqnstr =",t.eqnStr," mol = ",t.subs,end=" ") if hasattr(t, 'consts'): print("consts =",t.consts)