updates high level statistics in bottom left of GUI.
960398
def update_high_level_stats(self):
        
        self.clear_high_level_pars()
        dirtype = str(self.coordinates_box.GetValue())
        if dirtype == 'specimen':
            dirtype = 'DA-DIR'
        elif dirtype == 'geographic':
            dirtype = 'DA-DIR-GEO'
        elif dirtype == 'tilt-corrected':
            dirtype = 'DA-DIR-TILT'
        if str(self.level_box.GetValue()) == 'sample':
            high_level_type = 'samples'
        elif str(self.level_box.GetValue()) == 'site':
            high_level_type = 'sites'
        elif str(self.level_box.GetValue()) == 'location':
            high_level_type = 'locations'
        elif str(self.level_box.GetValue()) == 'study':
            high_level_type = 'study'
        high_level_name = str(self.level_names.GetValue())
        elements_type = self.UPPER_LEVEL_SHOW
        if high_level_name in list(self.high_level_means[high_level_type].keys()):
            mpars = []
            for mf in list(self.high_level_means[high_level_type][high_level_name].keys()):
                if mf in list(self.high_level_means[high_level_type][high_level_name].keys()) and self.mean_fit == 'All' or mf == self.mean_fit:
                    if dirtype in list(self.high_level_means[high_level_type][high_level_name][mf].keys()):
                        mpar = deepcopy(
                            self.high_level_means[high_level_type][high_level_name][mf][dirtype])
                        if 'n' in mpar and mpar['n'] == 1:
                            mpar['calculation_type'] = "Fisher:"+mf
                            mpars.append(mpar)
                        elif mpar['calculation_type'] == 'Fisher by polarity':
                            for k in list(mpar.keys()):
                                if k == 'color' or k == 'calculation_type':
                                    continue
                                mpar[k]['calculation_type'] += ':'+k+':'+mf
                                mpar[k]['color'] = mpar['color']
                                if 'K' not in mpar[k] and 'k' in mpar[k]:
                                    mpar[k]['K'] = mpar[k]['k']
                                if 'R' not in mpar[k] and 'r' in mpar[k]:
                                    mpar[k]['R'] = mpar[k]['r']
                                if 'n_lines' not in mpar[k] and 'n' in mpar[k]:
                                    mpar[k]['n_lines'] = mpar[k]['n']
                                mpars.append(mpar[k])
                        else:
                            mpar['calculation_type'] += ":"+mf
                            mpars.append(mpar)
            self.switch_stats_button.SetRange(0, len(mpars)-1)
            self.show_high_levels_pars(mpars)
            if self.ie_open:
                self.ie.switch_stats_button.SetRange(0, len(mpars)-1)
32116
def update(self):
        """"""
        # Init new stats
        stats = self.get_init_value()

        if self.input_method == 'local':
            # Update stats using the standard system lib
            stats = self.glancesgrabhddtemp.get()

        else:
            # Update stats using SNMP
            # Not available for the moment
            pass

        # Update the stats
        self.stats = stats

        return self.stats
367167
public void updateStructure()
   {
      if (size() > 1)
      {
         Collections.sort(this);
         m_projectFile.getChildTasks().clear();

         Task lastTask = null;
         int lastLevel = -1;
         boolean autoWbs = m_projectFile.getProjectConfig().getAutoWBS();
         boolean autoOutlineNumber = m_projectFile.getProjectConfig().getAutoOutlineNumber();

         for (Task task : this)
         {
            task.clearChildTasks();
            Task parent = null;
            if (!task.getNull())
            {
               int level = NumberHelper.getInt(task.getOutlineLevel());

               if (lastTask != null)
               {
                  if (level == lastLevel || task.getNull())
                  {
                     parent = lastTask.getParentTask();
                     level = lastLevel;
                  }
                  else
                  {
                     if (level > lastLevel)
                     {
                        parent = lastTask;
                     }
                     else
                     {
                        while (level <= lastLevel)
                        {
                           parent = lastTask.getParentTask();

                           if (parent == null)
                           {
                              break;
                           }

                           lastLevel = NumberHelper.getInt(parent.getOutlineLevel());
                           lastTask = parent;
                        }
                     }
                  }
               }

               lastTask = task;
               lastLevel = level;

               if (autoWbs || task.getWBS() == null)
               {
                  task.generateWBS(parent);
               }

               if (autoOutlineNumber)
               {
                  task.generateOutlineNumber(parent);
               }
            }

            if (parent == null)
            {
               m_projectFile.getChildTasks().add(task);
            }
            else
            {
               parent.addChildTask(task);
            }
         }
      }
   }
