Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence aux tools #493

Merged
merged 5 commits into from
Sep 24, 2021
Merged

Silence aux tools #493

merged 5 commits into from
Sep 24, 2021

Conversation

ckuethe
Copy link
Collaborator

@ckuethe ckuethe commented Sep 21, 2021

This set of commits switches command line argument parsing to use getopt(3).

Arguments such as directory, image extension, and output are now handled using command line flags (guess what -d, -e, and -o do), which makes them position insensitive.

I've added some helpful sensible defaults, eg. if you ask to use a nonexistent font for keograms, you get a warning about that, and the program proceeds to use the SIMPLEX font. Keogram font color is now specified as a single hex value string, like colors in HTML, leading # is optional, so you can say something like -C ff0000 or --font-color '#ff0000', whatever you prefer. These don't appear to be used in endOfNight.sh

A help screen is also available with -h or --help. If argument errors are detected, the utility exits with error code 3 (as before), but if the help screen was requested then it exit with error code 0. It is not an error, after all, to ask the program how to correctly invoke it.

From there, I added a -v flag which is used to enable/suppress extra verbose output, such as that emitted for every file read by keogram or startrails. The default is not verbose.

Finally, endOfNight.sh was updated to take advantage of these new command line flags. Apologies for vscode being overly enthusiastic about normalizing all the spaces and tabs.

This is a breaking change and will require `endOfNight.sh` to be updated to
use the new argument format. On the upside, the help screen is prettier, main()
is simpler, and it allows me to do things like

`./keogram -d /tmp/20210919/ -e jpg -o /tmp/k.jpg --font-color '#00ff00' --font-name triplex`

and not be spammed by tons of logs. Of course, if you like that sort of thing,
you are welcome to add `-v` or `--verbose`.
This is a breaking change and will require `endOfNight.sh` to be updated to
use the new argument format. On the upside, the help screen is prettier, main()
is simpler, and it allows me to do things like

	`./startrails -b 0.3 -d /tmp/20210919/ -e jpg -o /tmp/s.jpg`

and not be spammed by tons of logs. Of course, if you like that sort of thing,
you are welcome to add `-v` or `--verbose`.

New feature: summary mode. Just scan the directory without rendering an image:
	`./startrails -s -d /tmp/20210919 -e jpg`
…ails

Since keogram and startrails no longer gratuitously emit a log line per file
processed, it is no longer necessary to create additional log files.

Grrrr, vscode fixed all the tabs 'n' spaces.
@EricClaeys
Copy link
Collaborator

Chris, in keogram.cpp, shouldn't this line:
std::cout << "-r | --r <float> : number of degrees to rotate image, "
be
std::cout << "-r | --rotate <float> : number of degrees to rotate image, "

I thought one reason for keogram to display all the lines was to aid in debugging, if keogram stopped part way through the user could look at the log file (that's now removed in endOfNight.sh) to see where it stopped. Is that no longer needed?

Ditto for startrails. And didn't its output lines include a brightness level to aid the user in debugging problems?

When giving usage examples, I've been changing "ex:" in the scripts to "example:" to help users where english isn't their native language.

@ckuethe
Copy link
Collaborator Author

ckuethe commented Sep 22, 2021

Wait'll you see what else I've got in the pipeline. 🧑‍💻

Anyway, I'm going with "it's probably no longer needed to emit verbose messages by default." I was reprocessing a bunch of startrails and keograms today, and found a few reasons why OpenCV would crash; the logs weren't particularly helpful. In fact, I just looked for the directories with missing keograms or startrails, then ran the program under GDB to find and fix the line of code that triggered the offending assertion. Previously you might want to know what file caused the failure so that you could delete it ... now you don't have to delete it, the programs just skip it and continue.

As for the summary statistics that used to emit - it still does that by default. I never found any value in the file-by-file brightness; the summary statistics were very helpful though, in picking some good settings, and those statistics aren't lost in all the rest of the spew.

Copy link
Collaborator

@EricClaeys EricClaeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@thomasjacquin thomasjacquin merged commit 302520c into AllskyTeam:master Sep 24, 2021
@ckuethe ckuethe deleted the silence_aux_tools branch September 24, 2021 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants