source: trunk/templates/uvspectra.html@ 51

Last change on this file since 51 was 51, checked in by JohnLightfoot, 10 years ago

almost working

File size: 1.3 KB
Line 
1<%inherit file="base.html"/>
2
3<!-- do the plotting -->
4<%
5import os.path
6import numpy as np
7import common.commonobjects as co
8
9uvspectra = context['data']['uvspectra']['uvspectra']
10
11data = []
12flag = []
13opd = []
14
15baseline_link = {}
16
17for uvspectrum in uvspectra:
18 # construct Spectrum object
19 axis = co.Axis(data=np.array(uvspectrum.wavenumber),
20 title='wavenumber', units='cm-1')
21 scan = co.Spectrum(data=uvspectrum.spectrum,
22 axis=axis, title='Spectrum',
23 units='W sr-1 m-2 Hz-1')
24
25 # construct a page with the plot
26 baseline = (uvspectrum.baseline_x, uvspectrum.baseline_y)
27 filename = 'uvspectrum_%s_%s.html' % baseline
28 filename = filename.replace('-', 'm')
29 baseline_link[baseline] = filename
30 link = os.path.join(context['dirname'], filename)
31 with open(link, 'w') as f:
32 template = mylookup.get_template('sourcespectrum.html')
33 context_copy = context.kwargs
34 context_copy['sourceid'] = '_%s_%s_spectrum' % (baseline)
35 context_copy['spectrum'] = scan
36 f.write(template.render(**context_copy))
37%>
38
39<h3>Baseline Spectra</h3>
40% for baseline in baseline_link.keys():
41<div class="col-xs-6 col-md-3">
42 <a href="${baseline_link[baseline]}" class="thumbnail">
43 <img src="sourcespectrum_${baseline[0]}_${baseline[1]}_spectrum.png" alt="...">
44 </a>
45</div>
46% endfor
Note: See TracBrowser for help on using the repository browser.