Mercurial > repos > gregor.m > spyboat
annotate output_report.py @ 4:a4c6fcf2c456 draft
"planemo upload commit 0584e8878deaf91614c6bb3c0122975300132c25"
author | gregor.m |
---|---|
date | Thu, 26 Nov 2020 16:40:47 +0000 |
parents | 4d7f30a7e2f6 |
children | d5a4180410c4 |
rev | line source |
---|---|
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
1 ''' Produces plots and a summary html 'headless' ''' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
2 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
3 import os |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
4 import matplotlib |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
5 # headless plotting and disable latex |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
6 matplotlib.use('Agg') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
7 matplotlib.rcParams['text.usetex'] = False |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
8 import matplotlib.pyplot as ppl |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
9 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
10 import logging |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
11 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
12 import spyboat.plotting as spyplot |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
13 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
14 logger = logging.getLogger(__name__) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
15 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
16 # figure resolution |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
17 DPI=250 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
18 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
19 def produce_snapshots(input_movie, results, frame, Wkwargs, |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
20 img_path='.'): |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
21 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
22 ''' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
23 Takes the *input_movie* and the |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
24 *results* dictionary from spyboat.processing.run_parallel |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
25 and produces phase, period and amplitude snapshot png's. |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
26 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
27 For the period snapshot also the period range is needed, |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
28 hence the analysis dictionary 'Wkwargs' also gets passed. |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
29 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
30 The output files name pattern is: |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
31 [input, phase, period, amplitude]_frame{frame}.png |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
32 and the storage location in *img_path*. |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
33 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
34 These get picked up by 'create_html' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
35 ''' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
36 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
37 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
38 spyplot.input_snapshot(input_movie[frame]) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
39 fig = ppl.gcf() |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
40 out_path = os.path.join(img_path, f'input_frame{frame}.png') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
41 fig.savefig(out_path, dpi=DPI) |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
42 ppl.close(fig) |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
43 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
44 spyplot.phase_snapshot(results['phase'][frame]) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
45 fig = ppl.gcf() |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
46 out_path = os.path.join(img_path, f'phase_frame{frame}.png') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
47 fig.savefig(out_path, dpi=DPI) |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
48 ppl.close(fig) |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
49 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
50 spyplot.period_snapshot(results['period'][frame], |
4
a4c6fcf2c456
"planemo upload commit 0584e8878deaf91614c6bb3c0122975300132c25"
gregor.m
parents:
3
diff
changeset
|
51 Wkwargs['Tmin'],Wkwargs['Tmax'], |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
52 time_unit = 'a.u.') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
53 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
54 fig = ppl.gcf() |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
55 out_path = os.path.join(img_path, f'period_frame{frame}.png') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
56 fig.savefig(out_path, dpi=DPI) |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
57 ppl.close(fig) |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
58 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
59 spyplot.amplitude_snapshot(results['amplitude'][frame]) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
60 fig = ppl.gcf() |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
61 out_path = os.path.join(img_path, f'amplitude_frame{frame}.png') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
62 fig.savefig(out_path, dpi=DPI) |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
63 ppl.close(fig) |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
64 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
65 logger.info(f'Produced 4 snapshots for frame {frame}..') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
66 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
67 def produce_distr_plots(results, Wkwargs, img_path='.'): |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
68 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
69 ''' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
70 Output file names are: |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
71 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
72 period_distr.png, power_distr.png and phase_distr.png |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
73 ''' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
74 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
75 spyplot.period_distr_dynamics(results['period'], Wkwargs) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
76 fig = ppl.gcf() |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
77 out_path = os.path.join(img_path, f'period_distr.png') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
78 fig.savefig(out_path, dpi=DPI) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
79 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
80 spyplot.power_distr_dynamics(results['power'], Wkwargs) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
81 fig = ppl.gcf() |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
82 out_path = os.path.join(img_path, f'power_distr.png') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
83 fig.savefig(out_path, dpi=DPI) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
84 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
85 spyplot.phase_coherence_dynamics(results['phase'], Wkwargs) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
86 fig = ppl.gcf() |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
87 out_path = os.path.join(img_path, f'phase_distr.png') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
88 fig.savefig(out_path, dpi=DPI) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
89 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
90 logger.info(f'Produced 3 distribution plots..') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
91 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
92 |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
93 def create_html(frame_nums, html_fname='OutputReport.html'): |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
94 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
95 ''' |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
96 The html generated assumes the respective png's |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
97 have been created with 'produce_snapshots' and 'produce_distr_plots' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
98 and can be found at the cwd (that's how Galaxy works..) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
99 ''' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
100 |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
101 # -- create a gallery for every frame in frame_nums -- |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
102 |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
103 galleries = '' |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
104 for frame_num in frame_nums: |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
105 new_gal =f''' |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
106 <div class="FrameSlides"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
107 <h3 style="text-align:center; color=#363333"> Frame Nr. {frame_num} </h3> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
108 |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
109 <div class="snapshot_gallery"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
110 |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
111 <figure class=”snapshot_gallery__item snapshot_gallery__item--1"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
112 <img src="input_frame{frame_num}.png" alt="The Input" class="snapshot_gallery__img"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
113 </figure> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
114 |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
115 <figure class=”snapshot_gallery__item snapshot_gallery__item--2"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
116 <img src="phase_frame{frame_num}.png" alt="Phase" class="snapshot_gallery__img"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
117 </figure> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
118 |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
119 <figure class=”snapshot_gallery__item snapshot_gallery__item--3"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
120 <img src="period_frame{frame_num}.png" alt="Period" class="snapshot_gallery__img"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
121 </figure> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
122 |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
123 <figure class=”snapshot_gallery__item snapshot_gallery__item--4"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
124 <img src="amplitude_frame{frame_num}.png" alt="Amplitude" class="snapshot_gallery__img"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
125 </figure> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
126 </div> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
127 </div> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
128 ''' |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
129 galleries += new_gal |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
130 |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
131 html_string =f''' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
132 <html> |
4
a4c6fcf2c456
"planemo upload commit 0584e8878deaf91614c6bb3c0122975300132c25"
gregor.m
parents:
3
diff
changeset
|
133 <!-- this file got automatically created by 'output_report.py' --> |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
134 <title>SpyBOAT Output Report</title> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
135 <head> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
136 <!-- that doesn't work with galaxy.. --> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
137 <!--link rel="stylesheet" href="styles.css"--> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
138 <style type="text/css"> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
139 body{{ margin:10 100; background:whitesmoke; }} |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
140 /*body{{ margin:10 100; background:darkslategrey; }}*/ |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
141 .center{{ |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
142 text-align: center; |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
143 display: block; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
144 margin-left: auto; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
145 margin-right: auto; |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
146 width: 100%;}} |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
147 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
148 /* matplotlib output at 1600x1200 */ |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
149 .distr_gallery {{ |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
150 display: grid; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
151 margin: 0 auto; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
152 text-align: center; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
153 /* border: 1px dashed rgba(4, 4, 4, 0.35); */ |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
154 grid-template-columns: repeat(3,1fr); |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
155 grid-template-rows: 20vw; |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
156 grid-gap: 0px; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
157 column-gap: 0px |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
158 }} |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
159 .distr_gallery__img {{ |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
160 width: 100%; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
161 height: 100%; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
162 object-fit: contain; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
163 }} |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
164 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
165 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
166 /* matplotlib output at 1600x1200 */ |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
167 .snapshot_gallery {{ |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
168 display: grid; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
169 margin: 0 auto; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
170 border: 1px dashed rgba(4, 4, 4, 0.35); |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
171 text-align: center; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
172 grid-template-columns: repeat(2,1fr); |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
173 grid-template-rows: repeat(2,20vw); |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
174 grid-gap: 5px; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
175 }} |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
176 .snapshot_gallery__img {{ |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
177 width: 100%; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
178 height: 100%; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
179 object-fit: contain; |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
180 }} |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
181 .subheader{{ |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
182 text-align:center; |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
183 font-size: 160%; |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
184 color:#363333;}} |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
185 </style> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
186 </head> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
187 <body> |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
188 <h1 style="text-align:center; color:#363333">SpyBOAT Results Report</h1> |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
189 <hr style="width:50%"> |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
190 <h1 class="subheader"> Distribution Dynamics </h1> |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
191 <div class="distr_gallery"> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
192 <figure class=”distr_gallery__item distr_gallery__item--1"> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
193 <img src="period_distr.png" alt="Period" class="distr_gallery__img"> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
194 </figure> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
195 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
196 <figure class=”distr_gallery__item distr_gallery__item--2"> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
197 <img src="power_distr.png" alt="Power" class="distr_gallery__img"> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
198 </figure> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
199 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
200 <figure class=”distr_gallery__item distr_gallery__item--3"> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
201 <img src="phase_distr.png" alt="Phase" class="distr_gallery__img"> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
202 </figure> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
203 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
204 </div> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
205 |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
206 <h1 class="subheader"> Output Movie Snapshots </h1> |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
207 |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
208 <!-- trigger the javascript at the end---> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
209 <div class="center"> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
210 <button class="w3-button" onclick="plusDivs(-1)">❮ Prev</button> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
211 <button class="w3-button" onclick="plusDivs(1)">Next ❯</button> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
212 </div> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
213 |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
214 <!-- defines all elements of the "FrameSlides" class ---> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
215 {galleries} |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
216 </div> |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
217 |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
218 <!-- javascript with escaped '{{'---> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
219 <script> |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
220 var slideIndex = 1; |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
221 showDivs(slideIndex); |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
222 |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
223 function plusDivs(n) {{ |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
224 showDivs(slideIndex += n); |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
225 }} |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
226 |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
227 function showDivs(n) {{ |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
228 var i; |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
229 var x = document.getElementsByClassName("FrameSlides"); |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
230 if (n > x.length) {{slideIndex = 1}} |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
231 if (n < 1) {{slideIndex = x.length}} ; |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
232 for (i = 0; i < x.length; i++) {{ |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
233 x[i].style.display = "none"; |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
234 }} |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
235 x[slideIndex-1].style.display = "block"; |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
236 }} |
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
237 </script> |
0
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
238 </body> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
239 </html> |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
240 ''' |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
241 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
242 with open(html_fname, 'w') as OUT: |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
243 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
244 OUT.write(html_string) |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
245 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
246 logger.info(f'Created html report') |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
247 return html_string |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
248 |
1d62de03829d
"planemo upload commit c6cd06d44dce1eef9136017289d362f144687dc1"
gregor.m
parents:
diff
changeset
|
249 # for local testing |
3
4d7f30a7e2f6
"planemo upload commit d070f1ba04a5141a65487f45b29c22767639e44b"
gregor.m
parents:
0
diff
changeset
|
250 # create_html([0,20,40,60,80]) |