Rev | Line | |
---|
[17] | 1 | <%inherit file="base.html"/>
|
---|
| 2 |
|
---|
| 3 | <!-- do the plotting -->
|
---|
| 4 | <%
|
---|
| 5 | import matplotlib.pyplot as plt
|
---|
| 6 | import os.path
|
---|
| 7 |
|
---|
| 8 | plt.figure()
|
---|
| 9 |
|
---|
| 10 | print 'context'
|
---|
| 11 | print context
|
---|
| 12 |
|
---|
| 13 | sourceid = context['sourceid']
|
---|
| 14 | print sourceid
|
---|
| 15 | spectrum = context['data']['skygenerator']['sources'][sourceid]['spectrum']
|
---|
| 16 | print 'here'
|
---|
| 17 | frequency_axis = context['data']['skygenerator']['frequency axis']
|
---|
| 18 | print 'here1'
|
---|
| 19 |
|
---|
| 20 | plt.plot(frequency_axis, spectrum)
|
---|
| 21 | plt.title('Source %s' % sourceid)
|
---|
| 22 | print 'here2'
|
---|
| 23 |
|
---|
| 24 | plt.savefig(os.path.join(context['dirname'], 'sourcespectrum%s.png' % sourceid))
|
---|
| 25 | plt.close()
|
---|
| 26 | %>
|
---|
| 27 |
|
---|
| 28 | <!-- link to the plot from html -->
|
---|
| 29 |
|
---|
| 30 | <img src='sourcespectrum${sourceid}.png' alt="Source spectrum">
|
---|
Note:
See
TracBrowser
for help on using the repository browser.