107783
def update(self):
        """"""
        # Init new stats
        stats = self.get_init_value()

        if self.input_method == 'local':
            # Folder list only available in a full Glances environment
            # Check if the glances_folder instance is init
            if self.glances_folders is None:
                return self.stats

            # Update the foldered list (result of command)
            self.glances_folders.update()

            # Put it on the stats var
            stats = self.glances_folders.get()
        else:
            pass

        # Update the stats
        self.stats = stats

        return self.stats
514852
def update(self):
        
        con = self.subpars.pars.control
        self(con.eqi1*con.tind)
795390
def updatePlotWidget(self):
        """"""
        pw = self.getPlotWidget()
        pw.reset()

        results = self.resultsModel.getCheckedItems()

        for result in results:
            if isinstance(result, ExperimentalData):
                spectrum = result.spectra['Expt']
                spectrum.legend = '{}-{}'.format(result.index, 'Expt')
                spectrum.xLabel = 'X'
                spectrum.yLabel = 'Y'
                spectrum.plot(plotWidget=pw)
            else:
                if len(results) > 1 and result.experiment in ['RIXS', ]:
                    continue
                for spectrum in result.spectra.processed:
                    spectrum.legend = '{}-{}'.format(
                        result.index, spectrum.shortName)
                    if spectrum.name in result.spectra.toPlotChecked:
                        spectrum.plot(plotWidget=pw)
