fp = open(fname, "w") for f in formulas: fp.write(f + "\n") fp.close() print("Generated ", len(formulas), " formulas...") print("Start generating features...") last = args.dumponly i = 1 max = last if last < 0: max = len(formulas) for formula in formulas[0:last]: if not args.verbose: matinfmod.progress_bar(i, max) i = i + 1 newf = None try: newf = matinfmod.get_new_feature(atomicdataAB, formula) except ZeroDivisionError as zd: newf = None print("Cannot add ", formula, file=sys.stderr) if newf != None: avg = np.mean(newf) std = np.std(newf) if (math.fabs(std / avg) < args.variancefilter): print("Mean and stdev %40s %20.8f %20.8f [%10.8f]"%(formula, avg, std, std/avg), \ file=sys.stderr)
threeDformulas.append((f1 , f2, f3)) idx3 += 1 idx2 += 1 end = time.time() if args.showiter: avgtime += (end - start) est = (float(dim)*(avgtime/float(counter)))/3600.0 print("Iter %10d of %10d [%10.6f estimated tot. %10.6f hrs.]"%(counter, \ dim, (end - start), est),flush=True) else: matinfmod.progress_bar(counter, dim) idx1 += 1 print("") num1Df = len(start1dfeatures["formulas"]) print("Produced ",len(threeDformulas), " 3D features ( max ", \ max3Dformula, " )") if len(threeDformulas) > 0: generatedmse = matinfmod.feature3D_check_lr_msefullset(threeDformulas, featuresvalue, DE_array, args.numofiterations, args.showiter)