Skip to content

Commit

Permalink
avoid unnecessary time() call
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jul 16, 2024
1 parent 4c46a54 commit e92046a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions petric.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, transverse_slice=None, coronal_slice=None, vmax=None, logdir=
def __call__(self, algo: Algorithm):
if self.skip_iteration(algo):
return
t = getattr(self, '__time', time())
t = getattr(self, '__time', None) or time()
log.debug("logging iter %d...", algo.iteration)
# initialise `None` values
self.transverse_slice = algo.x.dimensions()[0] // 2 if self.transverse_slice is None else self.transverse_slice
Expand Down Expand Up @@ -118,7 +118,7 @@ def __init__(self, reference_image, whole_object_mask, background_mask, interval
def __call__(self, algo: Algorithm):
if self.skip_iteration(algo):
return
t = getattr(self, '__time', time())
t = getattr(self, '__time', None) or time()
for tag, value in self.evaluate(algo.x).items():
self.tb_summary_writer.add_scalar(tag, value, algo.iteration, t)

Expand Down

0 comments on commit e92046a

Please sign in to comment.