77from specparam .utils .array import compute_arr_desc
88from specparam .measures .properties import compute_presence
99from specparam .version import __version__ as MODULE_VERSION
10-
11- ###################################################################################################
12- ###################################################################################################
13-
14- ## Settings & Globals
15- # Centering Value - Long & Short options
16- # Note: Long CV of 98 is so that the max line length plays nice with notebook rendering
17- LCV = 98
18- SCV = 70
10+ from specparam .reports .settings import LCV , SCV , DIVIDER
1911
2012###################################################################################################
2113###################################################################################################
@@ -36,8 +28,7 @@ def gen_issue_str(concise=False):
3628
3729 str_lst = [
3830
39- # Header
40- '=' ,
31+ DIVIDER ,
4132 '' ,
4233 'specparam - ISSUE REPORTING' ,
4334 '' ,
@@ -58,8 +49,7 @@ def gen_issue_str(concise=False):
5849 'You can attach the generated files to a Github issue.' ,
5950 '' ,
6051
61- # Footer
62- '='
52+ DIVIDER ,
6353 ]
6454
6555 output = _format (str_lst , concise )
@@ -113,18 +103,13 @@ def gen_version_str(concise=False):
113103
114104 str_lst = [
115105
116- # Header
117- '=' ,
106+ DIVIDER ,
118107 '' ,
119108 'CODE VERSION' ,
120109 '' ,
121-
122- # Version information
123110 '{}' .format (MODULE_VERSION ),
124-
125- # Footer
126111 '' ,
127- '='
112+ DIVIDER ,
128113
129114 ]
130115
@@ -163,21 +148,17 @@ def gen_modes_str(modes, description=False, concise=False):
163148 # Create output string
164149 str_lst = [
165150
166- # Header
167- '=' ,
151+ DIVIDER ,
168152 '' ,
169153 'FIT MODES' ,
170154 '' ,
171-
172155 # Settings - include descriptions if requested
173156 * [el for el in ['Periodic Mode : {}' .format (modes .periodic .name ),
174157 '{}' .format (desc ['aperiodic_mode' ]),
175158 'Aperiodic Mode : {}' .format (modes .aperiodic .name ),
176159 '{}' .format (desc ['aperiodic_mode' ])] if el != '' ],
177-
178- # Footer
179160 '' ,
180- '='
161+ DIVIDER ,
181162 ]
182163
183164 output = _format (str_lst , concise )
@@ -205,7 +186,7 @@ def gen_settings_str(algorithm, description=False, concise=False):
205186
206187 # Create output string - header
207188 str_lst = [
208- '=' ,
189+ DIVIDER ,
209190 '' ,
210191 'ALGORITHM: {}' .format (algorithm .name ),
211192 ]
@@ -225,10 +206,9 @@ def gen_settings_str(algorithm, description=False, concise=False):
225206 if description :
226207 str_lst .append (algorithm .public_settings .descriptions [name ].split ('\n ' )[0 ])
227208
228- # Add footer to string
229209 str_lst .extend ([
230210 '' ,
231- '='
211+ DIVIDER ,
232212 ])
233213
234214 output = _format (str_lst , concise )
@@ -261,13 +241,13 @@ def gen_metrics_str(metrics, description=False, concise=False):
261241 prints = [metric .label for metric in metrics .metrics ]
262242
263243 str_lst = [
264- '=' ,
244+ DIVIDER ,
265245 '' ,
266246 'CURRENT METRICS' ,
267247 '' ,
268248 * [el for el in prints ],
269249 '' ,
270- '='
250+ DIVIDER ,
271251 ]
272252
273253 output = _format (str_lst , concise )
@@ -294,19 +274,13 @@ def gen_freq_range_str(model, concise=False):
294274
295275 str_lst = [
296276
297- # Header
298- '=' ,
277+ DIVIDER ,
299278 '' ,
300279 'FIT RANGE' ,
301280 '' ,
302-
303- # Frequency range information information
304281 'The model was fit from {} to {} Hz.' .format (* freq_range ),
305-
306- # Footer
307282 '' ,
308- '='
309-
283+ DIVIDER ,
310284 ]
311285
312286 output = _format (str_lst , concise )
@@ -330,23 +304,18 @@ def gen_methods_report_str(concise=False):
330304
331305 str_lst = [
332306
333- # Header
334- '=' ,
307+ DIVIDER ,
335308 '' ,
336309 'REPORTING' ,
337310 '' ,
338-
339- # Methods report information
340311 'Reports using spectral parameterization should include (at minimum):' ,
341312 '' ,
342313 '- the code version that was used' ,
343314 '- the fit modes that were used' ,
344315 '- the algorithm & settings that were used' ,
345316 '- the frequency range that was fit' ,
346-
347- # Footer
348317 '' ,
349- '='
318+ DIVIDER ,
350319 ]
351320
352321 output = _format (str_lst , concise )
@@ -422,8 +391,7 @@ def gen_model_results_str(model, concise=False):
422391 # Create the formatted strings for printing
423392 str_lst = [
424393
425- # Header
426- '=' ,
394+ DIVIDER ,
427395 '' ,
428396 'POWER SPECTRUM MODEL' ,
429397 '' ,
@@ -452,8 +420,7 @@ def gen_model_results_str(model, concise=False):
452420 for key , res in model .results .metrics .results .items ()],
453421 '' ,
454422
455- # Footer
456- '='
423+ DIVIDER ,
457424 ]
458425
459426 output = _format (str_lst , concise )
@@ -482,8 +449,7 @@ def gen_group_results_str(group, concise=False):
482449
483450 str_lst = [
484451
485- # Header
486- '=' ,
452+ DIVIDER ,
487453 '' ,
488454 'GROUP SPECTRAL MODEL RESULTS ({} spectra)' .format (len (group .results .group_results )),
489455 * _report_str_n_null (group ),
@@ -514,9 +480,7 @@ def gen_group_results_str(group, concise=False):
514480 * compute_arr_desc (group .results .get_metrics (label ))) \
515481 for label in group .results .metrics .labels ],
516482 '' ,
517-
518- # Footer
519- '='
483+ DIVIDER ,
520484 ]
521485
522486 output = _format (str_lst , concise )
@@ -550,8 +514,7 @@ def gen_time_results_str(time, concise=False):
550514
551515 str_lst = [
552516
553- # Header
554- '=' ,
517+ DIVIDER ,
555518 '' ,
556519 'TIME SPECTRAL MODEL RESULTS ({} time windows)' .format (time .data .n_time_windows ),
557520 * _report_str_n_null (time ),
@@ -588,8 +551,7 @@ def gen_time_results_str(time, concise=False):
588551 for key in time .results .metrics .results ],
589552 '' ,
590553
591- # Footer
592- '='
554+ DIVIDER ,
593555 ]
594556
595557 output = _format (str_lst , concise )
@@ -623,8 +585,7 @@ def gen_event_results_str(event, concise=False):
623585
624586 str_lst = [
625587
626- # Header
627- '=' ,
588+ DIVIDER ,
628589 '' ,
629590 'EVENT SPECTRAL MODEL RESULTS ({} events with {} time windows)' .format (\
630591 event .data .n_events , event .data .n_time_windows ),
@@ -662,10 +623,7 @@ def gen_event_results_str(event, concise=False):
662623 * compute_arr_desc (np .mean (event .results .event_time_results [key ], 1 ))) \
663624 for key in event .results .metrics .results ],
664625 '' ,
665-
666-
667- # Footer
668- '='
626+ DIVIDER ,
669627 ]
670628
671629 output = _format (str_lst , concise )
@@ -715,11 +673,11 @@ def _no_model_str(concise=False):
715673 """
716674
717675 str_lst = [
718- '=' ,
676+ DIVIDER ,
719677 '' ,
720678 'Model fit has not been run, or fitting was unsuccessful.' ,
721679 '' ,
722- '='
680+ DIVIDER ,
723681 ]
724682
725683 output = _format (str_lst , concise )
0 commit comments