@@ -129,7 +129,7 @@ def get_terminal_morph_output(mr_copy, uncertainties):
129129 # Handle special inputs (numerical)
130130 if "squeeze" in mr_copy :
131131 sq_dict = mr_copy .pop ("squeeze" )
132- rw_pos = list (mr_copy .keys ()).index ("Rw " )
132+ rw_pos = list (mr_copy .keys ()).index ("rw " )
133133 morph_results_list = list (mr_copy .items ())
134134 for idx , _ in enumerate (sq_dict ):
135135 morph_results_list .insert (
@@ -148,22 +148,28 @@ def get_terminal_morph_output(mr_copy, uncertainties):
148148 func_dicts [func ][0 ] = mr_copy .pop (f"{ func } _function" )
149149 if func in mr_copy :
150150 func_dicts [func ][1 ] = mr_copy .pop (func )
151- rw_pos = list (mr_copy .keys ()).index ("Rw " )
151+ rw_pos = list (mr_copy .keys ()).index ("rw " )
152152 morph_results_list = list (mr_copy .items ())
153153 for idx , key in enumerate (func_dicts [func ][1 ]):
154154 morph_results_list .insert (
155155 rw_pos + idx , (f"{ func } { key } " , func_dicts [func ][1 ][key ])
156156 )
157157 mr_copy = dict (morph_results_list )
158158
159- # Get uncertainties
159+ # Keywords that should be capitalized in the saved files
160+ special_keywords = ["rw" , "pearson" ]
161+
162+ # Print outputs including uncertainties when applicable
160163 if uncertainties is None :
161164 morphs_out += "\n " .join (
162- f"# { key } = { mr_copy [key ]:.6f} " for key in mr_copy .keys ()
165+ f"# { key .capitalize () if key in special_keywords else key } = "
166+ f"{ mr_copy [key ]:.6f} "
167+ for key in mr_copy .keys ()
163168 )
164169 else :
165170 morphs_out += "\n " .join (
166- f"# { key } = { mr_copy [key ]:.6f} "
171+ f"# { key .capitalize () if key in special_keywords else key } = "
172+ f"{ mr_copy [key ]:.6f} "
167173 + (
168174 f" +/- { uncertainties [key ]:.6f} "
169175 if key in uncertainties
@@ -431,11 +437,11 @@ def multiple_morph_output(
431437
432438 # Table labels
433439 if not mm :
434- labels = "\n # Labels: [Target ]"
440+ labels = "\n # Labels: [target ]"
435441 else :
436- labels = "\n # Labels: [Morph ]"
442+ labels = "\n # Labels: [morph ]"
437443 if field is not None :
438- labels += f" [{ field } ]"
444+ labels += f" [{ field . lower () } ]"
439445 for param in tabulated_results .keys ():
440446 if len (tabulated_results [param ]) > 0 :
441447 labels += f" [{ param } ]"
@@ -501,7 +507,7 @@ def tabulate_results(multiple_morph_results):
501507 corresponding value is a list of data for that column.
502508 """
503509 # We only care about the following parameters in our data tables
504- relevant_parameters = ["Scale " , "Smear " , "Stretch " , "Pearson " , "Rw " ]
510+ relevant_parameters = ["scale " , "smear " , "stretch " , "pearson " , "rw " ]
505511
506512 # Keys in this table represent column names and the value will be a list
507513 # of column data
0 commit comments