@@ -52,8 +52,8 @@ def custom_error(self, msg):
5252 parser = CustomParser (
5353 usage = "\n " .join (
5454 [
55- "%prog [options] FILE1 FILE2 " ,
56- "Manipulate and compare PDFs ." ,
55+ "%prog [options] MORPHFILE TARGETFILE " ,
56+ "Manipulate and compare functions ." ,
5757 "Use --help for help." ,
5858 ]
5959 ),
@@ -82,10 +82,10 @@ def custom_error(self, msg):
8282 dest = "slocation" ,
8383 help = (
8484 "Save the manipulated function to a file named NAME. "
85- "Use '-' for stdout.\n "
85+ "Use '-' for stdout. "
8686 "When --multiple-<targets/morphs> is enabled, "
8787 "save each manipulated function as a file in a directory "
88- "named NAME; \n "
88+ "named NAME. "
8989 "you can specify names for each saved function file using "
9090 "--save-names-file."
9191 ),
@@ -96,8 +96,8 @@ def custom_error(self, msg):
9696 dest = "get_diff" ,
9797 action = "store_true" ,
9898 help = (
99- "Save the difference curve rather than the manipulated function.\n "
100- "This is computed as manipulated function minus target function.\n "
99+ "Save the difference curve rather than the manipulated function. "
100+ "This is computed as manipulated function minus target function. "
101101 "The difference curve is computed on the interval shared by the "
102102 "grid of the objective and target function."
103103 ),
@@ -141,21 +141,23 @@ def custom_error(self, msg):
141141 "--addpearson" ,
142142 action = "store_true" ,
143143 dest = "addpearson" ,
144- help = """Maximize agreement in the Pearson function as well as
145- minimizing the residual.""" ,
144+ help = (
145+ "Maximize agreement in the Pearson function as well as "
146+ "minimizing the residual."
147+ ),
146148 )
147149
148150 # Manipulations
149151 group = optparse .OptionGroup (
150152 parser ,
151153 "Manipulations" ,
152154 (
153- "These options select the manipulations that are to be applied to "
154- "the PDF from FILE1 . "
155+ "These options select the manipulations that are to be applied "
156+ "to the function from MORPHFILE . "
155157 "The passed values will be refined unless specifically "
156158 "excluded with the -a or -x options. "
157- "If no option is specified, the PDFs from FILE1 and FILE2 will "
158- "be plotted without any manipulations."
159+ "If no option is specified, the functions from MORPHFILE and "
160+ "TARGETFILE will be plotted without any manipulations."
159161 ),
160162 )
161163 parser .add_option_group (group )
@@ -237,8 +239,11 @@ def custom_error(self, msg):
237239 "--slope" ,
238240 type = "float" ,
239241 dest = "baselineslope" ,
240- help = """Slope of the baseline. This is used with the option --smear-pdf
241- to convert from the PDF to RDF. It will be estimated if not provided.""" ,
242+ help = (
243+ "Slope of the baseline. This is used with the option "
244+ "--smear-pdf to convert from the PDF to RDF. "
245+ "It will be estimated if not provided."
246+ ),
242247 )
243248 group .add_option (
244249 "--hshift" ,
@@ -308,9 +313,9 @@ def custom_error(self, msg):
308313 parser ,
309314 "Plot Options" ,
310315 (
311- "These options control plotting. The manipulated and target PDFs "
312- "will be plotted against each other with a difference curve "
313- "below. "
316+ "These options control plotting. The manipulated and target"
317+ "functions will be plotted against each other with a difference "
318+ "curve below. "
314319 "When --multiple-<targets/morphs> is enabled, the value of a "
315320 "parameter (specified by --plot-parameter) will be plotted "
316321 "instead."
@@ -330,7 +335,7 @@ def custom_error(self, msg):
330335 dest = "mlabel" ,
331336 help = (
332337 "Set label for morphed data to MLABEL on plot. "
333- "Default label is FILE1 ."
338+ "Default label is MORPHFILE ."
334339 ),
335340 )
336341 group .add_option (
@@ -339,7 +344,7 @@ def custom_error(self, msg):
339344 dest = "tlabel" ,
340345 help = (
341346 "Set label for target data to TLABEL on plot. "
342- "Default label is FILE2 ."
347+ "Default label is TARGETFILE ."
343348 ),
344349 )
345350 group .add_option (
@@ -355,12 +360,12 @@ def custom_error(self, msg):
355360 group .add_option (
356361 "--maglim" ,
357362 type = "float" ,
358- help = "Magnify plot curves beyond r =MAGLIM by MAG." ,
363+ help = "Magnify plot curves beyond x =MAGLIM by MAG." ,
359364 )
360365 group .add_option (
361366 "--mag" ,
362367 type = "float" ,
363- help = "Magnify plot curves beyond r =MAGLIM by MAG." ,
368+ help = "Magnify plot curves beyond x =MAGLIM by MAG." ,
364369 )
365370 group .add_option (
366371 "--lwidth" , type = "float" , help = "Line thickness of plotted curves."
@@ -371,8 +376,9 @@ def custom_error(self, msg):
371376 parser ,
372377 "Multiple Morphs" ,
373378 (
374- "This program can morph a PDF against multiple targets in one "
375- "command. See -s and Plot Options for how saving and plotting "
379+ "This program can morph a function against multiple targets in"
380+ " one command. "
381+ "See -s and Plot Options for how saving and plotting "
376382 "functionality changes when performing multiple morphs."
377383 ),
378384 )
@@ -382,33 +388,51 @@ def custom_error(self, msg):
382388 dest = "multiple_morphs" ,
383389 action = "store_true" ,
384390 help = (
385- f"Changes usage to '{ prog_short } [options] FILE DIRECTORY'. "
386- f"FILE will be morphed with each file in DIRECTORY as target. "
387- f"Files in DIRECTORY are sorted by alphabetical order unless a "
388- f"field is specified by --sort-by."
391+ f"Usage: '{ prog_short } --multiple-morphs [options] DIRECTORY "
392+ f"TARGET'. "
393+ f"Morphs every file in DIRECTORY to the a single TARGET file. "
394+ f"Paths for DIRECTORY and TARGET are relative to the current "
395+ f"working directory. "
396+ "By default, the Rw for each morph is plotted, where the x-axis "
397+ "is sorted alphanumerically by filename of the file being "
398+ "morphed. "
399+ "Use --sort-by option to change the x-axis order. "
400+ "Use --plot-parameter to modify the parameter plotted on the "
401+ "y-axis."
389402 ),
390403 )
391404 group .add_option (
392405 "--multiple-targets" ,
393406 dest = "multiple_targets" ,
394407 action = "store_true" ,
395408 help = (
396- f"Changes usage to '{ prog_short } [options] DIRECTORY FILE'. "
397- f"Each file in DIRECTORY will be morphed with FILE as target. "
398- f"Files in DIRECTORY are sorted by alphabetical order unless a "
399- f"field is specified by --sort-by."
409+ f"Usage: '{ prog_short } --multiple-targets [options] MORPH "
410+ f"DIRECTORY'. "
411+ f"Morphs the MORPH file to every file in DIRECTORY. "
412+ f"Paths for MORPH and DIRECTORY are relative to the current "
413+ f"working directory. "
414+ "By default, the Rw for each morph is plotted, where the x-axis "
415+ "is sorted alphanumerically by filename of the file being "
416+ "morphed. "
417+ "Use --sort-by option to change the x-axis order. "
418+ "Use --plot-parameter to modify the parameter plotted on the "
419+ "y-axis."
400420 ),
401421 )
402422 group .add_option (
403423 "--sort-by" ,
404424 metavar = "FIELD" ,
405425 dest = "field" ,
406426 help = (
407- "Used with --multiple-<targets/morphs> to sort files in DIRECTORY "
408- "by FIELD. "
409- "If the FIELD being used has a numerical value, sort from lowest "
410- "to highest. Otherwise, sort in ASCII sort order. FIELD must be "
411- "included in the header of all the PDF files."
427+ "Used with --multiple-<targets/morphs> to sort files in "
428+ "DIRECTORY by FIELD. "
429+ "If the FIELD being used has a numerical value, sort from "
430+ "lowest to highest unless --reverse is enabled. "
431+ "Otherwise, sort in ASCII sort order. "
432+ "The program will look for the FIELD (case insensitive) in the "
433+ "header of each of the files in DIRECTORY. "
434+ "If plotting is enabled, the x-axis of the plot will be the "
435+ "field."
412436 ),
413437 )
414438 group .add_option (
@@ -421,8 +445,10 @@ def custom_error(self, msg):
421445 "--serial-file" ,
422446 metavar = "SERIALFILE" ,
423447 dest = "serfile" ,
424- help = """Look for FIELD in a serial file instead.
425- Must specify name of serial file SERIALFILE.""" ,
448+ help = (
449+ "Look for FIELD in a serial file instead. "
450+ "Must specify name of serial file SERIALFILE."
451+ ),
426452 )
427453 group .add_option (
428454 "--save-names-file" ,
@@ -431,10 +457,11 @@ def custom_error(self, msg):
431457 help = (
432458 "Used when both -s and --multiple-<targets/morphs> are enabled. "
433459 "Specify names for each manipulated PDF when saving (see -s) "
434- "using a serial file NAMESFILE. The format of NAMESFILE should be "
435- "as follows: each target PDF is an entry in NAMESFILE. For each "
436- "entry, there should be a key {__save_morph_as__} whose value "
437- "specifies the name to save the manipulated function as."
460+ "using a serial file NAMESFILE. The format of NAMESFILE should "
461+ "be as follows: each target PDF is an entry in NAMESFILE. "
462+ "For each entry, there should be a key {__save_morph_as__} "
463+ "whose value specifies the name to save the manipulated "
464+ "function as."
438465 "An example .json serial file is included in the tutorial "
439466 "directory on the package GitHub repository."
440467 ),
@@ -472,10 +499,11 @@ def single_morph(
472499 parser , opts , pargs , stdout_flag = True , python_wrap = False , pymorphs = None
473500):
474501 if len (pargs ) < 2 :
475- parser .error ("You must supply FILE1 and FILE2 ." )
502+ parser .error ("You must supply MORPHFILE and TARGETFILE ." )
476503 elif len (pargs ) > 2 and not python_wrap :
477504 parser .error (
478- "Too many arguments. Make sure you only supply FILE1 and FILE2."
505+ "Too many arguments. Make sure you only supply "
506+ "MORPHFILE and TARGETFILE."
479507 )
480508 elif not (len (pargs ) == 2 or len (pargs ) == 6 ) and python_wrap :
481509 parser .error ("Python wrapper error." )
@@ -836,7 +864,7 @@ def multiple_targets(parser, opts, pargs, stdout_flag=True, python_wrap=False):
836864 # applied
837865 if len (pargs ) < 2 :
838866 parser .custom_error (
839- "You must supply FILE and DIRECTORY. "
867+ "You must supply a FILE and DIRECTORY. "
840868 "See --multiple-targets under --help for usage."
841869 )
842870 elif len (pargs ) > 2 :
@@ -895,7 +923,7 @@ def multiple_targets(parser, opts, pargs, stdout_flag=True, python_wrap=False):
895923 )
896924 else :
897925 parser .custom_error (
898- "The requested field is missing from a PDF file header."
926+ "The requested field is missing from a file header."
899927 )
900928 else :
901929 # Default is alphabetical sort
@@ -910,7 +938,7 @@ def multiple_targets(parser, opts, pargs, stdout_flag=True, python_wrap=False):
910938 save_names_file = (
911939 opts .snamesfile
912940 ) # User-given serialfile with names for each morph
913- save_morphs_here = None # Subdirectory for saving morphed PDFs
941+ save_morphs_here = None # Subdirectory for saving morphed functions
914942 save_names = {} # Dictionary of names to save each morph as
915943 if save_directory is not None :
916944 try :
@@ -1019,7 +1047,7 @@ def multiple_morphs(parser, opts, pargs, stdout_flag=True, python_wrap=False):
10191047 # applied
10201048 if len (pargs ) < 2 :
10211049 parser .custom_error (
1022- "You must supply DIRECTORY and FILE. "
1050+ "You must supply a DIRECTORY and FILE. "
10231051 "See --multiple-morphs under --help for usage."
10241052 )
10251053 elif len (pargs ) > 2 :
0 commit comments