285143
def update_values(self):
        """"""
        self.method = self.idx_method.currentText()
        spin_det = DetectSpindle(method=self.method)
        
        self.index['f1'].set_value(spin_det.frequency[0])
        self.index['f2'].set_value(spin_det.frequency[1])
        self.index['tolerance'].set_value(spin_det.tolerance)
        self.index['min_dur'].set_value(spin_det.duration[0])
        self.index['max_dur'].set_value(spin_det.duration[1])        
        self.index['interval'].set_value(spin_det.min_interval)

        if spin_det.rolloff:
            self.index['rolloff'].set_value(spin_det.rolloff)
            self.index['rolloff'].setEnabled(True)
        else:
            self.index['rolloff'].set_value('N/A')
            self.index['rolloff'].setEnabled(False)

        if self.method == 'Ferrarelli2007':
            self.label[0].setText('Detection threshold')
            self.label[1].setText('Selection threshold')
            self.label[2].setText('')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.det_thresh)
            self.index['1'].set_value(spin_det.sel_thresh)        
        
        if self.method == 'Nir2011':
            self.label[0].setText('Gaussian smoothing sigma (sec)')
            self.label[1].setText('Detection threshold (SD)')
            self.label[2].setText('Selection threshold (SD)')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.smooth['dur'])
            self.index['1'].set_value(spin_det.det_thresh)
            self.index['2'].set_value(spin_det.sel_thresh)            
        
        if self.method == 'Moelle2011':
            self.label[0].setText('RMS window length (sec)')
            self.label[1].setText('Smoothing window length (sec)')
            self.label[2].setText('Detection threshold (SD)')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.moving_rms['dur'])
            self.index['1'].set_value(spin_det.smooth['dur'])
            self.index['2'].set_value(spin_det.det_thresh)

        if self.method == 'Wamsley2012':
            self.label[0].setText('Wavelet window length (sec)')
            self.label[1].setText('Wavelet sigma (sec)')
            self.label[2].setText('Smoothing window length (sec)')
            self.label[3].setText('Detection threshold')
            self.label[4].setText('')
            self.label[5].setText('')
            
            self.index['0'].set_value(spin_det.det_wavelet['dur'])
            self.index['1'].set_value(spin_det.det_wavelet['sd'])
            self.index['2'].set_value(spin_det.smooth['dur'])
            self.index['3'].set_value(spin_det.det_thresh)

        if self.method == 'Martin2013':
            self.label[0].setText('RMS window length (sec)')
            self.label[1].setText('RMS window step (sec)')
            self.label[2].setText('Detection threshold (percentile)')
            
            self.index['0'].set_value(spin_det.moving_rms['dur'])
            self.index['1'].set_value(spin_det.moving_rms['step'])
            self.index['2'].set_value(spin_det.det_thresh)
        
        if self.method == 'Ray2015':
            self.label[0].setText('Smoothing window length (sec)')
            self.label[1].setText('z-score window length (sec)')
            self.label[2].setText('Detection threshold (z)')
            self.label[3].setText('Selection threshold (z)')
            self.label[4].setText('')
            self.label[5].setText('')
            
            self.index['0'].set_value(spin_det.smooth['dur'])
            self.index['1'].set_value(spin_det.zscore['step'])
            self.index['2'].set_value(spin_det.det_thresh)
            self.index['3'].set_value(spin_det.sel_thresh)

        if self.method == 'Lacourse2018':
            self.label[0].setText('Window length (sec)')
            self.label[1].setText('Window step (sec)')
            self.label[2].setText('Absolute power threshold')
            self.label[3].setText('Relative power threshold')
            self.label[4].setText('Covariance threshold')
            self.label[5].setText('Correlation threshold')
            
            self.index['0'].set_value(spin_det.windowing['dur'])
            self.index['1'].set_value(spin_det.windowing['step'])
            self.index['2'].set_value(spin_det.abs_pow_thresh)
            self.index['3'].set_value(spin_det.rel_pow_thresh)
            self.index['4'].set_value(spin_det.covar_thresh)
            self.index['5'].set_value(spin_det.corr_thresh)

        if self.method == 'FASST':
            self.label[0].setText('Detection threshold (percentile)')
            self.label[1].setText('Smoothing window length (sec)')
            self.label[2].setText('')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.det_thresh)
            self.index['1'].set_value(spin_det.smooth['dur'])
            
        if self.method == 'FASST2':
            self.label[0].setText('Detection threshold (percentile)')
            self.label[1].setText('RMS window length (sec)')
            self.label[2].setText('Smoothing window length (sec)')
            self.label[3].setText('')
            self.label[4].setText('')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.det_thresh)
            self.index['1'].set_value(spin_det.moving_rms['dur'])
            self.index['2'].set_value(spin_det.smooth['dur'])
            
        if 'UCSD' in self.method:
            self.label[0].setText('Wavelet duration (sec)')
            self.label[1].setText('Wavelet width (sec)')
            self.label[2].setText('Smoothing window length (sec)')
            self.label[3].setText('Detection threshold (SD)')
            self.label[4].setText('Selection threshold (SD)')
            self.label[5].setText('')

            self.index['0'].set_value(spin_det.det_wavelet['dur'])
            self.index['1'].set_value(spin_det.det_wavelet['width'])
            self.index['2'].set_value(spin_det.det_wavelet['win'])
            self.index['3'].set_value(spin_det.det_thresh)
            self.index['4'].set_value(spin_det.sel_thresh)

        if 'Concordia' in self.method:
            self.label[0].setText('RMS window length (sec)')
            self.label[1].setText('Smoothing window length (sec)')
            self.label[2].setText('Detection threshold, low (SD)')
            self.label[3].setText('Detection threshold, high (SD)')
            self.label[4].setText('Tolerance (sec)')
            self.label[5].setText('Selection threshold (SD)')

            self.index['0'].set_value(spin_det.moving_rms['dur'])
            self.index['1'].set_value(spin_det.smooth['dur'])
            self.index['2'].set_value(spin_det.det_thresh)
            self.index['3'].set_value(spin_det.det_thresh_hi)
            self.index['4'].set_value(spin_det.tolerance)
            self.index['5'].set_value(spin_det.sel_thresh)
        
        for i, j in enumerate(self.label):
            one_param = self.index[str(i)]
            if j.text() == '':
                one_param.set_value('')
                one_param.setEnabled(False)
            else:
                one_param.setEnabled(True)
