@@ -279,18 +279,11 @@ def write_data(self, save_path, fitname, weights_name):
279279 replica_path .mkdir (exist_ok = True , parents = True )
280280
281281 self ._write_chi2s (replica_path / "chi2exps.log" )
282- self ._write_would_stop_epoch (replica_path / "would_stop_epoch.txt" )
283282 self ._write_metadata_json (i , replica_path / f"{ fitname } .json" )
284283 self ._export_pdf_grid (i , replica_path / f"{ fitname } .exportgrid" )
285284 if weights_name :
286285 self ._write_weights (i , replica_path / f"{ weights_name } " )
287286
288- def _write_would_stop_epoch (self , out_path ):
289- epoch = self .stopping_object .would_stop_epoch
290- with open (out_path , "w" , encoding = "utf-8" ) as f :
291- f .write (str (epoch ) if epoch is not None else "None" )
292- f .write ("\n " )
293-
294287 def _write_chi2s (self , out_path ):
295288 # Note: same for all replicas, unless run separately
296289 chi2_log = self .stopping_object .chi2exps_json ()
@@ -310,6 +303,11 @@ def _write_metadata_json(self, i, out_path):
310303 # Note: the 2 arguments below are the same for all replicas, unless run separately
311304 timing = self .timings ,
312305 stop_epoch = self .stopping_object .stop_epoch ,
306+ would_stop_epoch = (
307+ self .stopping_object .would_stop_epoch
308+ if self .stopping_object ._dont_stop
309+ else self .stopping_object .stop_epoch
310+ ),
313311 )
314312
315313 with open (out_path , "w" , encoding = "utf-8" ) as fs :
@@ -354,6 +352,7 @@ def jsonfit(
354352 true_chi2 ,
355353 stop_epoch ,
356354 timing ,
355+ would_stop_epoch ,
357356):
358357 """Generates a dictionary containing all relevant metadata for the fit
359358
@@ -379,6 +378,8 @@ def jsonfit(
379378 epoch at which the stopping stopped (not the one for the best fit!)
380379 timing: dict
381380 dictionary of the timing of the different events that happened
381+ would_stop_epoch: int
382+ epoch at which the stopping would have stopped if it were not set to "dont_stop"
382383 """
383384 all_info = {}
384385 # Generate preprocessing information
@@ -393,6 +394,7 @@ def jsonfit(
393394 all_info ["arc_lengths" ] = arc_lengths
394395 all_info ["integrability" ] = integrability_numbers
395396 all_info ["timing" ] = timing
397+ all_info ["would_stop_epoch" ] = would_stop_epoch
396398 # Versioning info
397399 all_info ["version" ] = version ()
398400 return all_info
0 commit comments