Mercurial > repos > iuc > spyboat
comparison output_report.py @ 1:639d2031d998 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/packages/spyboat commit 88e9d9a220d160f55e0472719bb463143a4eefa5"
author | iuc |
---|---|
date | Mon, 30 Nov 2020 21:11:23 +0000 |
parents | 76733d05d8ef |
children |
comparison
equal
deleted
inserted
replaced
0:76733d05d8ef | 1:639d2031d998 |
---|---|
84 fig.savefig(out_path, dpi=DPI) | 84 fig.savefig(out_path, dpi=DPI) |
85 | 85 |
86 logger.info("Produced 3 distribution plots..") | 86 logger.info("Produced 3 distribution plots..") |
87 | 87 |
88 | 88 |
89 def create_html(frame_nums, html_fname="OutputReport.html"): | 89 def create_html(frame_nums, par_str, html_fname="OutputReport.html"): |
90 """ | 90 """ |
91 The html generated assumes the respective png's | 91 The html generated assumes the respective png's |
92 have been created with 'produce_snapshots' and 'produce_distr_plots' | 92 have been created with 'produce_snapshots' and 'produce_distr_plots' |
93 and can be found at the cwd (that's how Galaxy works..) | 93 and can be found at the cwd (that's how Galaxy works..) |
94 """ | 94 """ |
103 Frame Nr. {frame_num} </h3> | 103 Frame Nr. {frame_num} </h3> |
104 | 104 |
105 <div class="snapshot_gallery"> | 105 <div class="snapshot_gallery"> |
106 | 106 |
107 <figure class=”snapshot_gallery__item | 107 <figure class=”snapshot_gallery__item |
108 snapshot_gallery__item--1"> | 108 snapshot_gallery__item--1" style="margin: 0 0"> |
109 <img src="input_frame{frame_num}.png" alt="The Input" | 109 <img src="input_frame{frame_num}.png" alt="The Input" |
110 class="snapshot_gallery__img"> | 110 class="snapshot_gallery__img"> |
111 </figure> | 111 </figure> |
112 | 112 |
113 <figure class=”snapshot_gallery__item | 113 <figure class=”snapshot_gallery__item |
114 snapshot_gallery__item--2"> | 114 snapshot_gallery__item--2" style="margin: 0 0"> |
115 <img src="phase_frame{frame_num}.png" alt="Phase" | 115 <img src="phase_frame{frame_num}.png" alt="Phase" |
116 class="snapshot_gallery__img"> | 116 class="snapshot_gallery__img"> |
117 </figure> | 117 </figure> |
118 | 118 |
119 <figure class=”snapshot_gallery__item | 119 <figure class=”snapshot_gallery__item |
120 snapshot_gallery__item--3"> | 120 snapshot_gallery__item--3" style="margin: 0 0"> |
121 <img src="period_frame{frame_num}.png" | 121 <img src="period_frame{frame_num}.png" |
122 alt="Period" class="snapshot_gallery__img"> | 122 alt="Period" class="snapshot_gallery__img"> |
123 </figure> | 123 </figure> |
124 | 124 |
125 <figure class=”snapshot_gallery__item | 125 <figure class=”snapshot_gallery__item |
126 snapshot_gallery__item--4"> | 126 snapshot_gallery__item--4" style="margin: 0 0"> |
127 <img src="amplitude_frame{frame_num}.png" | 127 <img src="amplitude_frame{frame_num}.png" |
128 alt="Amplitude" class="snapshot_gallery__img"> | 128 alt="Amplitude" class="snapshot_gallery__img"> |
129 </figure> | 129 </figure> |
130 </div> | 130 </div> |
131 </div> | 131 </div> |
132 """ | 132 """ |
133 galleries += new_gal | 133 galleries += new_gal |
134 | |
135 parameter_cells = '' | |
136 for line in par_str.split('\n'): | |
137 # last str is empty.. | |
138 if not line: | |
139 break | |
140 par_name, par_val = line.split('->') | |
141 parameter_cells += f''' | |
142 <tr> | |
143 <td>{par_name}</td> | |
144 <td>{par_val}</td> | |
145 </tr>''' | |
134 | 146 |
135 html_string = f""" | 147 html_string = f""" |
136 <html> | 148 <html> |
137 <!-- this file got automatically created by 'output_report.py' --> | 149 <!-- this file got automatically created by 'output_report.py' --> |
138 <title>SpyBOAT Output Report</title> | 150 <title>SpyBOAT Output Report</title> |
139 <head> | 151 <head> |
140 <!-- that doesn't work with galaxy.. --> | 152 <!-- that doesn't work with galaxy.. --> |
141 <!--link rel="stylesheet" href="styles.css"--> | 153 <!--link rel="stylesheet" href="styles.css"--> |
142 <style type="text/css"> | 154 <style type="text/css"> |
143 body{{ margin:10 100; background:whitesmoke; }} | 155 body{{ margin:10 100; background:whitesmoke; }} |
144 /*body{{ margin:10 100; background:darkslategrey; }}*/ | 156 p{{ |
157 text-align: center; | |
158 margin-top: 0.05cm; | |
159 margin-bottom: .05cm; | |
160 color:#2c2e2e; | |
161 }} | |
145 .center{{ | 162 .center{{ |
146 text-align: center; | 163 text-align: center; |
147 display: block; | 164 display: block; |
148 margin-left: auto; | 165 margin-left: auto; |
149 margin-right: auto; | 166 margin-right: auto; |
150 width: 100%;}} | 167 width: 100%;}} |
151 | 168 |
152 /* matplotlib output at 1600x1200 */ | 169 /* matplotlib output at 1600x1200 */ |
153 .distr_gallery {{ | 170 .snapshot_gallery {{ |
171 margin: 0 0; | |
172 text-align: center; | |
154 display: grid; | 173 display: grid; |
155 margin: 0 auto; | |
156 text-align: center; | |
157 /* border: 1px dashed rgba(4, 4, 4, 0.35); */ | |
158 grid-template-columns: repeat(3,1fr); | |
159 grid-template-rows: 20vw; | |
160 grid-gap: 0px; | |
161 column-gap: 0px | |
162 }} | |
163 .distr_gallery__img {{ | |
164 width: 100%; | |
165 height: 100%; | |
166 object-fit: contain; | |
167 }} | |
168 | |
169 | |
170 /* matplotlib output at 1600x1200 */ | |
171 .snapshot_gallery {{ | |
172 display: grid; | |
173 margin: 0 auto; | |
174 border: 1px dashed rgba(4, 4, 4, 0.35); | |
175 text-align: center; | |
176 grid-template-columns: repeat(2,1fr); | 174 grid-template-columns: repeat(2,1fr); |
177 grid-template-rows: repeat(2,20vw); | 175 grid-template-rows: repeat(2,27vw); |
178 grid-gap: 5px; | 176 grid-gap: 5px; |
179 }} | 177 }} |
178 | |
180 .snapshot_gallery__img {{ | 179 .snapshot_gallery__img {{ |
181 width: 100%; | 180 width: 100%; |
182 height: 100%; | 181 height: 100%; |
183 object-fit: contain; | 182 object-fit: contain; |
183 margin-top: 5px; | |
184 margin-bottom: 15px; | |
184 }} | 185 }} |
185 .subheader{{ | 186 .subheader{{ |
186 text-align:center; | 187 text-align:center; |
187 font-size: 160%; | 188 font-size: 160%; |
188 color:#363333;}} | 189 color:#363333;}} |
190 .centerimg{{ | |
191 text-align: center; | |
192 width: 65%; | |
193 max-width: 400px; | |
194 display: block; | |
195 padding: 10px; | |
196 margin-left: auto; | |
197 margin-right: auto; | |
198 }} | |
199 | |
200 .div_distr{{ | |
201 text-align: center; | |
202 border-radius: 25px; | |
203 margin-top: 1cm; | |
204 margin: auto; | |
205 margin-bottom: 0.5cm; | |
206 background-color: #cce1e3; | |
207 max-width: 550px; | |
208 }} | |
209 | |
210 .partable{{ | |
211 width: 70%; | |
212 margin-left: auto; | |
213 margin-right: auto; | |
214 }} | |
215 | |
216 tr, td{{ | |
217 color:#2c2e2e; | |
218 font-size: 110%; | |
219 }} | |
220 | |
189 </style> | 221 </style> |
190 </head> | 222 </head> |
191 <body> | 223 <body> |
192 <h1 style="text-align:center; color:#363333">SpyBOAT Results Report</h1> | 224 <h1 style="text-align:center; color:#363333">SpyBOAT Results Report</h1> |
193 <hr style="width:50%"> | 225 <hr style="width:70%"> |
194 <h1 class="subheader"> Distribution Dynamics </h1> | 226 |
195 <div class="distr_gallery"> | 227 <h1 class="subheader"> Spatial Summary Statistics </h1> |
196 <figure class=”distr_gallery__item distr_gallery__item--1"> | 228 <div class="div_distr"> |
197 <img src="period_distr.png" alt="Period" class="distr_gallery__img"> | 229 <img src="period_distr.png" alt="Period" |
198 </figure> | 230 class="centerimg"> |
199 | 231 <p> Median and quartiles of the estimated periods for each frame </p> |
200 <figure class=”distr_gallery__item distr_gallery__item--2"> | 232 </div> |
201 <img src="power_distr.png" alt="Power" class="distr_gallery__img"> | 233 |
202 </figure> | 234 |
203 | 235 <div class="div_distr"> |
204 <figure class=”distr_gallery__item distr_gallery__item--3"> | 236 <img src="power_distr.png" alt="Period" |
205 <img src="phase_distr.png" alt="Phase" class="distr_gallery__img"> | 237 class="centerimg"> |
206 </figure> | 238 <p> Median and quartiles of the ridge wavelet power for each frame </p> |
239 </div> | |
240 <div class="div_distr"> | |
241 <img src="phase_distr.png" alt="Period" | |
242 class="centerimg"> | |
243 <p> Kuramoto order parameter for the phases estimated for each frame </p> | |
207 | 244 |
208 </div> | 245 </div> |
209 | 246 |
210 <h1 class="subheader"> Output Movie Snapshots </h1> | 247 <h1 class="subheader"> Output Movie Snapshots </h1> |
211 | 248 |
215 <button class="w3-button" onclick="plusDivs(1)">Next ❯</button> | 252 <button class="w3-button" onclick="plusDivs(1)">Next ❯</button> |
216 </div> | 253 </div> |
217 | 254 |
218 <!-- defines all elements of the "FrameSlides" class ---> | 255 <!-- defines all elements of the "FrameSlides" class ---> |
219 {galleries} | 256 {galleries} |
257 </div> | |
258 | |
259 <h1 class="subheader"> Parameters </h1> | |
260 <div class="div_distr"> | |
261 <table border = "1" class="partable"> | |
262 <tr> | |
263 <th>Name</th> | |
264 <th>Value</th> | |
265 </tr> | |
266 {parameter_cells} | |
267 </table> | |
220 </div> | 268 </div> |
221 | 269 |
222 <!-- javascript with escaped '{{'---> | 270 <!-- javascript with escaped '{{'---> |
223 <script> | 271 <script> |
224 var slideIndex = 1; | 272 var slideIndex = 1; |
248 | 296 |
249 logger.info("Created html report") | 297 logger.info("Created html report") |
250 return html_string | 298 return html_string |
251 | 299 |
252 # for local testing | 300 # for local testing |
253 # create_html([0,20,40,60,80]) | 301 # create_html([0,20], 'par1 -> val1\n verylongpar2 -> val2') |