Skip to content

Commit

Permalink
Tweak to progressreport
Browse files Browse the repository at this point in the history
  • Loading branch information
baddstats committed Sep 1, 2023
1 parent 1a77225 commit cb0183e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spatstat.geom
Version: 3.2-4.003
Date: 2023-08-29
Version: 3.2-4.004
Date: 2023-09-01
Title: Geometrical Functionality of the 'spatstat' Family
Authors@R: c(person("Adrian", "Baddeley",
role = c("aut", "cre", "cph"),
Expand Down
8 changes: 7 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
CHANGES IN spatstat.geom VERSION 3.2-4.003
CHANGES IN spatstat.geom VERSION 3.2-4.004

OVERVIEW

o Extension of distance transform algorithm.

o Improvement to progress reports.

o Suppress annoying warnings.

Expand All @@ -12,6 +14,10 @@ SIGNIFICANT USER-VISIBLE CHANGES

o distmap.owin
New argument 'connect'.

o progressreport
The estimated time of completion is also printed, if the remaining time
is longer than 10 minutes.

o unnormdensity
Suppress annoying warning messages from density.default.
Expand Down
16 changes: 11 additions & 5 deletions R/util.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# util.R miscellaneous utilities
#
# $Revision: 1.258 $ $Date: 2023/05/07 04:02:48 $
# $Revision: 1.260 $ $Date: 2023/09/01 03:19:24 $
#

# common invocation of matrixsample
Expand Down Expand Up @@ -116,7 +116,7 @@ progressreport <- local({
# where showevery \in {1, every, n}.
chars.report <- max(1, ceiling(log10(n)))
if(showtime) {
chars.time <- nchar(' [etd 12:00:00] ')
chars.time <- nchar(' [12:00:00 remaining] ')
timesperreport <- if(showevery == 1) every else
if(showevery == every) 1 else 0
chars.report <- chars.report + timesperreport * chars.time
Expand Down Expand Up @@ -325,10 +325,16 @@ progressreport <- local({
cat("\n")
}
if(showtime && i > 1 && i < n && (i %% showevery == 0)) {
etdname <- paste0("etd", if(fallback) "(linear)" else "")
st <- paste(etdname, codetime(round(remaining)))
st <- paste(codetime(round(remaining)),
paste0("remaining",
if(fallback) "(linear)" else ""))
if(longwait <- (remaining > 600)) {
finishtime <- Sys.time() + remaining
st <- paste0(st, ", estimate finish ", round(finishtime))
}
st <- paren(st, "[")
cat(paste("", st, ""))
brk <- if(longwait) "\n" else " "
cat(paste0(brk, st, brk))
}
flush.console()
},
Expand Down
2 changes: 1 addition & 1 deletion inst/doc/packagesizes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
"2023-07-03" "3.2-2" 450 1202 0 35864 15621
"2023-07-20" "3.2-3" 450 1203 0 35915 15747
"2023-07-20" "3.2-4" 450 1203 0 35915 15747
"2023-08-29" "3.2-4.003" 450 1203 0 35924 15822
"2023-09-01" "3.2-4.004" 450 1203 0 35930 15822
9 changes: 6 additions & 3 deletions man/progressreport.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ progressreport(i, n,
the output will be a sequence of dots (one dot for every \code{tick}
iterations), iteration numbers (printed when iteration number is
a multiple of \code{every} or is less than 4),
and optionally the estimated time
remaining. For example \code{[etd 1:20:05]} means an estimated time
of 1 hour, 20 minutes and 5 seconds until finished.
and optionally the estimated time remaining
and the estimated completion time.

The estimated time remaining will be printed only if
\code{style="tty"}, and the argument \code{state} is given,
Expand All @@ -96,6 +95,10 @@ progressreport(i, n,
is longer than 3 minutes, or the average time per iteration is
longer than 20 seconds).

The estimated completion time will be printed only if the
estimated time remaining is printed and the remaining time is
longer than 10 minutes.

By default, the estimated time remaining is calculated
by assuming that each iteration takes the same amount of time,
and extrapolating.
Expand Down

0 comments on commit cb0183e

Please sign in to comment.