@@ -6,18 +6,24 | |||||
6 | <button class="btn btn-primary m-2 text-center w-75">{{name}} </button> |
|
6 | <button class="btn btn-primary m-2 text-center w-75">{{name}} </button> | |
7 | {% for plot in plots %} |
|
7 | {% for plot in plots %} | |
8 | <a class="btn btn-sm btn-outline-primary mt-1 w-50" href="{% url 'url-plot' code plot.plot %}" role="button">{{plot.name|upper}}</a> |
|
8 | <a class="btn btn-sm btn-outline-primary mt-1 w-50" href="{% url 'url-plot' code plot.plot %}" role="button">{{plot.name|upper}}</a> | |
9 | {% endfor %} |
|
9 | {% endfor %} | |
|
10 | <br> | |||
|
11 | <button class="btn btn-primary m-2 text-center w-75">Last Events</button> | |||
|
12 | <a class="btn btn-sm btn-outline-primary mt-1 w-50" href="{% url 'url-event' code plot %}?date=05-02-2024" role="button">05-Feb-2024</a> | |||
10 | </nav> |
|
13 | </nav> | |
11 | {% endblock %} |
|
14 | {% endblock %} | |
12 |
|
15 | |||
13 | {% block content %} |
|
16 | {% block content %} | |
14 | <div class="row justify-content-center"> |
|
17 | <div class="row justify-content-center"> | |
|
18 | {% if gif %} | |||
|
19 | <img id="image" class="img-fluid" src="{% static 'images/events/' %}{{gif}}"/> | |||
|
20 | {% elif image %} | |||
15 | <div id="loader" class="spinner-border" role="status"> |
|
21 | <div id="loader" class="spinner-border" role="status"> | |
16 | <span class="sr-only">Loading...</span> |
|
22 | <span class="sr-only">Loading...</span> | |
17 | </div> |
|
23 | </div> | |
18 | </div> |
|
24 | </div> | |
19 | <div id="plot" {%if meta.metadata.type == 'pcolor' %}class="row"{%endif%}> |
|
25 | <div id="plot" {%if meta.metadata.type == 'pcolor' %}class="row"{%endif%}> | |
20 | {% if image %} |
|
26 | ||
21 | <img id="image" class="img-fluid"/> |
|
27 | <img id="image" class="img-fluid"/> | |
22 | {% endif %} |
|
28 | {% endif %} | |
23 | </div> |
|
29 | </div> | |
@@ -86,6 +92,7 | |||||
86 | } |
|
92 | } | |
87 |
|
93 | |||
88 | let flag = true; |
|
94 | let flag = true; | |
|
95 | ||||
89 | function plot(data) { |
|
96 | function plot(data) { | |
90 | if (flag === true) { |
|
97 | if (flag === true) { | |
91 | flag = false; |
|
98 | flag = false; |
@@ -1,5 +1,5 | |||||
1 | from django.conf.urls import url |
|
1 | from django.conf.urls import url | |
2 | from .views import main, update_codes, plot_MUF, plot, tools, plot_skynoise, plot_indices, reports, about, plot_overjro, plot_antennacuts, codes, delete_data |
|
2 | from .views import main, update_codes, plot_MUF, plot, event, tools, plot_skynoise, plot_indices, reports, about, plot_overjro, plot_antennacuts, codes, delete_data | |
3 |
|
3 | |||
4 | urlpatterns = [ |
|
4 | urlpatterns = [ | |
5 | url(r'^$', main, name='url_main'), |
|
5 | url(r'^$', main, name='url_main'), | |
@@ -17,4 +17,5 urlpatterns = [ | |||||
17 | url(r'^update/$', update_codes, name='url_update'), |
|
17 | url(r'^update/$', update_codes, name='url_update'), | |
18 | url(r'^delete/$', delete_data, name='url_delete'), |
|
18 | url(r'^delete/$', delete_data, name='url_delete'), | |
19 | url(r'^plot/(?P<code>[0-9]+)/(?P<plot>[-\w]+)/$', plot, name='url-plot'), |
|
19 | url(r'^plot/(?P<code>[0-9]+)/(?P<plot>[-\w]+)/$', plot, name='url-plot'), | |
|
20 | url(r'^event/(?P<code>[0-9]+)/(?P<plot>[-\w]+)/$', event, name='url-event'), | |||
20 | ] |
|
21 | ] |
@@ -270,7 +270,7 def delete_data(request): | |||||
270 | return render(request, 'home.html', {}) |
|
270 | return render(request, 'home.html', {}) | |
271 |
|
271 | |||
272 |
|
272 | |||
273 |
def |
|
273 | def event(request, code=None, plot=None): | |
274 | ''' |
|
274 | ''' | |
275 | ''' |
|
275 | ''' | |
276 |
|
276 | |||
@@ -297,7 +297,43 def plot(request, code=None, plot=None): | |||||
297 | 'tag' : tag, |
|
297 | 'tag' : tag, | |
298 | 'plots': [], |
|
298 | 'plots': [], | |
299 | 'slide': 'slide-plot.jpg', |
|
299 | 'slide': 'slide-plot.jpg', | |
|
300 | 'gif': plot+'-'+date+'.gif', | |||
300 | } |
|
301 | } | |
|
302 | for plt in detail.plots(): | |||
|
303 | kwargs['plots'].append({'plot': plt.plot, 'name': plt.plot.replace('_', ' ').title()}) | |||
|
304 | ||||
|
305 | return render(request, 'plot.html', kwargs) | |||
|
306 | ||||
|
307 | def plot(request, code=None, plot=None): | |||
|
308 | ''' | |||
|
309 | ''' | |||
|
310 | ||||
|
311 | realtime = False | |||
|
312 | date = request.GET.get('date', None) | |||
|
313 | if date is None: | |||
|
314 | date = datetime.now().strftime('%d-%m-%Y') | |||
|
315 | realtime = True | |||
|
316 | exp = Experiment.objects.get(code=int(code)) | |||
|
317 | detail = ExpDetail.objects.get(experiment=exp, date=datetime.strptime(date, '%d-%m-%Y')) | |||
|
318 | meta = PlotMeta.objects.get(exp_detail=detail, plot=plot) | |||
|
319 | tag = detail.tag.lower().strip() if detail.tag else 'other' | |||
|
320 | ||||
|
321 | kwargs = { | |||
|
322 | 'code': code, | |||
|
323 | 'plot': plot, | |||
|
324 | 'meta':meta, | |||
|
325 | 'date': date, | |||
|
326 | 'id': meta.pk, | |||
|
327 | 'realtime': realtime, | |||
|
328 | 'title': 'Experiments', | |||
|
329 | 'name' : exp.name, | |||
|
330 | 'sidebar': True, | |||
|
331 | 'tag' : tag, | |||
|
332 | 'plots': [], | |||
|
333 | 'slide': 'slide-plot.jpg', | |||
|
334 | 'image' : True, | |||
|
335 | } | |||
|
336 | ||||
301 |
|
337 | |||
302 | for plt in detail.plots(): |
|
338 | for plt in detail.plots(): | |
303 | kwargs['plots'].append({'plot': plt.plot, 'name': plt.plot.replace('_', ' ').title()}) |
|
339 | kwargs['plots'].append({'plot': plt.plot, 'name': plt.plot.replace('_', ' ').title()}) |
General Comments 0
You need to be logged in to leave comments.
Login now