-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhandbook.html
765 lines (706 loc) · 37.7 KB
/
handbook.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>XAI-DARE Counterfactual Explanations Demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="res/jet.js"></script>
</head>
<style>
.button {
background-color: #028D9D;
border: none;
color: white;
padding: 5px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 10px;
margin: 2px 2px;
}
.button1 {border-radius: 2px;}
.button2 {border-radius: 4px;}
.button3 {border-radius: 8px;}
.button4 {border-radius: 12px;}
.button5 {border-radius: 50%;}
</style>
<body>
<div class="container">
<h3 style="background-color:#028D9D;padding: 5px;color: white;" align='center'>XAI-DARE Counterfacual Manual Generation</h3>
<img src='' id='dummy_img' style='display:none;'></img> <!-- -->
<!-- Working set -->
<div>
<table class="table">
<!-- Titles -->
<tr>
<th style="text-align:center;">Load Image</th>
<th style="text-align:center;">Image & Question</th>
<th style="text-align:center;">Answer & Explanations</th>
<th style="text-align:center;">Counterfactual Answer & Explanations</th>
<th style="text-align:center;">Counterfactual Image & Question</th>
</tr>
<tr>
<!-- Quick select bar -->
<td>
<table>
<tr><td>
<div style="width:80px; height:500px; overflow:auto;">
<table style='width:80px' id='imselect_table'>
<tr><td><img src='https://vqa_mscoco_images.s3.amazonaws.com/val2014/COCO_val2014_000000356414.jpg' width="60" height="60"></td></tr>
</table>
</div>
</td></tr>
<tr><td>
<textarea style="width:80px;height 100px;" placeholder="https://" id='webim'></textarea>
</td></tr>
<tr><td>
<button style='width:80px; height 80px;background-color: #CCCCCC;' onclick='load_custom_im()'>Load web image .. </button>
</td></tr>
</table>
</td>
<!-- Real -->
<td>
<table>
<tr><td><canvas width="260" height="260" id='original_image'></canvas></td></tr>
<tr><td><textarea type="text" id="original_question" style='width: 260px; height: 120px;'></textarea></td></tr>
</table>
</td>
<!-- Real Exp -->
<td>
<table id='original_exp'>
</table>
</td>
<!-- Counterfactual Exp -->
<td>
<table id='counterfactual_exp'>
</table>
</td>
<!-- Counterfactual -->
<td>
<table>
<tr style="text-align:center;"><td>
<button style='width:70px;height:40px;text-align:center;font-size:12px;' onclick='imedit("black_and_white");'>Black and white</button>
<button style='width:45px;height:40px;text-align:center;font-size:12px;' onclick='imedit("zoom_in");'>Zoom<br>in</button>
<button style='width:50px;height:40px;text-align:center;font-size:12px;' onclick='imedit("remove_box");'>Inpaint box</button>
<button style='width:75px;height:40px;text-align:center;font-size:12px;' onclick='imedit("remove_background");'>Inpaint background</button>
</td></tr>
<tr style="text-align:center;"><td><canvas width="260" height="260" id='counterfactual_image'></canvas></td></tr>
<tr style="text-align:center;"><td><textarea type="text" id="counterfactual_question" style='width: 260px; height: 120px;'></textarea></td></tr>
</table>
</td>
</tr>
</table>
</div>
<div>
<button style='width:80px;height:50px;text-align:center;' onclick='run_vqa();'>Run</button>
</div>
<div>
<hr></hr>
<!-- Navigation/store-->
<table>
<tr>
<th style="padding:10px;">
Manual <br>
Entries
</th>
<td>
<div style="width:1400px; overflow:auto;">
<div style='' id='entry_table'>
<div><img id="current_entry" src='http://diva-1:5001/res/plus.png' width="100" height="100" style="border: 5px solid orange;"></div>
</div>
</div>
</td>
</tr>
<tr>
<th style="padding:10px;">
Data
</th>
<td>
<textarea style="width:1400px;" rows="6" placeholder="<json>" id='data'></textarea>
</td></tr>
<tr><td></td><td>
<button style='width:120px;height:40px;text-align:center;' onclick='load_entries();'>Load Json</button>
</td></tr>
</table>
</div>
</div>
<script>
var api='http://diva-1:5001/api/';
var base_url='http://diva-1:5001/';
var edit={x0:[-1,-1],x1:[-1,-1],mouse_down:false};
//Create state variables for interface elements
//var current_set={set:'original',upd:true}; // or counterfactual
//var current_model={model:0,upd:true,models:[]};
var imselect={ims:[],upd:true}; // Sidebar for quick image selection
//var interactions={
// spatial_attn:-1,
// object_attn:-1,
// upd:true
// }; // Interaction with the explanation tool. Word/bbox picked
var orig={
imurl:'',
question:'',
answers:[], // List of top-1 answers
spatial_attn:[], //list of objects, average, by_token, by_7x7_zone, tokens, scores, url_template
object_attn:[], //list of objects, average, by_token, by_box, tokens, boxes, scores, url_template
};
var counterfactual={
imurl:'',
edit: null,
question:'',
answers:[], // List of top-1 answers
spatial_attn:[], //list of objects, average, by_token, by_7x7_zone, tokens, scores, url_template
object_attn:[], //list of objects, average, by_token, by_box, tokens, boxes, scores, url_template
};
var entries=[];
var current_entry=0;
//Initialization
function initialize(){
list_ims();
}
function load_custom_im(){
//Change image
var webim=document.getElementById('webim').value;
use_image(webim);
draw_ui();
}
//Resetting
function reset_counterfactual(){
counterfactual={
imurl:'',
edit: null,
question:'',
answers:[], // List of top-1 answers
spatial_attn:[], //list of objects, average, by_token, by_7x7_zone, tokens, scores, url_template
object_attn:[], //list of objects, average, by_token, by_box, tokens, boxes, scores, url_template
};
edit={x0:[-1,-1],x1:[-1,-1],mouse_down:false};
}
function reset_original(){
orig={
imurl:'',
question:'',
answers:[], // List of top-1 answers
spatial_attn:[], //list of objects, average, by_token, by_7x7_zone, tokens, scores, url_template
object_attn:[], //list of objects, average, by_token, by_box, tokens, boxes, scores, url_template
};
edit={x0:[-1,-1],x1:[-1,-1],mouse_down:false};
}
function use_image(url){
reset_original();
reset_counterfactual();
orig.imurl=url;
counterfactual.imurl=url;
update_entry();
}
function _use_image(url){
if(orig.imurl==''){
console.log('before:'+orig.imurl)
//Now we need to insert new entry to data
current_entry=entries.length;
entries.push({});
reset_original();
reset_counterfactual();
orig.imurl=url;
counterfactual.imurl=url;
update_entry();
//Now we also need to change the button
var tbl=document.getElementById('entry_table');
var td=document.createElement('td');
var new_btn=document.createElement('img');
new_btn.src=base_url+'res/plus.png';
new_btn.width=100;
new_btn.height=100;
new_btn.onclick=function(){create_new_entry();draw_ui();};
td.appendChild(new_btn);
tbl.appendChild(td);
//Change the function of current button
var ent=document.getElementById('entry_table').children[current_entry].children[0];
ent.entry_id=current_entry;
ent.onclick=function(){load_entry(this.entry_id);draw_ui();};
ent.src=orig.imurl;
}
else{
reset_original();
reset_counterfactual();
orig.imurl=url;
counterfactual.imurl=url;
var ent=document.getElementById('entry_table').children[current_entry].children[0];
ent.entry_id=current_entry;
ent.onclick=function(){load_entry(this.entry_id);draw_ui();};
ent.src=orig.imurl;
}
}
function _update_entry(){
if(orig.imurl!=''){
entries[current_entry]={
orig_imurl:orig.imurl,
counterfactual_imurl:counterfactual.imurl,
orig_question:orig.question,
counterfactual_question:counterfactual.question,
counterfactual_edit:counterfactual.edit,
};
}
var data=document.getElementById('data');
data.value=JSON.stringify(entries);
}
function _create_new_entry(){
console.log(entries)
if(current_entry>=entries.length){}
else{
reset_original();
reset_counterfactual();
current_entry=entries.length;
var c=document.getElementById('entry_table').children;
for(var i=0;i<c.length;i++){
if(i==current_entry){
c[i].children[0].style.border='5px solid orange';
}
else{
c[i].children[0].style.border='';
}
}
}
}
//What happens every time you change something
function update_entry(){
if(orig.imurl!=''){
if(current_entry>=entries.length){
new_entry={
orig_imurl:orig.imurl,
counterfactual_imurl:counterfactual.imurl,
orig_question:orig.question,
counterfactual_question:counterfactual.question,
counterfactual_edit:counterfactual.edit,
};
entries.push(new_entry);
}
else{
entries[current_entry]={
orig_imurl:orig.imurl,
counterfactual_imurl:counterfactual.imurl,
orig_question:orig.question,
counterfactual_question:counterfactual.question,
counterfactual_edit:counterfactual.edit,
};
}
}
var data=document.getElementById('data');
data.value=JSON.stringify(entries);
}
//What happens when you click +
function create_new_entry(){
console.log(entries)
if(current_entry>=entries.length){}
else{
reset_original();
reset_counterfactual();
current_entry=entries.length;
}
}
//What happens when you click existing entries
function load_entry(id){
current_entry=id;
var c=document.getElementById('entry_table').children;
for(var i=0;i<c.length;i++){
if(i==current_entry){
c[i].children[0].style.border='5px solid orange';
}
else{
c[i].children[0].style.border='';
}
}
reset_original();
reset_counterfactual();
orig.imurl=entries[current_entry].orig_imurl;
counterfactual.imurl=entries[current_entry].counterfactual_imurl;
orig.question=entries[current_entry].orig_question;
counterfactual.question=entries[current_entry].counterfactual_question;
document.getElementById('original_question').value=orig.question;
document.getElementById('counterfactual_question').value=counterfactual.question;
if(entries[current_entry].counterfactual_edit){
var canvas=document.getElementById('original_image');
var edit_tmp=entries[current_entry].counterfactual_edit;
x0=[edit_tmp.x*canvas.width,edit_tmp.y*canvas.height]
x1=[(edit_tmp.x+edit_tmp.w)*canvas.width,(edit_tmp.y+edit_tmp.h)*canvas.height]
edit.x0=x0;
edit.x1=x1;
counterfactual.edit=entries[current_entry].counterfactual_edit;
imedit(counterfactual.edit.method);
}
}
//Draw entry table
function draw_entry_table(){
//First enumerate all entries
var tbl=document.getElementById('entry_table');
tbl.innerHTML='';
//Draw entries
for(var i=0;i<entries.length;i++){
var td=document.createElement('div');
var new_btn=document.createElement('img');
new_btn.src=entries[i].orig_imurl;
new_btn.width=100;
new_btn.height=100;
new_btn.entry_id=i;
td.style.display='inline-block'
new_btn.onclick=function(){load_entry(this.entry_id);draw_ui();};
if (current_entry==i){
new_btn.style.border='5px solid orange';
}
td.appendChild(new_btn);
tbl.appendChild(td);
}
//Draw a new entry button
var td=document.createElement('div');
var new_btn=document.createElement('img');
new_btn.src=base_url+'res/plus.png';
new_btn.width=100;
new_btn.height=100;
td.style.display='inline-block'
new_btn.onclick=function(){create_new_entry();draw_ui();};
if (current_entry==entries.length){
new_btn.style.border='5px solid orange';
}
td.appendChild(new_btn);
tbl.appendChild(td);
}
//Load entries from json
function load_entries(){
var data=document.getElementById('data');
entries=JSON.parse(data.value);
create_new_entry();
draw_ui();
}
//Interface functions
//List quickselect images
function list_ims(){
var xhr = new XMLHttpRequest();
xhr.open("POST", api, true);
xhr.setRequestHeader('Content-Type', 'application/json');
var params={};
var msg={'method':'list_ims',"jsonrpc":"2.0",'id':'1','params':params};
console.log(msg);
xhr.send(JSON.stringify(msg));
xhr.onload = function() {
console.log(this.responseText);
var data = JSON.parse(this.responseText)['result'];
console.log(data);
imselect={ims:data['ims'],upd:true};
draw_ui();
}
}
function call_vqa(imurl,question,call_back_when_done){
var iqa={};
var expl={};
//First state: vqa
function vqa_when_done(){
console.log(this.responseText);
var data = JSON.parse(this.responseText)['result'];
iqa=data.answers;
expl_rpc();
};
function vqa_rpc(){
var xhr = new XMLHttpRequest();
xhr.open("POST", api, true);
xhr.setRequestHeader('Content-Type', 'application/json');
var params={imurl:imurl,question:question};
var msg={'method':'vqa',"jsonrpc":"2.0",'id':'1','params':params};
console.log(msg);
xhr.send(JSON.stringify(msg));
xhr.onload = vqa_when_done;
};
//Quick explanations
function expl_when_done(){
console.log(this.responseText);
var data = JSON.parse(this.responseText)['result'];
expl.spatial_attn=data.spatial_attn;
expl.object_attn=data.object_attn;
expl.attn_matrix=data.attn_matrix;
expl.topk_answers=data.topk_answers;
expl.related_qas=data.related_qas;
//full_expl_rpc(); //Initiate full explanation generation (the bulk of attention maps)
call_back_when_done(iqa,expl);
}
function expl_rpc(){
var xhr = new XMLHttpRequest();
xhr.open("POST", api, true);
xhr.setRequestHeader('Content-Type', 'application/json');
var params={imurl:imurl,question:question};
var msg={'method':'average_attn',"jsonrpc":"2.0",'id':'1','params':params};
console.log(msg);
xhr.send(JSON.stringify(msg));
xhr.onload = expl_when_done;
};
//Quick explanations
function full_expl_rpc(){
var xhr = new XMLHttpRequest();
xhr.open("POST", api, true);
xhr.setRequestHeader('Content-Type', 'application/json');
var params={imurl:imurl,question:question};
var msg={'method':'explain_full',"jsonrpc":"2.0",'id':'1','params':params};
console.log(msg);
xhr.send(JSON.stringify(msg));
xhr.onload = function(){
};
};
vqa_rpc();
}
//Call VQA on original set
function call_vqa_original(){
var imurl=orig.imurl;
orig.question=document.getElementById('original_question').value;
var question=orig.question;
function vqa_orig_when_done(answers,explanations){
orig.answers=answers;
orig.spatial_attn=explanations.spatial_attn;
orig.object_attn=explanations.object_attn;
draw_ui();
}
call_vqa(imurl,question,vqa_orig_when_done);
}
//Call VQA on counterfactual set
function call_vqa_counterfactual(){
var imurl=counterfactual.imurl;
counterfactual.question=document.getElementById('counterfactual_question').value;
var question=counterfactual.question;
function vqa_counterfactual_when_done(answers,explanations){
counterfactual.answers=answers;
counterfactual.spatial_attn=explanations.spatial_attn;
counterfactual.object_attn=explanations.object_attn;
draw_ui();
}
call_vqa(imurl,question,vqa_counterfactual_when_done);
}
function run_vqa(){call_vqa_original();call_vqa_counterfactual();}
//Perform image editing - generate counterfactual - call VQA with explanations - visualize
//Methods planned
// remove selection
// remove background
// turn image into black and white
// flip image around
// ...
function imedit(method){
var imurl=orig.imurl;
var canvas=document.getElementById('original_image');
var x00=edit.x0[0];
var x01=edit.x0[1];
var x10=edit.x1[0];
var x11=edit.x1[1];
var x=Math.min(x00,x10)/canvas.width;
var y=Math.min(x01,x11)/canvas.height;
var w=(Math.max(x00,x10)-Math.min(x00,x10))/canvas.width;
var h=(Math.max(x01,x11)-Math.min(x01,x11))/canvas.height;
counterfactual.edit={x:x,y:y,w:w,h:h,method:method};
//Then call the corresponding image editing function
function when_done(){
console.log(this.responseText);
var data = JSON.parse(this.responseText)['result'];
var im=document.getElementById('dummy_img');
im.onload=function(){
counterfactual.imurl=this.src;
//call_vqa_original();
//call_vqa_counterfactual();
draw_ui();
}
im.src=base_url+data.imurl;
}
function editing_rpc(){
var xhr = new XMLHttpRequest();
xhr.open("POST", api, true);
xhr.setRequestHeader('Content-Type', 'application/json');
var params={imurl:imurl,misc:[x,y,w,h]}; //,
var msg={'method':method,"jsonrpc":"2.0",'id':'1','params':params};
console.log(msg);
xhr.send(JSON.stringify(msg));
xhr.onload=when_done;
}
editing_rpc();
}
//Providing canvas functionalities
function canvas_mouse_move(e){
if(!edit.mouse_down){return;}
e.preventDefault();
e.stopPropagation();
var canvas=document.getElementById("original_image");
var r=canvas.getBoundingClientRect();
mx=Math.floor(e.clientX-r.left);
my=Math.floor(e.clientY-r.top);
if(mx>=0 && mx<=canvas.width && my>=0 && my<=canvas.height){
edit.x1=[mx,my];
draw_ui();
}
}
function canvas_mouse_down(e){
e.preventDefault();
e.stopPropagation();
var canvas=document.getElementById("original_image");
var r=canvas.getBoundingClientRect();
mx=Math.floor(e.clientX-r.left);
my=Math.floor(e.clientY-r.top);
if(mx>=0 && mx<=canvas.width && my>=0 && my<=canvas.height){
edit.x0=[mx,my];
edit.x1=[mx,my];
edit.mouse_down=true;
draw_ui();
}
}
function canvas_mouse_up(e){
e.preventDefault();
e.stopPropagation();
edit.mouse_down=false;
draw_ui();
}
function line(ctx,x0,y0,x1,y1,style){
ctx.beginPath();
ctx.moveTo(x0,y0);
ctx.lineTo(x1,y1);
ctx.strokeStyle=style;
ctx.stroke();
}
function draw_spatial_attention(tab,average,tokens,scores=null,by_token=null,by_zone=null){
var div=document.createElement('div');
div.innerHTML=tokens.join(' ');
var img=document.createElement('img');
img.src=average;
img.width=250;
img.height=250;
tab.appendChild(div);
tab.appendChild(img);
}
function draw_object_attention(tab,average,tokens,bboxes=null,scores=null,by_token=null,by_bbox=null){
var div=document.createElement('div');
div.innerHTML=tokens.join(' ');
var img=document.createElement('img');
img.src=average;
img.width=250;
img.height=250;
tab.appendChild(div);
tab.appendChild(img);
}
//Draw robot answer
function draw_explanation(id,data){
var answer_table=document.getElementById(id);
answer_table.innerHTML='';
for(var i=0;i<data.answers.length;i++){
var row=document.createElement('tr');
var z=document.createElement('table');
z.style.border='1px solid'
var r1=document.createElement('tr');
var td_answer=document.createElement('td');
td_answer.innerHTML='Robot '+i.toString()+': '+data.answers[i];
td_answer.colSpan=2;
td_answer.style.padding='5px';
r1.appendChild(td_answer);
var r2=document.createElement('tr');
var td_sp=document.createElement('td');
var imsp=document.createElement('img');
imsp.width=120;
imsp.height=120;
imsp.src=base_url+data.spatial_attn[i].average;
td_sp.appendChild(imsp);
r2.appendChild(td_sp);
var td_obj=document.createElement('td');
var imobj=document.createElement('img');
imobj.width=120;
imobj.height=120;
imobj.src=base_url+data.object_attn[i].average;
td_obj.appendChild(imobj);
r2.appendChild(td_obj);
z.appendChild(r1);
z.appendChild(r2);
row.appendChild(z);
answer_table.appendChild(row);
}
}
//Huge function for everything
function draw_ui(){
update_entry();
draw_entry_table();
//Draw quick select sidebar
if(imselect.upd){
imselect.upd=false;
var imselect_table=document.getElementById('imselect_table');
imselect_table.innerHTML='';
for(var i=0;i<imselect.ims.length;i++){
var tr=document.createElement('tr');
var td=document.createElement('td');
var img=document.createElement('img');
console.log(imselect.ims[i])
img.src=base_url+imselect.ims[i];
console.log(img.src)
img.width=60;
img.height=60;
img.onclick=function(){
//Change image
use_image(this.src);
draw_ui();
}
td.appendChild(img);
tr.appendChild(td);
imselect_table.appendChild(tr);
}
}
//Update original data
if(true){
//Draw image, append controls and draw box
var orig_im=document.getElementById('original_image');
orig_im.getContext('2d').clearRect(0, 0, orig_im.width, orig_im.height);
var downloadingImage = new Image();
downloadingImage.onload = function(){
var orig_im=document.getElementById('original_image');
orig_im.onmousedown=canvas_mouse_down;
orig_im.onmouseup=canvas_mouse_up;
orig_im.onmousemove=canvas_mouse_move;
ctx=orig_im.getContext("2d");
ctx.drawImage(this,0,0,orig_im.width,orig_im.height);
w=orig_im.width;
h=orig_im.height;
x0=edit.x0;
x1=edit.x1;
if(x0[0]>=0 && x1[0]>=0){
line(ctx,0,x0[1],w,x0[1],'black');
line(ctx,0,x1[1],w,x1[1],'black');
line(ctx,x0[0],0,x0[0],h,'black');
line(ctx,x1[0],0,x1[0],h,'black');
line(ctx,x0[0],x0[1],x1[0],x0[1],'red');
line(ctx,x0[0],x1[1],x1[0],x1[1],'red');
line(ctx,x0[0],x0[1],x0[0],x1[1],'red');
line(ctx,x1[0],x0[1],x1[0],x1[1],'red');
}
};
downloadingImage.src=orig.imurl;
draw_explanation('original_exp',orig);
}
//Update counterfactual data
if(true){
//Draw image
var canvas=document.getElementById('counterfactual_image');
canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height);
var downloadingImage = new Image();
downloadingImage.onload = function(){
var canvas=document.getElementById('counterfactual_image');
ctx=canvas.getContext("2d");
ctx.drawImage(this,0,0,canvas.width,canvas.height);
};
downloadingImage.src=counterfactual.imurl;
//Draw robot answer
draw_explanation('counterfactual_exp',counterfactual);
}
}
var jet = [[0.000, [0.000, 0.000, 0.500]], [0.002, [0.000, 0.000, 0.500]], [0.004, [0.000, 0.000, 0.518]], [0.006, [0.000, 0.000, 0.518]], [0.008, [0.000, 0.000, 0.536]], [0.010, [0.000, 0.000, 0.536]], [0.012, [0.000, 0.000, 0.553]], [0.014, [0.000, 0.000, 0.553]], [0.016, [0.000, 0.000, 0.571]], [0.018, [0.000, 0.000, 0.571]], [0.020, [0.000, 0.000, 0.589]], [0.022, [0.000, 0.000, 0.589]], [0.023, [0.000, 0.000, 0.607]], [0.025, [0.000, 0.000, 0.607]], [0.027, [0.000, 0.000, 0.625]], [0.029, [0.000, 0.000, 0.625]], [0.031, [0.000, 0.000, 0.643]], [0.033, [0.000, 0.000, 0.643]], [0.035, [0.000, 0.000, 0.660]], [0.037, [0.000, 0.000, 0.660]], [0.039, [0.000, 0.000, 0.678]], [0.041, [0.000, 0.000, 0.678]], [0.043, [0.000, 0.000, 0.696]], [0.045, [0.000, 0.000, 0.696]], [0.047, [0.000, 0.000, 0.714]], [0.049, [0.000, 0.000, 0.714]], [0.051, [0.000, 0.000, 0.732]], [0.053, [0.000, 0.000, 0.732]], [0.055, [0.000, 0.000, 0.750]], [0.057, [0.000, 0.000, 0.750]], [0.059, [0.000, 0.000, 0.767]], [0.061, [0.000, 0.000, 0.767]], [0.063, [0.000, 0.000, 0.785]], [0.065, [0.000, 0.000, 0.785]], [0.067, [0.000, 0.000, 0.803]], [0.068, [0.000, 0.000, 0.803]], [0.070, [0.000, 0.000, 0.821]], [0.072, [0.000, 0.000, 0.821]], [0.074, [0.000, 0.000, 0.839]], [0.076, [0.000, 0.000, 0.839]], [0.078, [0.000, 0.000, 0.857]], [0.080, [0.000, 0.000, 0.857]], [0.082, [0.000, 0.000, 0.874]], [0.084, [0.000, 0.000, 0.874]], [0.086, [0.000, 0.000, 0.892]], [0.088, [0.000, 0.000, 0.892]], [0.090, [0.000, 0.000, 0.910]], [0.092, [0.000, 0.000, 0.910]], [0.094, [0.000, 0.000, 0.928]], [0.096, [0.000, 0.000, 0.928]], [0.098, [0.000, 0.000, 0.946]], [0.100, [0.000, 0.000, 0.946]], [0.102, [0.000, 0.000, 0.963]], [0.104, [0.000, 0.000, 0.963]], [0.106, [0.000, 0.000, 0.981]], [0.108, [0.000, 0.000, 0.981]], [0.110, [0.000, 0.000, 0.999]], [0.112, [0.000, 0.000, 0.999]], [0.114, [0.000, 0.000, 1.000]], [0.115, [0.000, 0.000, 1.000]], [0.117, [0.000, 0.000, 1.000]], [0.119, [0.000, 0.000, 1.000]], [0.121, [0.000, 0.000, 1.000]], [0.123, [0.000, 0.000, 1.000]], [0.125, [0.000, 0.002, 1.000]], [0.127, [0.000, 0.002, 1.000]], [0.129, [0.000, 0.018, 1.000]], [0.131, [0.000, 0.018, 1.000]], [0.133, [0.000, 0.033, 1.000]], [0.135, [0.000, 0.033, 1.000]], [0.137, [0.000, 0.049, 1.000]], [0.139, [0.000, 0.049, 1.000]], [0.141, [0.000, 0.065, 1.000]], [0.143, [0.000, 0.065, 1.000]], [0.145, [0.000, 0.080, 1.000]], [0.147, [0.000, 0.080, 1.000]], [0.149, [0.000, 0.096, 1.000]], [0.151, [0.000, 0.096, 1.000]], [0.153, [0.000, 0.112, 1.000]], [0.155, [0.000, 0.112, 1.000]], [0.157, [0.000, 0.127, 1.000]], [0.159, [0.000, 0.127, 1.000]], [0.160, [0.000, 0.143, 1.000]], [0.162, [0.000, 0.143, 1.000]], [0.164, [0.000, 0.159, 1.000]], [0.166, [0.000, 0.159, 1.000]], [0.168, [0.000, 0.175, 1.000]], [0.170, [0.000, 0.175, 1.000]], [0.172, [0.000, 0.190, 1.000]], [0.174, [0.000, 0.190, 1.000]], [0.176, [0.000, 0.206, 1.000]], [0.178, [0.000, 0.206, 1.000]], [0.180, [0.000, 0.222, 1.000]], [0.182, [0.000, 0.222, 1.000]], [0.184, [0.000, 0.237, 1.000]], [0.186, [0.000, 0.237, 1.000]], [0.188, [0.000, 0.253, 1.000]], [0.190, [0.000, 0.253, 1.000]], [0.192, [0.000, 0.269, 1.000]], [0.194, [0.000, 0.269, 1.000]], [0.196, [0.000, 0.284, 1.000]], [0.198, [0.000, 0.284, 1.000]], [0.200, [0.000, 0.300, 1.000]], [0.202, [0.000, 0.300, 1.000]], [0.204, [0.000, 0.316, 1.000]], [0.205, [0.000, 0.316, 1.000]], [0.207, [0.000, 0.331, 1.000]], [0.209, [0.000, 0.331, 1.000]], [0.211, [0.000, 0.347, 1.000]], [0.213, [0.000, 0.347, 1.000]], [0.215, [0.000, 0.363, 1.000]], [0.217, [0.000, 0.363, 1.000]], [0.219, [0.000, 0.378, 1.000]], [0.221, [0.000, 0.378, 1.000]], [0.223, [0.000, 0.394, 1.000]], [0.225, [0.000, 0.394, 1.000]], [0.227, [0.000, 0.410, 1.000]], [0.229, [0.000, 0.410, 1.000]], [0.231, [0.000, 0.425, 1.000]], [0.233, [0.000, 0.425, 1.000]], [0.235, [0.000, 0.441, 1.000]], [0.237, [0.000, 0.441, 1.000]], [0.239, [0.000, 0.457, 1.000]], [0.241, [0.000, 0.457, 1.000]], [0.243, [0.000, 0.473, 1.000]], [0.245, [0.000, 0.473, 1.000]], [0.247, [0.000, 0.488, 1.000]], [0.249, [0.000, 0.488, 1.000]], [0.250, [0.000, 0.504, 1.000]], [0.252, [0.000, 0.504, 1.000]], [0.254, [0.000, 0.520, 1.000]], [0.256, [0.000, 0.520, 1.000]], [0.258, [0.000, 0.535, 1.000]], [0.260, [0.000, 0.535, 1.000]], [0.262, [0.000, 0.551, 1.000]], [0.264, [0.000, 0.551, 1.000]], [0.266, [0.000, 0.567, 1.000]], [0.268, [0.000, 0.567, 1.000]], [0.270, [0.000, 0.582, 1.000]], [0.272, [0.000, 0.582, 1.000]], [0.274, [0.000, 0.598, 1.000]], [0.276, [0.000, 0.598, 1.000]], [0.278, [0.000, 0.614, 1.000]], [0.280, [0.000, 0.614, 1.000]], [0.282, [0.000, 0.629, 1.000]], [0.284, [0.000, 0.629, 1.000]], [0.286, [0.000, 0.645, 1.000]], [0.288, [0.000, 0.645, 1.000]], [0.290, [0.000, 0.661, 1.000]], [0.292, [0.000, 0.661, 1.000]], [0.294, [0.000, 0.676, 1.000]], [0.295, [0.000, 0.676, 1.000]], [0.297, [0.000, 0.692, 1.000]], [0.299, [0.000, 0.692, 1.000]], [0.301, [0.000, 0.708, 1.000]], [0.303, [0.000, 0.708, 1.000]], [0.305, [0.000, 0.724, 1.000]], [0.307, [0.000, 0.724, 1.000]], [0.309, [0.000, 0.739, 1.000]], [0.311, [0.000, 0.739, 1.000]], [0.313, [0.000, 0.755, 1.000]], [0.315, [0.000, 0.755, 1.000]], [0.317, [0.000, 0.771, 1.000]], [0.319, [0.000, 0.771, 1.000]], [0.321, [0.000, 0.786, 1.000]], [0.323, [0.000, 0.786, 1.000]], [0.325, [0.000, 0.802, 1.000]], [0.327, [0.000, 0.802, 1.000]], [0.329, [0.000, 0.818, 1.000]], [0.331, [0.000, 0.818, 1.000]], [0.333, [0.000, 0.833, 1.000]], [0.335, [0.000, 0.833, 1.000]], [0.337, [0.000, 0.849, 1.000]], [0.339, [0.000, 0.849, 1.000]], [0.341, [0.000, 0.865, 0.996]], [0.342, [0.000, 0.865, 0.996]], [0.344, [0.000, 0.880, 0.984]], [0.346, [0.000, 0.880, 0.984]], [0.348, [0.000, 0.896, 0.971]], [0.350, [0.000, 0.896, 0.971]], [0.352, [0.009, 0.912, 0.958]], [0.354, [0.009, 0.912, 0.958]], [0.356, [0.022, 0.927, 0.946]], [0.358, [0.022, 0.927, 0.946]], [0.360, [0.035, 0.943, 0.933]], [0.362, [0.035, 0.943, 0.933]], [0.364, [0.047, 0.959, 0.920]], [0.366, [0.047, 0.959, 0.920]], [0.368, [0.060, 0.975, 0.908]], [0.370, [0.060, 0.975, 0.908]], [0.372, [0.073, 0.990, 0.895]], [0.374, [0.073, 0.990, 0.895]], [0.376, [0.085, 1.000, 0.882]], [0.378, [0.085, 1.000, 0.882]], [0.380, [0.098, 1.000, 0.870]], [0.382, [0.098, 1.000, 0.870]], [0.384, [0.111, 1.000, 0.857]], [0.386, [0.111, 1.000, 0.857]], [0.387, [0.123, 1.000, 0.844]], [0.389, [0.123, 1.000, 0.844]], [0.391, [0.136, 1.000, 0.832]], [0.393, [0.136, 1.000, 0.832]], [0.395, [0.149, 1.000, 0.819]], [0.397, [0.149, 1.000, 0.819]], [0.399, [0.161, 1.000, 0.806]], [0.401, [0.161, 1.000, 0.806]], [0.403, [0.174, 1.000, 0.794]], [0.405, [0.174, 1.000, 0.794]], [0.407, [0.187, 1.000, 0.781]], [0.409, [0.187, 1.000, 0.781]], [0.411, [0.199, 1.000, 0.769]], [0.413, [0.199, 1.000, 0.769]], [0.415, [0.212, 1.000, 0.756]], [0.417, [0.212, 1.000, 0.756]], [0.419, [0.225, 1.000, 0.743]], [0.421, [0.225, 1.000, 0.743]], [0.423, [0.237, 1.000, 0.731]], [0.425, [0.237, 1.000, 0.731]], [0.427, [0.250, 1.000, 0.718]], [0.429, [0.250, 1.000, 0.718]], [0.431, [0.262, 1.000, 0.705]], [0.432, [0.262, 1.000, 0.705]], [0.434, [0.275, 1.000, 0.693]], [0.436, [0.275, 1.000, 0.693]], [0.438, [0.288, 1.000, 0.680]], [0.440, [0.288, 1.000, 0.680]], [0.442, [0.300, 1.000, 0.667]], [0.444, [0.300, 1.000, 0.667]], [0.446, [0.313, 1.000, 0.655]], [0.448, [0.313, 1.000, 0.655]], [0.450, [0.326, 1.000, 0.642]], [0.452, [0.326, 1.000, 0.642]], [0.454, [0.338, 1.000, 0.629]], [0.456, [0.338, 1.000, 0.629]], [0.458, [0.351, 1.000, 0.617]], [0.460, [0.351, 1.000, 0.617]], [0.462, [0.364, 1.000, 0.604]], [0.464, [0.364, 1.000, 0.604]], [0.466, [0.376, 1.000, 0.591]], [0.468, [0.376, 1.000, 0.591]], [0.470, [0.389, 1.000, 0.579]], [0.472, [0.389, 1.000, 0.579]], [0.474, [0.402, 1.000, 0.566]], [0.476, [0.402, 1.000, 0.566]], [0.477, [0.414, 1.000, 0.553]], [0.479, [0.414, 1.000, 0.553]], [0.481, [0.427, 1.000, 0.541]], [0.483, [0.427, 1.000, 0.541]], [0.485, [0.440, 1.000, 0.528]], [0.487, [0.440, 1.000, 0.528]], [0.489, [0.452, 1.000, 0.515]], [0.491, [0.452, 1.000, 0.515]], [0.493, [0.465, 1.000, 0.503]], [0.495, [0.465, 1.000, 0.503]], [0.497, [0.478, 1.000, 0.490]], [0.499, [0.478, 1.000, 0.490]], [0.501, [0.490, 1.000, 0.478]], [0.503, [0.490, 1.000, 0.478]], [0.505, [0.503, 1.000, 0.465]], [0.507, [0.503, 1.000, 0.465]], [0.509, [0.515, 1.000, 0.452]], [0.511, [0.515, 1.000, 0.452]], [0.513, [0.528, 1.000, 0.440]], [0.515, [0.528, 1.000, 0.440]], [0.517, [0.541, 1.000, 0.427]], [0.519, [0.541, 1.000, 0.427]], [0.521, [0.553, 1.000, 0.414]], [0.523, [0.553, 1.000, 0.414]], [0.524, [0.566, 1.000, 0.402]], [0.526, [0.566, 1.000, 0.402]], [0.528, [0.579, 1.000, 0.389]], [0.530, [0.579, 1.000, 0.389]], [0.532, [0.591, 1.000, 0.376]], [0.534, [0.591, 1.000, 0.376]], [0.536, [0.604, 1.000, 0.364]], [0.538, [0.604, 1.000, 0.364]], [0.540, [0.617, 1.000, 0.351]], [0.542, [0.617, 1.000, 0.351]], [0.544, [0.629, 1.000, 0.338]], [0.546, [0.629, 1.000, 0.338]], [0.548, [0.642, 1.000, 0.326]], [0.550, [0.642, 1.000, 0.326]], [0.552, [0.655, 1.000, 0.313]], [0.554, [0.655, 1.000, 0.313]], [0.556, [0.667, 1.000, 0.300]], [0.558, [0.667, 1.000, 0.300]], [0.560, [0.680, 1.000, 0.288]], [0.562, [0.680, 1.000, 0.288]], [0.564, [0.693, 1.000, 0.275]], [0.566, [0.693, 1.000, 0.275]], [0.568, [0.705, 1.000, 0.262]], [0.569, [0.705, 1.000, 0.262]], [0.571, [0.718, 1.000, 0.250]], [0.573, [0.718, 1.000, 0.250]], [0.575, [0.731, 1.000, 0.237]], [0.577, [0.731, 1.000, 0.237]], [0.579, [0.743, 1.000, 0.225]], [0.581, [0.743, 1.000, 0.225]], [0.583, [0.756, 1.000, 0.212]], [0.585, [0.756, 1.000, 0.212]], [0.587, [0.769, 1.000, 0.199]], [0.589, [0.769, 1.000, 0.199]], [0.591, [0.781, 1.000, 0.187]], [0.593, [0.781, 1.000, 0.187]], [0.595, [0.794, 1.000, 0.174]], [0.597, [0.794, 1.000, 0.174]], [0.599, [0.806, 1.000, 0.161]], [0.601, [0.806, 1.000, 0.161]], [0.603, [0.819, 1.000, 0.149]], [0.605, [0.819, 1.000, 0.149]], [0.607, [0.832, 1.000, 0.136]], [0.609, [0.832, 1.000, 0.136]], [0.611, [0.844, 1.000, 0.123]], [0.613, [0.844, 1.000, 0.123]], [0.614, [0.857, 1.000, 0.111]], [0.616, [0.857, 1.000, 0.111]], [0.618, [0.870, 1.000, 0.098]], [0.620, [0.870, 1.000, 0.098]], [0.622, [0.882, 1.000, 0.085]], [0.624, [0.882, 1.000, 0.085]], [0.626, [0.895, 1.000, 0.073]], [0.628, [0.895, 1.000, 0.073]], [0.630, [0.908, 1.000, 0.060]], [0.632, [0.908, 1.000, 0.060]], [0.634, [0.920, 1.000, 0.047]], [0.636, [0.920, 1.000, 0.047]], [0.638, [0.933, 1.000, 0.035]], [0.640, [0.933, 1.000, 0.035]], [0.642, [0.946, 0.988, 0.022]], [0.644, [0.946, 0.988, 0.022]], [0.646, [0.958, 0.974, 0.009]], [0.648, [0.958, 0.974, 0.009]], [0.650, [0.971, 0.959, 0.000]], [0.652, [0.971, 0.959, 0.000]], [0.654, [0.984, 0.945, 0.000]], [0.656, [0.984, 0.945, 0.000]], [0.658, [0.996, 0.930, 0.000]], [0.659, [0.996, 0.930, 0.000]], [0.661, [1.000, 0.916, 0.000]], [0.663, [1.000, 0.916, 0.000]], [0.665, [1.000, 0.901, 0.000]], [0.667, [1.000, 0.901, 0.000]], [0.669, [1.000, 0.887, 0.000]], [0.671, [1.000, 0.887, 0.000]], [0.673, [1.000, 0.872, 0.000]], [0.675, [1.000, 0.872, 0.000]], [0.677, [1.000, 0.858, 0.000]], [0.679, [1.000, 0.858, 0.000]], [0.681, [1.000, 0.843, 0.000]], [0.683, [1.000, 0.843, 0.000]], [0.685, [1.000, 0.829, 0.000]], [0.687, [1.000, 0.829, 0.000]], [0.689, [1.000, 0.814, 0.000]], [0.691, [1.000, 0.814, 0.000]], [0.693, [1.000, 0.800, 0.000]], [0.695, [1.000, 0.800, 0.000]], [0.697, [1.000, 0.785, 0.000]], [0.699, [1.000, 0.785, 0.000]], [0.701, [1.000, 0.771, 0.000]], [0.703, [1.000, 0.771, 0.000]], [0.705, [1.000, 0.756, 0.000]], [0.706, [1.000, 0.756, 0.000]], [0.708, [1.000, 0.741, 0.000]], [0.710, [1.000, 0.741, 0.000]], [0.712, [1.000, 0.727, 0.000]], [0.714, [1.000, 0.727, 0.000]], [0.716, [1.000, 0.712, 0.000]], [0.718, [1.000, 0.712, 0.000]], [0.720, [1.000, 0.698, 0.000]], [0.722, [1.000, 0.698, 0.000]], [0.724, [1.000, 0.683, 0.000]], [0.726, [1.000, 0.683, 0.000]], [0.728, [1.000, 0.669, 0.000]], [0.730, [1.000, 0.669, 0.000]], [0.732, [1.000, 0.654, 0.000]], [0.734, [1.000, 0.654, 0.000]], [0.736, [1.000, 0.640, 0.000]], [0.738, [1.000, 0.640, 0.000]], [0.740, [1.000, 0.625, 0.000]], [0.742, [1.000, 0.625, 0.000]], [0.744, [1.000, 0.611, 0.000]], [0.746, [1.000, 0.611, 0.000]], [0.748, [1.000, 0.596, 0.000]], [0.750, [1.000, 0.596, 0.000]], [0.751, [1.000, 0.582, 0.000]], [0.753, [1.000, 0.582, 0.000]], [0.755, [1.000, 0.567, 0.000]], [0.757, [1.000, 0.567, 0.000]], [0.759, [1.000, 0.553, 0.000]], [0.761, [1.000, 0.553, 0.000]], [0.763, [1.000, 0.538, 0.000]], [0.765, [1.000, 0.538, 0.000]], [0.767, [1.000, 0.524, 0.000]], [0.769, [1.000, 0.524, 0.000]], [0.771, [1.000, 0.509, 0.000]], [0.773, [1.000, 0.509, 0.000]], [0.775, [1.000, 0.495, 0.000]], [0.777, [1.000, 0.495, 0.000]], [0.779, [1.000, 0.480, 0.000]], [0.781, [1.000, 0.480, 0.000]], [0.783, [1.000, 0.466, 0.000]], [0.785, [1.000, 0.466, 0.000]], [0.787, [1.000, 0.451, 0.000]], [0.789, [1.000, 0.451, 0.000]], [0.791, [1.000, 0.436, 0.000]], [0.793, [1.000, 0.436, 0.000]], [0.795, [1.000, 0.422, 0.000]], [0.796, [1.000, 0.422, 0.000]], [0.798, [1.000, 0.407, 0.000]], [0.800, [1.000, 0.407, 0.000]], [0.802, [1.000, 0.393, 0.000]], [0.804, [1.000, 0.393, 0.000]], [0.806, [1.000, 0.378, 0.000]], [0.808, [1.000, 0.378, 0.000]], [0.810, [1.000, 0.364, 0.000]], [0.812, [1.000, 0.364, 0.000]], [0.814, [1.000, 0.349, 0.000]], [0.816, [1.000, 0.349, 0.000]], [0.818, [1.000, 0.335, 0.000]], [0.820, [1.000, 0.335, 0.000]], [0.822, [1.000, 0.320, 0.000]], [0.824, [1.000, 0.320, 0.000]], [0.826, [1.000, 0.306, 0.000]], [0.828, [1.000, 0.306, 0.000]], [0.830, [1.000, 0.291, 0.000]], [0.832, [1.000, 0.291, 0.000]], [0.834, [1.000, 0.277, 0.000]], [0.836, [1.000, 0.277, 0.000]], [0.838, [1.000, 0.262, 0.000]], [0.840, [1.000, 0.262, 0.000]], [0.841, [1.000, 0.248, 0.000]], [0.843, [1.000, 0.248, 0.000]], [0.845, [1.000, 0.233, 0.000]], [0.847, [1.000, 0.233, 0.000]], [0.849, [1.000, 0.219, 0.000]], [0.851, [1.000, 0.219, 0.000]], [0.853, [1.000, 0.204, 0.000]], [0.855, [1.000, 0.204, 0.000]], [0.857, [1.000, 0.190, 0.000]], [0.859, [1.000, 0.190, 0.000]], [0.861, [1.000, 0.175, 0.000]], [0.863, [1.000, 0.175, 0.000]], [0.865, [1.000, 0.160, 0.000]], [0.867, [1.000, 0.160, 0.000]], [0.869, [1.000, 0.146, 0.000]], [0.871, [1.000, 0.146, 0.000]], [0.873, [1.000, 0.131, 0.000]], [0.875, [1.000, 0.131, 0.000]], [0.877, [1.000, 0.117, 0.000]], [0.879, [1.000, 0.117, 0.000]], [0.881, [1.000, 0.102, 0.000]], [0.883, [1.000, 0.102, 0.000]], [0.885, [1.000, 0.088, 0.000]], [0.886, [1.000, 0.088, 0.000]], [0.888, [0.999, 0.073, 0.000]], [0.890, [0.999, 0.073, 0.000]], [0.892, [0.981, 0.059, 0.000]], [0.894, [0.981, 0.059, 0.000]], [0.896, [0.963, 0.044, 0.000]], [0.898, [0.963, 0.044, 0.000]], [0.900, [0.946, 0.030, 0.000]], [0.902, [0.946, 0.030, 0.000]], [0.904, [0.928, 0.015, 0.000]], [0.906, [0.928, 0.015, 0.000]], [0.908, [0.910, 0.001, 0.000]], [0.910, [0.910, 0.001, 0.000]], [0.912, [0.892, 0.000, 0.000]], [0.914, [0.892, 0.000, 0.000]], [0.916, [0.874, 0.000, 0.000]], [0.918, [0.874, 0.000, 0.000]], [0.920, [0.857, 0.000, 0.000]], [0.922, [0.857, 0.000, 0.000]], [0.924, [0.839, 0.000, 0.000]], [0.926, [0.839, 0.000, 0.000]], [0.928, [0.821, 0.000, 0.000]], [0.930, [0.821, 0.000, 0.000]], [0.932, [0.803, 0.000, 0.000]], [0.933, [0.803, 0.000, 0.000]], [0.935, [0.785, 0.000, 0.000]], [0.937, [0.785, 0.000, 0.000]], [0.939, [0.767, 0.000, 0.000]], [0.941, [0.767, 0.000, 0.000]], [0.943, [0.750, 0.000, 0.000]], [0.945, [0.750, 0.000, 0.000]], [0.947, [0.732, 0.000, 0.000]], [0.949, [0.732, 0.000, 0.000]], [0.951, [0.714, 0.000, 0.000]], [0.953, [0.714, 0.000, 0.000]], [0.955, [0.696, 0.000, 0.000]], [0.957, [0.696, 0.000, 0.000]], [0.959, [0.678, 0.000, 0.000]], [0.961, [0.678, 0.000, 0.000]], [0.963, [0.660, 0.000, 0.000]], [0.965, [0.660, 0.000, 0.000]], [0.967, [0.643, 0.000, 0.000]], [0.969, [0.643, 0.000, 0.000]], [0.971, [0.625, 0.000, 0.000]], [0.973, [0.625, 0.000, 0.000]], [0.975, [0.607, 0.000, 0.000]], [0.977, [0.607, 0.000, 0.000]], [0.978, [0.589, 0.000, 0.000]], [0.980, [0.589, 0.000, 0.000]], [0.982, [0.571, 0.000, 0.000]], [0.984, [0.571, 0.000, 0.000]], [0.986, [0.553, 0.000, 0.000]], [0.988, [0.553, 0.000, 0.000]], [0.990, [0.536, 0.000, 0.000]], [0.992, [0.536, 0.000, 0.000]], [0.994, [0.518, 0.000, 0.000]], [0.996, [0.518, 0.000, 0.000]], [0.998, [0.500, 0.000, 0.000]], [1.000, [0.500, 0.000, 0.000]]];
var jet_colormap={};
for(var i=0;i<jet.length;i++){
r=Math.floor(jet[i][1][0]*255);
g=Math.floor(jet[i][1][1]*255);
b=Math.floor(jet[i][1][2]*255);
conf=jet[i][0];
conf=Math.floor(conf*100);
jet_colormap[conf]='rgb('+r.toString()+','+g.toString()+','+b.toString()+')';
//console.log(i,jet[i]);
}
initialize();
</script>
</body>
</html>