diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index 1cc2942c82b3f45fe845dc384998df2cbd87f9cc..992e9f97c69a88eb0dca5931b2f6b0257b499de5 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -1416,7 +1416,7 @@ class Population: lock = multiprocessing.Lock() # Do the printing itself - self.vb1print(ID, now, system_number) + self.vb1print(ID, now, system_number, system_dict) # Set some values for next time next_log_time = now + self.grid_options["log_dt"] @@ -4271,7 +4271,7 @@ eccentricity3=0 ###################### # Status logging - def vb1print(self, ID, now, system_number): + def vb1print(self, ID, now, system_number, system_dict): """ Verbosity-level 1 printing, to keep an eye on a grid. Arguments: @@ -4316,9 +4316,27 @@ eccentricity3=0 # add up memory use from each thread total_mem_use = sum(self.shared_memory["memory_use_per_thread"]) - # + def _format_number(number): + # compact number formatter + string = "{number:.2g}".format(number=number) + string = string.replace("e+0","e+") + string = string.replace("e-0","e-") + return string + + # make a string to describe the system e.g. M1, M2, etc. + system_string = "" + if 'multiplicity' in system_dict: + for i in range(system_dict['multiplicity']): + i1 = str(i+1) + system_string += "M{}=".format(i1) + _format_number(system_dict['M_'+i1]) + " " + if 'separation' in system_dict: + system_string += "a=" + _format_number(system_dict['separation']) + if 'orbital_period' in system_dict: + system_string += "P=" + _format_number(system_dict['orbital_period']) + + # do the print verbose_print( - "{system_number}/{total_starcount}{modulo} {complete:5.1f}% complete {hours:02d}:{minutes:02d}:{seconds:02d} ETA={eta:7.1f}{units} tpr={tpr:2.2e} ETF={etf} mem:{mem_use:.1f}MB".format( + "{system_number}/{total_starcount}{modulo} {complete:5.1f}% complete {hours:02d}:{minutes:02d}:{seconds:02d} ETA={eta:7.1f}{units} tpr={tpr:2.2e} ETF={etf} mem:{mem_use:.1f}MB {system_string}".format( system_number = system_number, total_starcount = self.grid_options["_total_starcount"], complete=(100.0*system_number)/(1.0*self.grid_options["_total_starcount"]) if self.grid_options["_total_starcount"] else -1, @@ -4330,7 +4348,8 @@ eccentricity3=0 units = units, tpr = tpr, etf = etf, - mem_use = total_mem_use + mem_use = total_mem_use, + system_string=system_string ), self.grid_options["verbosity"], 1