526008
def _update_terminal_region(self, tree, terminal_regions, leaf, X, y,
                                residual, pred, sample_weight):
        """"""
160078
def update_displayed_information(self):
        

        for source in self.controller.sources:
            source_name = source.get_source_name()
            if (any(self.graphs_menu.active_sensors[source_name]) or
                    any(self.summary_menu.active_sensors[source_name])):
                source.update()

        for graph in self.visible_graphs.values():
            graph.update()

        # update graph summery
        for summary in self.visible_summaries.values():
            summary.update()

        # Only update clock if not is stress mode
        if self.controller.stress_conroller.get_current_mode() != 'Monitor':
            self.clock_view.set_text(seconds_to_text(
                (timeit.default_timer() - self.controller.stress_start_time)))
113569
def refresh(self, **kwargs):
        """"""
        self.resource.refresh(**kwargs)
        self.rdict = self.resource.entries
        self._update_stats()
694374
def update_views(self):
        """"""
        # Call the father's method
        super(Plugin, self).update_views()

        if 'containers' not in self.stats:
            return False

        # Add specifics informations
        # Alert
        for i in self.stats['containers']:
            # Init the views for the current container (key = container name)
            self.views[i[self.get_key()]] = {'cpu': {}, 'mem': {}}
            # CPU alert
            if 'cpu' in i and 'total' in i['cpu']:
                # Looking for specific CPU container threasold in the conf file
                alert = self.get_alert(i['cpu']['total'],
                                       header=i['name'] + '_cpu',
                                       action_key=i['name'])
                if alert == 'DEFAULT':
                    # Not found ? Get back to default CPU threasold value
                    alert = self.get_alert(i['cpu']['total'], header='cpu')
                self.views[i[self.get_key()]]['cpu']['decoration'] = alert
            # MEM alert
            if 'memory' in i and 'usage' in i['memory']:
                # Looking for specific MEM container threasold in the conf file
                alert = self.get_alert(i['memory']['usage'],
                                       maximum=i['memory']['limit'],
                                       header=i['name'] + '_mem',
                                       action_key=i['name'])
                if alert == 'DEFAULT':
                    # Not found ? Get back to default MEM threasold value
                    alert = self.get_alert(i['memory']['usage'],
                                           maximum=i['memory']['limit'],
                                           header='mem')
                self.views[i[self.get_key()]]['mem']['decoration'] = alert

        return True
1213898
def update_views(self):
        """"""
        # Call the father's method
        super(Plugin, self).update_views()

        # Add specifics informations
        # Alert on signal thresholds
        for i in self.stats:
            self.views[i[self.get_key()]]['signal']['decoration'] = self.get_alert(i['signal'])
            self.views[i[self.get_key()]]['quality']['decoration'] = self.views[i[self.get_key()]]['signal']['decoration']
532856
def update_default_output_dir(self):
        """"""
        if self.scenario_directory_radio.isChecked():
            self.output_directory.setText(self.source_directory.text())
1228560
private void updateChart() {
        Platform.runLater(() -> {
            List<LeaderBoardItem> items = tile.getLeaderBoardItems();
            int noOfItems = items.size();
            if (noOfItems == 0) return;
            double maxY = height - size * 0.25;
            for (int i = 0 ; i < noOfItems ; i++) {
                LeaderBoardItem item = items.get(i);
                double y = i * 0.175 * size; //size * 0.18 + i * 0.175 * size;
                if (y < maxY) {
                    item.setManaged(true);
                    item.setVisible(true);
                    item.relocate(0, y);
                } else {
                    item.setVisible(false);
                    item.setManaged(false);
                }
            }
        });
    }
