0
0
compton 1 год назад
Родитель
Сommit
d86166c0a6
1 измененных файлов с 11 добавлено и 7 удалено
  1. 11 7
      page/init.php

+ 11 - 7
page/init.php

@@ -82,7 +82,7 @@ $selected_csv = isset($_GET["csv_file"])&&in_array($_GET["csv_file"], $cleanArrs
         function parseResultsTable(allRows, energy_point){
             // Extracts a row following the energy point in the total csv file (or null if energy point is not exists)
             data = energy_point.slice(0, -4).split('_');
-            for (var i=0; i<allRows.length; i++){
+	    for (var i=0; i<allRows.length; i++){
                 if (allRows[i].first_run == data[1] ){
                     return allRows[i];
                 }
@@ -92,11 +92,14 @@ $selected_csv = isset($_GET["csv_file"])&&in_array($_GET["csv_file"], $cleanArrs
         
         function parseRow(row){
             // Parses a row from the detailed csv file
-            row['start_time'] = Date.parse(row['compton_start']);
+	    row['start_time'] = Date.parse(row['compton_start']);
             row['stop_time'] = Date.parse(row['compton_stop']);
             row['center_time'] = new Date((row['start_time'] + row['stop_time'])/2);
             row['timedelta'] = (row['stop_time'] - row['start_time'])/2/1000; // in seconds
-            text_str = "<b>Compton</b><br>" + "<i>Start: </i>" + 
+
+	    text_energy = "E = " + parseFloat(row['e_mean']).toFixed(2) + "±" + parseFloat(row['e_std']).toFixed(2) + " MeV<br>";
+	    text_spread = "spread = " + parseFloat(row['spread_mean']).toFixed(2) + "±" + parseFloat(row['spread_std']).toFixed(2) + " MeV<br>";
+            text_str = text_energy + text_spread + "<b>Compton</b><br>" + "<i>Start: </i>" + 
                     row['compton_start'] + "<br><i>Stop: </i>" + row['compton_stop'] + "<br><br>";
             row['text_str'] = text_str + "<b>Runs: </b>" + row['run_first'] + " - " + row['run_last'] + "<br><br>";
             return row;
@@ -266,15 +269,16 @@ $selected_csv = isset($_GET["csv_file"])&&in_array($_GET["csv_file"], $cleanArrs
             var traces = [trace1, trace2, trace3];
             
             var updatemenus = [];
+	    // console.log(dict);
             if (dict['mean_energy_total']){
                 updatemenus = [{
                 buttons: [
                     {
-                        args:[{'shapes[0].visible': true, 'shapes[1].visible': false, 'title': 'Mean energy: ' + parseFloat(dict['mean_energy_total']).toFixed(3) + ' MeV',}],
+                        args:[{'shapes[0].visible': true, 'shapes[1].visible': false, 'title': '<E> = ' + parseFloat(dict['mean_energy_total']).toFixed(3) + ' MeV, ' + '<Spread> = ' + parseFloat(dict['mean_spread_total']).toFixed(3) + ' MeV',}],
                         label: 'Current average method',
                         method: 'relayout'
                     }, {
-                        args:[{'shapes[0].visible': false, 'shapes[1].visible': true, 'title': 'Mean energy: ' + dict['old_mean_energy_total'].toFixed(3)  + ' MeV',}],
+                        args:[{'shapes[0].visible': false, 'shapes[1].visible': true, 'title': '<E> = ' + parseFloat(dict['old_mean_energy_total']).toFixed(3) + ' MeV, ' + '<Spread> = ' + parseFloat(dict['mean_spread_total']).toFixed(3) + ' MeV',}],
                         label: 'Former average method',
                         method: 'relayout'
                     },
@@ -290,10 +294,10 @@ $selected_csv = isset($_GET["csv_file"])&&in_array($_GET["csv_file"], $cleanArrs
             }
             
             var layout = {
-                title: 'Mean energy: ' + dict['mean_energy_total'] + ' MeV',
+                title: '<E> = ' + parseFloat(dict['mean_energy_total']).toFixed(3) + ' MeV, ' + '<Spread> = ' + parseFloat(dict['mean_spread_total']).toFixed(3) + ' MeV',
                 updatemenus: updatemenus,
                 font: {
-                    size: 18,
+                    size: 16,
                 },
                 xaxis: {
                     title: "Time, NSK",