Skip to content

Commit 36ee24c

Browse files
committed
Reorder options for --help
1 parent 0f79b9f commit 36ee24c

File tree

1 file changed

+60
-59
lines changed

1 file changed

+60
-59
lines changed

src/diffpy/pdfmorph/pdfmorphapp.py

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -90,65 +90,6 @@ def custom_error(self, msg):
9090
minimizing the residual.""",
9191
)
9292

93-
group = optparse.OptionGroup(
94-
parser,
95-
"Multiple Morphs",
96-
"""This program can morph a PDF against multiple targets in one command.
97-
See -s and Plot Options for how saving and plotting functionality changes when performing multiple morphs.""",
98-
)
99-
parser.add_option_group(group)
100-
group.add_option(
101-
"--multiple",
102-
dest="multiple",
103-
action="store_true",
104-
help=f"""Changes usage to \'{prog_short} [options] FILE DIRECTORY\'. FILE
105-
will be morphed with each file in DIRECTORY as target.
106-
Files in DIRECTORY are sorted by alphabetical order unless a field is
107-
specified by --sort-by.""",
108-
)
109-
group.add_option(
110-
"--sort-by",
111-
metavar="FIELD",
112-
dest="field",
113-
help="""Used with --multiple to sort files in DIRECTORY by FIELD from lowest to highest.
114-
FIELD must be included in the header of all the PDF files.""",
115-
)
116-
group.add_option(
117-
"--reverse",
118-
dest="reverse",
119-
action="store_true",
120-
help="""Sort from highest to lowest instead.""",
121-
)
122-
group.add_option(
123-
"--serial-file",
124-
metavar="SERIALFILE",
125-
dest="serfile",
126-
help="""Look for FIELD in a serial file instead.
127-
Must specify name of serial file SERIALFILE.""",
128-
)
129-
group.add_option(
130-
"--save-names-file",
131-
metavar="NAMESFILE",
132-
dest="snamesfile",
133-
help=f"""Used when both -s and --multiple are enabled.
134-
Specify names for each manipulated PDF when saving (see -s) using a serial file
135-
NAMESFILE. The format of NAMESFILE should be as follows: each target PDF
136-
is an entry in NAMESFILE. For each entry, there should be a key {__save_morph_as__}
137-
whose value specifies the name to save the manipulated PDF as.
138-
(See sample names files in the PDFmorph tutorial).""",
139-
)
140-
group.add_option(
141-
"--plot-parameter",
142-
metavar="PLOTPARAM",
143-
dest="plotparam",
144-
help="""Used when both plotting and --multiple are enabled.
145-
Choose a PLOTPARAM to plot for each morph (i.e. adding --pp=Pearson means the program
146-
will display a plot of the Pearson correlation coefficient for each morph-target pair).
147-
PLOTPARAM is not case sensitive, so both Pearson and pearson indicate the same parameter.
148-
When PLOTPARAM is not specified, Rw values for each morph-target pair will be plotted.
149-
PLOTPARAM will be displayed as the vertical axis label for the plot.""",
150-
)
151-
15293
# Manipulations
15394
group = optparse.OptionGroup(
15495
parser,
@@ -269,6 +210,66 @@ def custom_error(self, msg):
269210
group.add_option("--mag", type="float", help="Magnify plot curves beyond MAGLIM by MAG.")
270211
group.add_option("--lwidth", type="float", help="Line thickness of plotted curves.")
271212

213+
# Multiple morph options
214+
group = optparse.OptionGroup(
215+
parser,
216+
"Multiple Morphs",
217+
"""This program can morph a PDF against multiple targets in one command.
218+
See -s and Plot Options for how saving and plotting functionality changes when performing multiple morphs.""",
219+
)
220+
parser.add_option_group(group)
221+
group.add_option(
222+
"--multiple",
223+
dest="multiple",
224+
action="store_true",
225+
help=f"""Changes usage to \'{prog_short} [options] FILE DIRECTORY\'. FILE
226+
will be morphed with each file in DIRECTORY as target.
227+
Files in DIRECTORY are sorted by alphabetical order unless a field is
228+
specified by --sort-by.""",
229+
)
230+
group.add_option(
231+
"--sort-by",
232+
metavar="FIELD",
233+
dest="field",
234+
help="""Used with --multiple to sort files in DIRECTORY by FIELD from lowest to highest.
235+
FIELD must be included in the header of all the PDF files.""",
236+
)
237+
group.add_option(
238+
"--reverse",
239+
dest="reverse",
240+
action="store_true",
241+
help="""Sort from highest to lowest instead.""",
242+
)
243+
group.add_option(
244+
"--serial-file",
245+
metavar="SERIALFILE",
246+
dest="serfile",
247+
help="""Look for FIELD in a serial file instead.
248+
Must specify name of serial file SERIALFILE.""",
249+
)
250+
group.add_option(
251+
"--save-names-file",
252+
metavar="NAMESFILE",
253+
dest="snamesfile",
254+
help=f"""Used when both -s and --multiple are enabled.
255+
Specify names for each manipulated PDF when saving (see -s) using a serial file
256+
NAMESFILE. The format of NAMESFILE should be as follows: each target PDF
257+
is an entry in NAMESFILE. For each entry, there should be a key {__save_morph_as__}
258+
whose value specifies the name to save the manipulated PDF as.
259+
(See sample names files in the PDFmorph tutorial).""",
260+
)
261+
group.add_option(
262+
"--plot-parameter",
263+
metavar="PLOTPARAM",
264+
dest="plotparam",
265+
help="""Used when both plotting and --multiple are enabled.
266+
Choose a PLOTPARAM to plot for each morph (i.e. adding --pp=Pearson means the program
267+
will display a plot of the Pearson correlation coefficient for each morph-target pair).
268+
PLOTPARAM is not case sensitive, so both Pearson and pearson indicate the same parameter.
269+
When PLOTPARAM is not specified, Rw values for each morph-target pair will be plotted.
270+
PLOTPARAM will be displayed as the vertical axis label for the plot.""",
271+
)
272+
272273
# Defaults
273274
parser.set_defaults(multiple=False)
274275
parser.set_defaults(reverse=False)

0 commit comments

Comments
 (0)