dials / dials

Diffraction Integration for Advanced Light Sources
https://dials.github.io
BSD 3-Clause "New" or "Revised" License
70 stars 47 forks source link

Add a "show all parameters" flag for all DIALS programs #2543

Open phyy-nx opened 10 months ago

phyy-nx commented 10 months ago

One of the most important things I tell new users is to "remember the phrase that pays":

dials.anyprogram -c -e 10 -a 2 | less

It dumps the most useful info possible to a scrollable screen but it is quite the spell users need to know. I suggest a new flag, something like --show-detailed-help or something that shows the -h help strings + the -c -e 10 -a 2 help strings. Bonus points if it drops you into a scrollable screen (like less).

For reference, if it's useful:

phenix.refine -h
--show_defaults=EXPERT_LEVEL
                        Print parameters visible at the given expert level
                        (integer value or "all") and exit. Optionally, append
                        .help, .more, or .all to the expert level, for
                        example:  --show-defaults=all.help

all.help works similarly to what I'm describing above.

rjgildea commented 10 months ago

I added the ability to pass multiple -hhh and /or -vvv for precisely this reason 🙂 https://github.com/dials/dials/pull/1920

phyy-nx commented 10 months ago

Oh yeah! Thanks @rjgildea!

Looking more, I see -vvv in the help string but not -hhh:

$ dials.index -h
usage: dials.index [options] models.expt strong.refl

optional arguments:
  -c, --show-config     Show the configuration parameters.
  -a ATTRIBUTES_LEVEL, --attributes-level ATTRIBUTES_LEVEL
                        Set the attributes level for showing configuration parameters
  -e EXPERT_LEVEL, --expert-level EXPERT_LEVEL
                        Set the expert level for showing configuration parameters
  -h, --help            Show this help message and exit. Can be specified multiple times to increase
                        verbosity.
  -v                    Increase verbosity (can be specified multiple times)
  --phil FILE           PHIL files to read. Pass '-' for STDIN. Can be specified multiple times, but
                        duplicates ignored.

This program attempts to perform autoindexing...

So can we call out -hhh in the same screen?

Also, -a2 is really what I am looking for here to get the help strings. Using your convention from #1920, could we change it to this?

-h equivalent to -ce0a0 -hh equivalent to -ce1a1 -hhh equivalent to -ce2a2 -hhhh equivalent to -ce3a2

rjgildea commented 10 months ago

-hhh is mentioned implicitly?

  -h, --help            Show this help message and exit. Can be specified multiple times to increase
                        verbosity.
  -v                    Increase verbosity (can be specified multiple times)

I think you want e.g. -hhhvv to get the equivalent of -c2e2. I think the example given in the PR isn’t quite correct as support for multiple verbosity was added in a later commit:

-h equivalent to -ce0
-hh equivalent to -ce1
-hhhv equivalent to -ce2a1

https://github.com/dials/dials/pull/1920/commits/c560a628f727bb7b8a6e8a66e1b09f66b091ee12

phyy-nx commented 10 months ago

-hhh is mentioned implicitly?

Ah, missed that

I think you want e.g. -hhhvv to get the equivalent of -c2e2

Huh! Didn't get that I could combine them. That is nice. I wonder though if wouldn't help to be explicit? Something like this?

  -h, --help            Show this help message and exit. Can be specified multiple times to increase verbosity.
  -v                    Increase verbosity (can be specified multiple times)
  --all-help            Show all parameters and help available and exit (equivalent to -c -e10 -a2)
dagewa commented 10 months ago

If you go ahead with this, I would suggest -H as the short form for --all-help

ndevenish commented 10 months ago

I've always thought that a "common parameters shown in -h" would be useful. It's always somewhat hard to justify -ce4 when teaching DIALS