[51] | 1 | <%inherit file="base.html"/>
|
---|
| 2 |
|
---|
| 3 | <!-- do the plotting -->
|
---|
| 4 | <%
|
---|
| 5 | import os.path
|
---|
| 6 | import numpy as np
|
---|
| 7 | import common.commonobjects as co
|
---|
| 8 |
|
---|
| 9 | uvspectra = context['data']['uvspectra']['uvspectra']
|
---|
| 10 |
|
---|
| 11 | data = []
|
---|
| 12 | flag = []
|
---|
| 13 | opd = []
|
---|
| 14 |
|
---|
| 15 | baseline_link = {}
|
---|
| 16 |
|
---|
| 17 | for 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
|
---|