  
      def _clear_session(self):
          """ Clear the currently displayed analysis data from the Tree-View. """
          logger.debug("Clearing session")
          if self._session is None:
              logger.trace("No session loaded. Returning")
              return
          self._summary = None
          self._stats.session = None
          self._stats.tree_clear()
 
</s> remove         self._stats.session = None
 </s> add  </s> remove         """ Summarize data in a LongRunningThread as it can take a while """
 </s> add         """ Summarize data in a LongRunningThread as it can take a while.

        Parameters
        ----------
        session: :class:`lib.gui.stats.Session`
            The session object to generate the summary for
        """ </s> remove         self._reset_session_info()
        self._session = None
 </s> add         if not Session.is_training:
            self._reset_session_info()
            Session.clear() </s> remove         if self.trace_var is not None:
            get_config().tk_vars["smoothgraph"].trace_vdelete("w", self.trace_var)
            self.trace_var = None
 </s> add         self._clear_trace_variables()
        if not Session.is_loaded:
  
      def _clear_session(self):
          """ Clear the currently displayed analysis data from the Tree-View. """
          logger.debug("Clearing session")
        if not Session.is_loaded:
              logger.trace("No session loaded. Returning")
              return
          self._summary = None
          self._stats.session = None
          self._stats.tree_clear()
keep keep keep keep replace keep keep keep keep keep
 GUI - Stats optimization (#1067)

* Faster stat loading + caching

* Compress data in cache

* Optimize some calculations

* Vectorize smoothing

* stats.Calculations optimized

* Load latest training data from live iterator

* Add options to training graph 
lib/gui/display_analysis.py