@@ -18,15 +18,15 def ws_connect(message, code, plot): | |||||
18 | message.reply_channel.send({'accept': True}) |
|
18 | message.reply_channel.send({'accept': True}) | |
19 | pk = message.content['query_string'].split('=')[1] |
|
19 | pk = message.content['query_string'].split('=')[1] | |
20 | Group('{}_{}'.format(pk, plot)).add(message.reply_channel) |
|
20 | Group('{}_{}'.format(pk, plot)).add(message.reply_channel) | |
21 |
print('New connection from: {}, |
|
21 | print('New connection from: {}, Group: {}_{}'.format(message.content['client'][0], pk, plot)) | |
22 |
|
22 | |||
23 | def ws_message(message, code, plot): |
|
23 | def ws_message(message, code, plot): | |
24 | # Accept the incoming connection |
|
24 | # Accept the incoming connection | |
25 | print 'incoming message' |
|
25 | print 'incoming message' | |
26 | dt = datetime.strptime(str(json.loads(message.content['text'])['date']), '%d/%m/%Y') |
|
26 | dt = datetime.strptime(str(json.loads(message.content['text'])['date']), '%d/%m/%Y') | |
27 | exp = DB.exp_meta.find_one({'code': int(code), 'date': dt}) |
|
27 | exp = DB.exp_meta.find_one({'code': int(code), 'date': dt}) | |
28 | print exp |
|
28 | ||
29 | if exp: |
|
29 | if exp and plot in exp['plots']: | |
30 | if plot == 'spc': |
|
30 | if plot == 'spc': | |
31 | datas = DB.exp_data.find({'expmeta': exp['_id']}, ['time', 'data']).sort('time', -1).limit(1)[0] |
|
31 | datas = DB.exp_data.find({'expmeta': exp['_id']}, ['time', 'data']).sort('time', -1).limit(1)[0] | |
32 | exp['time'] = [datas['time']] |
|
32 | exp['time'] = [datas['time']] |
@@ -155,9 +155,10 class PcolorBuffer{ | |||||
155 | for (var i = 0; i < obj[this.key].length; i++){ |
|
155 | for (var i = 0; i < obj[this.key].length; i++){ | |
156 | this.zbuffer[i].push(obj[this.key][i]); |
|
156 | this.zbuffer[i].push(obj[this.key][i]); | |
157 | // update title |
|
157 | // update title | |
|
158 | var title = this.props.title || '' | |||
158 |
|
|
159 | var div = document.getElementById(this.divs[i]); | |
159 | Plotly.relayout(div, { |
|
160 | Plotly.relayout(div, { | |
160 | title: 'Channel ' + i + ' - ' + t.toLocaleString(), |
|
161 | title: title + ': Channel ' + i + ' - ' + t.toLocaleString(), | |
161 | }); |
|
162 | }); | |
162 | } |
|
163 | } | |
163 |
|
164 |
@@ -94,7 +94,7 | |||||
94 |
|
94 | |||
95 | socket.onmessage = function message(event) { |
|
95 | socket.onmessage = function message(event) { | |
96 | var data = JSON.parse(event.data); |
|
96 | var data = JSON.parse(event.data); | |
97 | console.log(data); |
|
97 | console.log(data.time); | |
98 | if (data.interval == 0) { |
|
98 | if (data.interval == 0) { | |
99 | $("#loader").removeClass("loader").addClass("no-data"); |
|
99 | $("#loader").removeClass("loader").addClass("no-data"); | |
100 | $("#loader").html("No data found"); |
|
100 | $("#loader").html("No data found"); |
@@ -10,7 +10,7 | |||||
10 | div: 'plot', |
|
10 | div: 'plot', | |
11 | data: data, |
|
11 | data: data, | |
12 | key: 'rti', |
|
12 | key: 'rti', | |
13 |
props: { title: '{{title}}', zmin: 15, zmax: 3 |
|
13 | props: { title: '{{title}}', zmin: 15, zmax: 35, throttle: 10, timespan: 12, colormap: 'Jet' }, | |
14 | }); |
|
14 | }); | |
15 | return true; |
|
15 | return true; | |
16 | } else { |
|
16 | } else { |
@@ -16,7 +16,7 | |||||
16 | div: 'plot', |
|
16 | div: 'plot', | |
17 | data: data, |
|
17 | data: data, | |
18 | key: '{{plot}}', |
|
18 | key: '{{plot}}', | |
19 |
props: {title: '{{title}}', ylabel:'Noise [dB]', ymin:1 |
|
19 | props: {title: '{{title}}', ylabel:'Noise [dB]', ymin:18, ymax:22 }, | |
20 | }); |
|
20 | }); | |
21 | return true; |
|
21 | return true; | |
22 | } else { |
|
22 | } else { |
@@ -70,7 +70,7 def main(request, code=None, plot=None): | |||||
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | if code and exps: |
|
72 | if code and exps: | |
73 | kwargs['title'] = [t[1] for t in exps if t[0]==int(code)][0] |
|
73 | kwargs['title'] = [t[1] for t in exps if int(t[0])==int(code)][0] | |
74 | else: |
|
74 | else: | |
75 | kwargs['title'] = 'JRO' |
|
75 | kwargs['title'] = 'JRO' | |
76 |
|
76 |
@@ -104,7 +104,7 | |||||
104 | "name" : "JULIA Imaging" |
|
104 | "name" : "JULIA Imaging" | |
105 | }, |
|
105 | }, | |
106 | { |
|
106 | { | |
107 |
"code" : 20 |
|
107 | "code" : 204, | |
108 | "name" : "JULIA Bistatic" |
|
108 | "name" : "JULIA Bistatic" | |
109 | } |
|
109 | } | |
110 | ] No newline at end of file |
|
110 | ] |
@@ -73,7 +73,10 def main(): | |||||
73 | for plot in buffer['data']: |
|
73 | for plot in buffer['data']: | |
74 | dum = buffer.copy() |
|
74 | dum = buffer.copy() | |
75 | dum['time'] = [buffer['time']] |
|
75 | dum['time'] = [buffer['time']] | |
76 | dum[plot] = buffer['data'][plot] |
|
76 | if plot=='noise': | |
|
77 | dum[plot] = [[x] for x in buffer['data'][plot]] | |||
|
78 | else: | |||
|
79 | dum[plot] = buffer['data'][plot] | |||
77 | dum.pop('data') |
|
80 | dum.pop('data') | |
78 | dum.pop('exp_code') |
|
81 | dum.pop('exp_code') | |
79 | channel.send_group(u'{}_{}'.format(code, plot), {'text': simplejson.dumps(dum, ignore_nan=True)}) |
|
82 | channel.send_group(u'{}_{}'.format(code, plot), {'text': simplejson.dumps(dum, ignore_nan=True)}) |
General Comments 0
You need to be logged in to leave comments.
Login now