Browse Source

Add of experiment identifier from indications

Jérôme BUISINE 2 years ago
parent
commit
86509f7af3
5 changed files with 24 additions and 2 deletions
  1. 1 0
      expe/expes/run.py
  2. 18 0
      expe/templates/expe/expe_indications.html
  3. 2 0
      expe/views.py
  4. 1 1
      static/css/expe.css
  5. 2 1
      static/js/indications.js

+ 1 - 0
expe/expes/run.py

@@ -75,6 +75,7 @@ def run_quest_one_image(request, model_filepath, output_file):
         # TODO : check `i` variable 
         # update of `quest`
         # qp.update(qualities[i], answer)
+        # Use of previous stim
         qp.update(qualities[iteration], answer) 
         entropy = qp.get_entropy()
 

+ 18 - 0
expe/templates/expe/expe_indications.html

@@ -12,6 +12,24 @@
     <br />
     <h5>{{indication}}</h5>
 
+    <br />
+    <br />
+
+    <div class="row">
+        <div class="col-md-4 offset-md-4">
+            <form method="GET" action="/expe">
+                <div class="form-group">
+                    <input type="hidden" name="scene" value="{{scene_name}}"/>
+                    <input type="hidden" name="expe" value="{{expe_name}}"/>
+                    <input type="hidden" name="iteration" value="0"/>
+
+                    <label for="experimentId">Select experiment identifier:</label>
+                    <input type="text" class="form-control" name="experimentId" placeholder="Enter your experiment identifier"/>
+                </div>
+            </form>
+        </div>
+    </div>
+
     <p id="expeIndication"><strong>Press enter to begin experiments</strong></p>
 
 {% endblock %}

+ 2 - 0
expe/views.py

@@ -75,11 +75,13 @@ def indications(request):
 
     # get param 
     expe_name = request.GET.get('expe')
+    scene_name = request.GET.get('scene')
 
     # get base data
     data = get_base_data()
     # expe parameters
     data['expe_name']  = expe_name
+    data['scene_name'] = scene_name
     data['question']   = cfg.expes_configuration[expe_name]['text']['question']
     data['indication'] = cfg.expes_configuration[expe_name]['text']['indication']
 

+ 1 - 1
static/css/expe.css

@@ -12,7 +12,7 @@ body {
 }
 
 #expeIndication{
-    margin-top: 30%;
+    margin-top: 20%;
 }
 
 

+ 2 - 1
static/js/indications.js

@@ -15,7 +15,8 @@ const checkKey = e => {
      }
      else if (e.keyCode === KEYCODE_ENTER) {
           // right arrow
-          const params = `?scene=${scene}&expe=${expe}&iteration=0`
+          const experimentId = document.getElementsByName('experimentId')[0].value
+          const params = `?scene=${scene}&expe=${expe}&experimentId=${experimentId}&iteration=0`
           console.log(expeUrl + params)
           window.location = expeUrl + params
      }