@@ -46,10 +46,11 @@ def single_morph_output(
46
46
save_file
47
47
Name of file to print to. If None (default) print to terminal.
48
48
morph_file
49
- Name of the morphed PDF file. Required when printing to a non-terminal file.
49
+ Name of the morphed PDF file. Required when printing to a
50
+ non-terminal file.
50
51
param xy_out: list
51
- List of the form [x_morph_out, y_morph_out]. x_morph_out is a List of r values and
52
- y_morph_out is a List of gr values.
52
+ List of the form [x_morph_out, y_morph_out]. x_morph_out is a List of
53
+ r values and y_morph_out is a List of gr values.
53
54
verbose: bool
54
55
Print additional details about the morph when True (default False).
55
56
stdout_flag: bool
@@ -107,14 +108,16 @@ def single_morph_output(
107
108
def create_morphs_directory (save_directory ):
108
109
"""Create a directory for saving multiple morphed PDFs.
109
110
110
- Takes in a user-given path to a directory save_directory and create a subdirectory named Morphs.
111
- PDFmorph will save all morphs into the Morphs subdirectory while metadata about the morphs will
112
- be stored in save_directory outside Morphs.
111
+ Takes in a user-given path to a directory save_directory and create a
112
+ subdirectory named Morphs. PDFmorph will save all morphs into the Morphs
113
+ subdirectory while metadata about the morphs will be stored in
114
+ save_directory outside Morphs.
113
115
114
116
Parameters
115
117
----------
116
118
save_directory
117
- Path to a directory. PDFmorph will save all generated files within this directory.
119
+ Path to a directory. PDFmorph will save all generated files within
120
+ this directory.
118
121
119
122
Returns
120
123
-------
@@ -133,8 +136,9 @@ def create_morphs_directory(save_directory):
133
136
134
137
def get_multisave_names (target_list : list , save_names_file = None , mm = False ):
135
138
"""Create or import a dictionary that specifies names to save morphs as.
136
- First attempt to import names from a specified file. If names for certain morphs not found,
137
- use default naming scheme: 'Morph_with_Target_<target file name>.cgr'.
139
+ First attempt to import names from a specified file.
140
+ If names for certain morphs not found, use default naming scheme:
141
+ 'Morph_with_Target_<target file name>.cgr'.
138
142
139
143
Used when saving multiple morphs.
140
144
@@ -150,7 +154,8 @@ def get_multisave_names(target_list: list, save_names_file=None, mm=False):
150
154
Returns
151
155
-------
152
156
dict
153
- The names to save each morph as. Keys are the target PDF file names used to produce that morph.
157
+ The names to save each morph as. Keys are the target PDF file names
158
+ used to produce that morph.
154
159
"""
155
160
156
161
# Dictionary storing save file names
@@ -167,15 +172,19 @@ def get_multisave_names(target_list: list, save_names_file=None, mm=False):
167
172
save_names .update (
168
173
{
169
174
target_file .name : {
170
- __save_morph_as__ : f"Morph_with_Target_{ target_file .stem } .cgr"
175
+ __save_morph_as__ : (
176
+ f"Morph_with_Target_{ target_file .stem } .cgr"
177
+ )
171
178
}
172
179
}
173
180
)
174
181
else :
175
182
save_names .update (
176
183
{
177
184
target_file .name : {
178
- __save_morph_as__ : f"Morph_of_{ target_file .stem } .cgr"
185
+ __save_morph_as__ : (
186
+ f"Morph_of_{ target_file .stem } .cgr"
187
+ )
179
188
}
180
189
}
181
190
)
@@ -209,11 +218,14 @@ def multiple_morph_output(
209
218
save_directory
210
219
Name of directory to save morphs in.
211
220
field
212
- Name of field if data was sorted by a particular field. Otherwise, leave blank.
221
+ Name of field if data was sorted by a particular field.
222
+ Otherwise, leave blank.
213
223
field_list: list
214
- List of field values for each target PDF. Generated by diffpy.pdfmorph.tools.field_sort().
224
+ List of field values for each target PDF.
225
+ Generated by diffpy.pdfmorph.tools.field_sort().
215
226
morph_file
216
- Name of the morphed PDF file. Required to give summary data after saving to a directory.
227
+ Name of the morphed PDF file.
228
+ Required to give summary data after saving to a directory.
217
229
target_directory
218
230
Name of the directory containing the target PDF files.
219
231
Required to give summary data after saving to a directory.
@@ -222,8 +234,8 @@ def multiple_morph_output(
222
234
stdout_flag: bool
223
235
Print to terminal when True (default False).
224
236
mm: bool
225
- Multiple morphs done with a single target rather than multiple targets for a single morphed file.
226
- Swaps morph and target in the code.
237
+ Multiple morphs done with a single target rather than multiple
238
+ targets for a single morphed file. Swaps morph and target in the code.
227
239
"""
228
240
229
241
# Input parameters used for every morph
@@ -235,7 +247,8 @@ def multiple_morph_output(
235
247
# Verbose to get output for every morph
236
248
verbose_outputs = ""
237
249
if verbose :
238
- # Output for every morph (information repeated in a succinct table below)
250
+ # Output for every morph
251
+ # (information repeated in a succinct table below)
239
252
for target in morph_results .keys ():
240
253
if not mm :
241
254
output = f"\n # Target: { target } \n "
@@ -307,24 +320,27 @@ def multiple_morph_output(
307
320
308
321
309
322
def tabulate_results (multiple_morph_results ):
310
- """Helper function to make a data table summarizing details about the results of multiple morphs.
323
+ """Helper function to make a data table summarizing details about the
324
+ results of multiple morphs.
311
325
312
326
Parameters
313
327
----------
314
328
multiple_morph_results
315
- A collection of Dictionaries. Each Dictionary summarizes the resultsof a single morph.
329
+ A collection of Dictionaries. Each Dictionary summarizes the
330
+ resultsof a single morph.
316
331
317
332
Returns
318
333
-------
319
334
tabulated_results: dict
320
- Keys in tabulated_results are the table's column names and each corresponding value is a list
321
- of data for that column.
335
+ Keys in tabulated_results are the table's column names and each
336
+ corresponding value is a list of data for that column.
322
337
"""
323
338
324
339
# We only care about the following parameters in our data tables
325
340
relevant_parameters = ["Scale" , "Smear" , "Stretch" , "Pearson" , "Rw" ]
326
341
327
- # Keys in this table represent column names and the value will be a list of column data
342
+ # Keys in this table represent column names and the value will be a list
343
+ # of column data
328
344
tabulated_results = {}
329
345
for param in relevant_parameters :
330
346
tabulated_results .update (
0 commit comments