1238757
def update_local(self):
        """"""
        # Grab CPU stats using psutil's cpu_percent and cpu_times_percent
        # Get all possible values for CPU stats: user, system, idle,
        # nice (UNIX), iowait (Linux), irq (Linux, FreeBSD), steal (Linux 2.6.11+)
        # The following stats are returned by the API but not displayed in the UI:
        # softirq (Linux), guest (Linux 2.6.24+), guest_nice (Linux 3.2.0+)

        # Init new stats
        stats = self.get_init_value()

        stats['total'] = cpu_percent.get()
        cpu_times_percent = psutil.cpu_times_percent(interval=0.0)
        for stat in ['user', 'system', 'idle', 'nice', 'iowait',
                     'irq', 'softirq', 'steal', 'guest', 'guest_nice']:
            if hasattr(cpu_times_percent, stat):
                stats[stat] = getattr(cpu_times_percent, stat)

        # Additional CPU stats (number of events not as a %; psutil>=4.1.0)
        # ctx_switches: number of context switches (voluntary + involuntary) per second
        # interrupts: number of interrupts per second
        # soft_interrupts: number of software interrupts per second. Always set to 0 on Windows and SunOS.
        # syscalls: number of system calls since boot. Always set to 0 on Linux.
        cpu_stats = psutil.cpu_stats()
        # By storing time data we enable Rx/s and Tx/s calculations in the
        # XML/RPC API, which would otherwise be overly difficult work
        # for users of the API
        time_since_update = getTimeSinceLastUpdate('cpu')

        # Previous CPU stats are stored in the cpu_stats_old variable
        if not hasattr(self, 'cpu_stats_old'):
            # First call, we init the cpu_stats_old var
            self.cpu_stats_old = cpu_stats
        else:
            for stat in cpu_stats._fields:
                if getattr(cpu_stats, stat) is not None:
                    stats[stat] = getattr(cpu_stats, stat) - getattr(self.cpu_stats_old, stat)

            stats['time_since_update'] = time_since_update

            # Core number is needed to compute the CTX switch limit
            stats['cpucore'] = self.nb_log_core

            # Save stats to compute next step
            self.cpu_stats_old = cpu_stats

        return stats
1007112
def update_stats(stats, start_time, data):
    '''
    
    '''
    end_time = time.time()
    cmd = data['cmd']
    # the jid is used as the create time
    try:
        jid = data['jid']
    except KeyError:
        try:
            jid = data['data']['__pub_jid']
        except KeyError:
            log.info('jid not found in data, stats not updated')
            return stats
    create_time = int(time.mktime(time.strptime(jid, '%Y%m%d%H%M%S%f')))
    latency = start_time - create_time
    duration = end_time - start_time

    stats[cmd]['runs'] += 1
    stats[cmd]['latency'] = (stats[cmd]['latency'] * (stats[cmd]['runs'] - 1) + latency) / stats[cmd]['runs']
    stats[cmd]['mean'] = (stats[cmd]['mean'] * (stats[cmd]['runs'] - 1) + duration) / stats[cmd]['runs']

    return stats
150163
def update(self):
        """"""
        # Init new stats
        stats = self.get_init_value()

        # !!! JUST FOR TEST (because i did not have any NVidia GPU... :()
        # self.stats = [{"key": "gpu_id", "mem": None, "proc": 60, "gpu_id": 0, "name": "GeForce GTX 560 Ti"}]
        # self.stats = [{"key": "gpu_id", "mem": 10, "proc": 60, "gpu_id": 0, "name": "GeForce GTX 560 Ti"}]
        # self.stats = [{"key": "gpu_id", "mem": 48.64645, "proc": 60.73, "gpu_id": 0, "name": "GeForce GTX 560 Ti"},
        #               {"key": "gpu_id", "mem": 70.743, "proc": 80.28, "gpu_id": 1, "name": "GeForce GTX 560 Ti"},
        #               {"key": "gpu_id", "mem": 0, "proc": 0, "gpu_id": 2, "name": "GeForce GTX 560 Ti"}]
        # self.stats = [{"key": "gpu_id", "mem": 48.64645, "proc": 60.73, "gpu_id": 0, "name": "GeForce GTX 560 Ti"},
        #               {"key": "gpu_id", "mem": None, "proc": 80.28, "gpu_id": 1, "name": "GeForce GTX 560 Ti"},
        #               {"key": "gpu_id", "mem": 0, "proc": 0, "gpu_id": 2, "name": "ANOTHER GPU"}]
        # !!! TO BE COMMENTED

        if not self.nvml_ready:
            return self.stats

        if self.input_method == 'local':
            stats = self.get_device_stats()
        elif self.input_method == 'snmp':
            # not available
            pass

        # Update the stats
        self.stats = stats

        return self.stats