[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master cd2b043: MakeProfiles: only print status of pr
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master cd2b043: MakeProfiles: only print status of profiles when they are <50 |
Date: |
Sat, 5 Sep 2020 19:29:28 -0400 (EDT) |
branch: master
commit cd2b043f72db6caa87d6868c8b9cc421eff47ee2
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
MakeProfiles: only print status of profiles when they are <50
Until now, MakeProfiles would print a line for every built profile, and say
that there are "N" profiles left. However, in many scenarios (in paritcular
aperture profiles that are small!) the printing itself can be slower than
the creation time of the profile and this will un-necessarily slow-down the
program.
With this commit, MakeProfiles now only prints the profile status if there
are more than 50 profiles (so the wasted time is not felt). Otherwise, it
just prints a statement that profiles are being built.
---
NEWS | 6 ++++++
bin/mkprof/mkprof.c | 28 ++++++++++++++++++++++++++--
doc/gnuastro.texi | 6 +++---
3 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index c7d590d..850b179 100644
--- a/NEWS
+++ b/NEWS
@@ -111,6 +111,12 @@ See the end of the file for license conditions.
- The 'pow' operator can also accept integer inputs. This also applies
to column arithmetic in Table.
+ MakeProfiles:
+ - The status of every created profile (along with the number of
+ remaining profiles) is no longer printed when there are more than 50
+ profiles. This is done because printing itself can slow down the
+ program an in a general/automated script this info is redundant.
+
Table:
--catcolumnfile ('-L') is new name for '--catcolumn' ('-C').
--catcolumnhdu is new name for '--catcolhdu' (short option name hasn't
diff --git a/bin/mkprof/mkprof.c b/bin/mkprof/mkprof.c
index 40acdf8..b3ea2d7 100644
--- a/bin/mkprof/mkprof.c
+++ b/bin/mkprof/mkprof.c
@@ -747,11 +747,12 @@ mkprof_write(struct mkprofparams *p)
void
mkprof(struct mkprofparams *p)
{
- int err;
char *tmp;
pthread_t t; /* Thread id not used, all are saved here. */
+ int err, origquiet;
pthread_attr_t attr;
pthread_barrier_t b;
+ size_t numforprint=50;
struct mkonthread *mkp;
gal_list_str_t *comments=NULL;
size_t i, fi, *indexs, thrdcols;
@@ -832,8 +833,28 @@ mkprof(struct mkprofparams *p)
}
- /* Write the created arrays into the image. */
+ /* If there are too many profiles, don't print the fact that a profile
+ has been built. */
+ if(p->num>numforprint)
+ {
+ /* Let the user know that building is ongoing. */
+ if(p->cp.quiet==0)
+ printf(" ---- Building %zu profiles... ", p->num);
+
+ /* Disable the quiet flag.*/
+ origquiet=p->cp.quiet;
+ p->cp.quiet=1;
+ }
+
+
+ /* Write the created arrays into the image. Set the original quiet flag
+ and let the user know that its done. */
mkprof_write(p);
+ if(p->num>numforprint)
+ {
+ p->cp.quiet=origquiet;
+ if(p->cp.quiet==0) printf("done.\n");
+ }
/* Write the log file. */
@@ -860,6 +881,9 @@ mkprof(struct mkprofparams *p)
pthread_mutex_destroy(&p->qlock);
}
+ /* If a merged image was created, let the user know.... */
+ if(p->mergedimgname)
+ printf(" -- Output: %s\n", p->mergedimgname);
/* Clean up. */
free(mkp);
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 0c70dc9..c45b1dd 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -16799,9 +16799,9 @@ The columns related to each parameter can be determined
both by number, or by ma
Without any file given to the @option{--background} option, MakeProfiles will
make a zero-valued image and build the profiles on that (its size and main WCS
parameters can also be defined through the options described in
@ref{MakeProfiles output dataset}).
Besides the main/merged image containing all the profiles in the catalog, it
is also possible to build individual images for each profile (only enclosing
one full profile to its truncation radius) with the @option{--individual}
option.
-If an image is given to the @option{--background} option, the pixels of that
image are used as the background value for every pixel.
-The flux value of each profile pixel will be added to the pixel in that
background value.
-In this case, the values to all options relating to the output size and WCS
will be ignored if specified (for example @option{--oversample},
@option{--mergedsize}, and @option{--prepforconv}) on the command-line or in
the configuration files.
+If an image is given to the @option{--background} option, the pixels of that
image are used as the background value for every pixel hence flux value of each
profile pixel will be added to the pixel in that background value.
+You can disable this with the @code{--clearcanvas} option (which will
initialize the background to zero-valued pixels and build profiles over that).
+With the @option{--background} option, the values to all options relating to
the ``canvas'' (output size and WCS) will be ignored if specified, for example
@option{--oversample}, @option{--mergedsize}, and @option{--prepforconv}.
The sections below discuss the options specific to MakeProfiles based on
context: the input catalog settings which can have many rows for different
profiles are discussed in @ref{MakeProfiles catalog}, in @ref{MakeProfiles
profile settings}, we discuss how you can set general profile settings (that
are the same for all the profiles in the catalog).
Finally @ref{MakeProfiles output dataset} and @ref{MakeProfiles log file}
discuss the outputs of MakeProfiles and how you can configure them.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master cd2b043: MakeProfiles: only print status of profiles when they are <50,
Mohammad Akhlaghi <=