<s> """<STR_LIT>""" <EOL> ___author__ = '<STR_LIT>' <EOL> from pypet . parameter import Parameter , Result , ObjectTable <EOL> from pypet . utils . decorators import copydoc <EOL> import pypet . pypetexceptions as pex <EOL> try : <EOL> from brian . units import * <EOL> from brian . stdunits import * <EOL> except TypeError : <EOL> pass <EOL> from brian . fundamentalunits import Quantity , get_unit_fast <EOL> from brian . monitor import SpikeMonitor , SpikeCounter , StateMonitor , PopulationSpikeCounter , PopulationRateMonitor , StateSpikeMonitor , MultiStateMonitor , ISIHistogramMonitor , VanRossumMetric , Monitor <EOL> import numpy as np <EOL> import pandas as pd <EOL> class BrianParameter ( Parameter ) : <EOL> """<STR_LIT>""" <EOL> IDENTIFIER = '<STR_LIT>' <EOL> '''<STR_LIT>''' <EOL> FLOAT_MODE = '<STR_LIT>' <EOL> '''<STR_LIT>''' <EOL> STRING_MODE = '<STR_LIT>' <EOL> '''<STR_LIT>''' <EOL> __slots__ = ( '<STR_LIT>' , ) <EOL> def __init__ ( self , full_name , data = None , comment = '<STR_LIT>' , storage_mode = FLOAT_MODE ) : <EOL> super ( BrianParameter , self ) . __init__ ( full_name , data , comment ) <EOL> self . _storage_mode = None <EOL> self . v_storage_mode = storage_mode <EOL> @ property <EOL> def v_storage_mode ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _storage_mode <EOL> @ v_storage_mode . setter <EOL> def v_storage_mode ( self , storage_mode ) : <EOL> assert ( storage_mode == BrianParameter . STRING_MODE or <EOL> storage_mode == BrianParameter . FLOAT_MODE ) <EOL> self . _storage_mode = storage_mode <EOL> def f_supports ( self , data ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( data , Quantity ) : <EOL> return True <EOL> if super ( BrianParameter , self ) . f_supports ( data ) : <EOL> return True <EOL> return False <EOL> def _values_of_same_type ( self , val1 , val2 ) : <EOL> if isinstance ( val1 , Quantity ) : <EOL> try : <EOL> if not val1 . has_same_dimensions ( val2 ) : <EOL> return False <EOL> except AttributeError : <EOL> return False <EOL> elif isinstance ( val2 , Quantity ) : <EOL> try : <EOL> if not val2 . has_same_dimensions ( val1 ) : <EOL> return False <EOL> except AttributeError : <EOL> return False <EOL> elif not super ( BrianParameter , self ) . _values_of_same_type ( val1 , val2 ) : <EOL> return False <EOL> return True <EOL> def _store ( self ) : <EOL> if isinstance ( self . _data , Quantity ) : <EOL> store_dict = { } <EOL> if self . _storage_mode == BrianParameter . STRING_MODE : <EOL> valstr = self . _data . in_best_unit ( python_code = True ) <EOL> store_dict [ '<STR_LIT:data>' + BrianParameter . IDENTIFIER ] = ObjectTable ( <EOL> data = { '<STR_LIT:data>' : [ valstr ] } ) <EOL> if self . f_has_range ( ) : <EOL> valstr_list = [ ] <EOL> for val in self . _explored_range : <EOL> valstr = val . in_best_unit ( python_code = True ) <EOL> valstr_list . append ( valstr ) <EOL> store_dict [ '<STR_LIT>' + BrianParameter . IDENTIFIER ] = ObjectTable ( data = { '<STR_LIT:data>' : valstr_list } ) <EOL> elif self . _storage_mode == BrianParameter . FLOAT_MODE : <EOL> unitstr = repr ( get_unit_fast ( self . _data ) ) <EOL> value = float ( self . _data ) <EOL> store_dict [ '<STR_LIT:data>' + BrianParameter . IDENTIFIER ] = ObjectTable ( <EOL> data = { '<STR_LIT:value>' : [ value ] , '<STR_LIT>' : [ unitstr ] } ) <EOL> if self . f_has_range ( ) : <EOL> value_list = [ ] <EOL> for val in self . _explored_range : <EOL> value = float ( val ) <EOL> value_list . append ( value ) <EOL> store_dict [ '<STR_LIT>' + BrianParameter . IDENTIFIER ] = ObjectTable ( data = { '<STR_LIT:value>' : value_list } ) <EOL> else : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> self . _locked = True <EOL> return store_dict <EOL> else : <EOL> return super ( BrianParameter , self ) . _store ( ) <EOL> def _load ( self , load_dict ) : <EOL> if self . v_locked : <EOL> raise pex . ParameterLockedException ( '<STR_LIT>' % self . v_full_name ) <EOL> try : <EOL> data_table = load_dict [ '<STR_LIT:data>' + BrianParameter . IDENTIFIER ] <EOL> if '<STR_LIT>' in data_table : <EOL> self . _storage_mode = BrianParameter . FLOAT_MODE <EOL> else : <EOL> self . _storage_mode = BrianParameter . STRING_MODE <EOL> if self . _storage_mode == BrianParameter . STRING_MODE : <EOL> valstr = data_table [ '<STR_LIT:data>' ] [ <NUM_LIT:0> ] <EOL> self . _data = eval ( valstr ) <EOL> if '<STR_LIT>' + BrianParameter . IDENTIFIER in load_dict : <EOL> explore_table = load_dict [ '<STR_LIT>' + BrianParameter . IDENTIFIER ] <EOL> valstr_col = explore_table [ '<STR_LIT:data>' ] <EOL> explore_list = [ ] <EOL> for valstr in valstr_col : <EOL> brian_quantity = eval ( valstr ) <EOL> explore_list . append ( brian_quantity ) <EOL> self . _explored_range = tuple ( explore_list ) <EOL> self . _explored = True <EOL> elif self . _storage_mode == BrianParameter . FLOAT_MODE : <EOL> unit = eval ( data_table [ '<STR_LIT>' ] [ <NUM_LIT:0> ] ) <EOL> value = data_table [ '<STR_LIT:value>' ] [ <NUM_LIT:0> ] <EOL> self . _data = value * unit <EOL> if '<STR_LIT>' + BrianParameter . IDENTIFIER in load_dict : <EOL> explore_table = load_dict [ '<STR_LIT>' + BrianParameter . IDENTIFIER ] <EOL> value_col = explore_table [ '<STR_LIT:value>' ] <EOL> explore_list = [ ] <EOL> for value in value_col : <EOL> brian_quantity = value * unit <EOL> explore_list . append ( brian_quantity ) <EOL> self . _explored_range = tuple ( explore_list ) <EOL> self . _explored = True <EOL> except KeyError : <EOL> super ( BrianParameter , self ) . _load ( load_dict ) <EOL> self . _default = self . _data <EOL> self . _locked = True <EOL> class BrianResult ( Result ) : <EOL> """<STR_LIT>""" <EOL> IDENTIFIER = BrianParameter . IDENTIFIER <EOL> '''<STR_LIT>''' <EOL> FLOAT_MODE = '<STR_LIT>' <EOL> '''<STR_LIT>''' <EOL> STRING_MODE = '<STR_LIT>' <EOL> '''<STR_LIT>''' <EOL> __slots__ = ( '<STR_LIT>' , ) <EOL> def __init__ ( self , full_name , * args , ** kwargs ) : <EOL> self . _storage_mode = None <EOL> storage_mode = kwargs . pop ( '<STR_LIT>' , BrianResult . FLOAT_MODE ) <EOL> self . v_storage_mode = storage_mode <EOL> super ( BrianResult , self ) . __init__ ( full_name , * args , ** kwargs ) <EOL> @ property <EOL> def v_storage_mode ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _storage_mode <EOL> @ v_storage_mode . setter <EOL> def v_storage_mode ( self , storage_mode ) : <EOL> assert ( storage_mode == BrianResult . STRING_MODE or storage_mode == BrianResult . FLOAT_MODE ) <EOL> self . _storage_mode = storage_mode <EOL> @ copydoc ( Result . f_set_single ) <EOL> def f_set_single ( self , name , item ) : <EOL> if BrianResult . IDENTIFIER in name : <EOL> raise AttributeError ( '<STR_LIT>' <EOL> '<STR_LIT>' % <EOL> BrianResult . IDENTIFIER ) <EOL> elif name == '<STR_LIT>' : <EOL> self . v_storage_mode = item <EOL> else : <EOL> super ( BrianResult , self ) . f_set_single ( name , item ) <EOL> def _supports ( self , data ) : <EOL> if isinstance ( data , Quantity ) : <EOL> return True <EOL> else : <EOL> return super ( BrianResult , self ) . _supports ( data ) <EOL> def _store ( self ) : <EOL> store_dict = { } <EOL> for key in self . _data : <EOL> val = self . _data [ key ] <EOL> if isinstance ( val , Quantity ) : <EOL> if self . _storage_mode == BrianResult . STRING_MODE : <EOL> valstr = val . in_best_unit ( python_code = True ) <EOL> store_dict [ key + BrianResult . IDENTIFIER ] = ObjectTable ( <EOL> data = { '<STR_LIT:data>' : [ valstr ] } ) <EOL> elif self . _storage_mode == BrianResult . FLOAT_MODE : <EOL> unitstr = repr ( get_unit_fast ( val ) ) <EOL> value = float ( val ) <EOL> store_dict [ key + BrianResult . IDENTIFIER ] = ObjectTable ( <EOL> data = { '<STR_LIT:value>' : [ value ] , '<STR_LIT>' : [ unitstr ] } ) <EOL> else : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> else : <EOL> store_dict [ key ] = val <EOL> return store_dict <EOL> def _load ( self , load_dict ) : <EOL> for key in load_dict : <EOL> if BrianResult . IDENTIFIER in key : <EOL> data_table = load_dict [ key ] <EOL> if '<STR_LIT>' in data_table : <EOL> self . _storage_mode = BrianResult . FLOAT_MODE <EOL> else : <EOL> self . _storage_mode = BrianResult . STRING_MODE <EOL> new_key = key . split ( BrianResult . IDENTIFIER ) [ <NUM_LIT:0> ] <EOL> if self . _storage_mode == BrianResult . STRING_MODE : <EOL> valstr = data_table [ '<STR_LIT:data>' ] [ <NUM_LIT:0> ] <EOL> self . _data [ new_key ] = eval ( valstr ) <EOL> elif self . _storage_mode == BrianResult . FLOAT_MODE : <EOL> unit = eval ( data_table [ '<STR_LIT>' ] [ <NUM_LIT:0> ] ) <EOL> value = data_table [ '<STR_LIT:value>' ] [ <NUM_LIT:0> ] <EOL> self . _data [ new_key ] = value * unit <EOL> else : <EOL> self . _data [ key ] = load_dict [ key ] <EOL> class BrianMonitorResult ( Result ) : <EOL> """<STR_LIT>""" <EOL> TABLE_MODE = '<STR_LIT>' <EOL> '''<STR_LIT>''' <EOL> ARRAY_MODE = '<STR_LIT>' <EOL> '''<STR_LIT>''' <EOL> __slots__ = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def __init__ ( self , full_name , * args , ** kwargs ) : <EOL> self . _storage_mode = None <EOL> self . _monitor_type = None <EOL> storage_mode = kwargs . pop ( '<STR_LIT>' , BrianMonitorResult . TABLE_MODE ) <EOL> self . v_storage_mode = storage_mode <EOL> super ( BrianMonitorResult , self ) . __init__ ( full_name , * args , ** kwargs ) <EOL> def _store ( self ) : <EOL> store_dict = super ( BrianMonitorResult , self ) . _store ( ) <EOL> if self . _monitor_type is not None : <EOL> store_dict [ '<STR_LIT>' ] = self . _monitor_type <EOL> if self . _monitor_type in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> store_dict [ '<STR_LIT>' ] = self . v_storage_mode <EOL> return store_dict <EOL> def _load ( self , load_dict ) : <EOL> if '<STR_LIT>' in load_dict : <EOL> self . _monitor_type = load_dict . pop ( '<STR_LIT>' ) <EOL> if self . _monitor_type in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> self . _storage_mode = load_dict . pop ( '<STR_LIT>' ) <EOL> super ( BrianMonitorResult , self ) . _load ( load_dict ) <EOL> @ property <EOL> def v_storage_mode ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _storage_mode <EOL> @ property <EOL> def v_monitor_type ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _monitor_type <EOL> @ v_storage_mode . setter <EOL> def v_storage_mode ( self , storage_mode ) : <EOL> if self . _monitor_type is not None : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> assert ( storage_mode == BrianMonitorResult . ARRAY_MODE or <EOL> storage_mode == BrianMonitorResult . TABLE_MODE ) <EOL> self . _storage_mode = storage_mode <EOL> def f_set_single ( self , name , item ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( item , ( Monitor , MultiStateMonitor ) ) : <EOL> if self . v_stored : <EOL> self . _logger . warning ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . _extract_monitor_data ( item ) <EOL> else : <EOL> super ( BrianMonitorResult , self ) . f_set_single ( name , item ) <EOL> def _extract_monitor_data ( self , monitor ) : <EOL> if self . _monitor_type is not None : <EOL> raise TypeError ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . _monitor_type = monitor . __class__ . __name__ <EOL> if isinstance ( monitor , SpikeCounter ) : <EOL> self . _extract_spike_counter ( monitor ) <EOL> elif isinstance ( monitor , VanRossumMetric ) : <EOL> self . _extract_van_rossum_metric ( monitor ) <EOL> elif isinstance ( monitor , PopulationSpikeCounter ) : <EOL> self . _extract_population_spike_counter ( monitor ) <EOL> elif isinstance ( monitor , StateSpikeMonitor ) : <EOL> self . _extract_state_spike_monitor ( monitor ) <EOL> elif isinstance ( monitor , PopulationRateMonitor ) : <EOL> self . _extract_population_rate_monitor ( monitor ) <EOL> elif isinstance ( monitor , ISIHistogramMonitor ) : <EOL> self . _extract_isi_hist_monitor ( monitor ) <EOL> elif isinstance ( monitor , SpikeMonitor ) : <EOL> self . _extract_spike_monitor ( monitor ) <EOL> elif isinstance ( monitor , MultiStateMonitor ) : <EOL> self . _extract_multi_state_monitor ( monitor ) <EOL> elif isinstance ( monitor , StateMonitor ) : <EOL> self . _extract_state_monitor ( monitor ) <EOL> else : <EOL> raise ValueError ( '<STR_LIT>' % str ( type ( monitor ) ) ) <EOL> def _extract_spike_counter ( self , monitor ) : <EOL> self . f_set ( count = monitor . count ) <EOL> self . f_set ( source = str ( monitor . source ) ) <EOL> self . f_set ( delay = monitor . delay ) <EOL> self . f_set ( nspikes = monitor . nspikes ) <EOL> def _extract_van_rossum_metric ( self , monitor ) : <EOL> self . f_set ( source = str ( monitor . source ) ) <EOL> self . f_set ( N = monitor . N ) <EOL> self . f_set ( tau = float ( monitor . tau ) ) <EOL> self . f_set ( tau_unit = '<STR_LIT>' ) <EOL> self . f_set ( distance = monitor . distance ) <EOL> def _extract_isi_hist_monitor ( self , monitor ) : <EOL> self . f_set ( source = str ( monitor . source ) ) <EOL> self . f_set ( count = monitor . count ) <EOL> self . f_set ( bins = monitor . bins ) <EOL> self . f_set ( delay = monitor . delay ) <EOL> self . f_set ( nspikes = monitor . nspikes ) <EOL> @ staticmethod <EOL> def _get_format_string ( monitor ) : <EOL> digits = len ( str ( len ( monitor . source ) ) ) <EOL> format_string = '<STR_LIT>' + str ( digits ) + '<STR_LIT:d>' <EOL> return format_string <EOL> def _extract_state_spike_monitor ( self , monitor ) : <EOL> self . f_set ( source = str ( monitor . source ) ) <EOL> varnames = monitor . _varnames <EOL> if not isinstance ( varnames , tuple ) : <EOL> varnames = ( varnames , ) <EOL> for idx , varname in enumerate ( varnames ) : <EOL> unit = repr ( get_unit_fast ( monitor . spikes [ <NUM_LIT:0> ] [ idx + <NUM_LIT:2> ] ) ) <EOL> self . f_set ( ** { varname + '<STR_LIT>' : unit } ) <EOL> self . f_set ( varnames = varnames ) <EOL> self . f_set ( delay = monitor . delay ) <EOL> self . f_set ( nspikes = monitor . nspikes ) <EOL> self . f_set ( spiketimes_unit = '<STR_LIT>' ) <EOL> if self . _storage_mode == BrianMonitorResult . TABLE_MODE : <EOL> spike_dict = { } <EOL> if len ( monitor . spikes ) > <NUM_LIT:0> : <EOL> zip_lists = list ( zip ( * monitor . spikes ) ) <EOL> time_list = zip_lists [ <NUM_LIT:1> ] <EOL> nounit_list = [ np . float64 ( time ) for time in time_list ] <EOL> spike_dict [ '<STR_LIT>' ] = nounit_list <EOL> spike_dict [ '<STR_LIT>' ] = list ( zip_lists [ <NUM_LIT:0> ] ) <EOL> spiked_neurons = sorted ( list ( set ( spike_dict [ '<STR_LIT>' ] ) ) ) <EOL> if spiked_neurons : <EOL> self . f_set ( neurons_with_spikes = spiked_neurons ) <EOL> count = <NUM_LIT:2> <EOL> for varname in varnames : <EOL> var_list = list ( zip_lists [ count ] ) <EOL> nounit_list = [ np . float64 ( var ) for var in var_list ] <EOL> spike_dict [ varname ] = nounit_list <EOL> count += <NUM_LIT:1> <EOL> self . f_set ( spikes = pd . DataFrame ( data = spike_dict ) ) <EOL> elif self . _storage_mode == BrianMonitorResult . ARRAY_MODE : <EOL> format_string = self . _get_format_string ( monitor ) <EOL> self . f_set ( format_string = format_string ) <EOL> spiked_neurons = set ( ) <EOL> for neuron in range ( len ( monitor . source ) ) : <EOL> spikes = monitor . times ( neuron ) <EOL> if len ( spikes ) > <NUM_LIT:0> : <EOL> spiked_neurons . add ( neuron ) <EOL> key = '<STR_LIT>' + format_string % neuron <EOL> self . f_set ( ** { key : spikes } ) <EOL> spiked_neurons = sorted ( list ( spiked_neurons ) ) <EOL> if spiked_neurons : <EOL> self . f_set ( neurons_with_spikes = spiked_neurons ) <EOL> for varname in varnames : <EOL> for neuron in range ( len ( monitor . source ) ) : <EOL> values = monitor . values ( varname , neuron ) <EOL> if len ( values ) > <NUM_LIT:0> : <EOL> key = varname + '<STR_LIT:_>' + format_string % neuron <EOL> self . f_set ( ** { key : values } ) <EOL> else : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> def _extract_spike_monitor ( self , monitor ) : <EOL> self . f_set ( source = str ( monitor . source ) ) <EOL> self . f_set ( record = monitor . record ) <EOL> self . f_set ( nspikes = monitor . nspikes ) <EOL> self . f_set ( spiketimes_unit = '<STR_LIT>' ) <EOL> self . f_set ( delay = monitor . delay ) <EOL> if self . _storage_mode == BrianMonitorResult . TABLE_MODE : <EOL> spike_dict = { } <EOL> if len ( monitor . spikes ) > <NUM_LIT:0> : <EOL> zip_lists = list ( zip ( * monitor . spikes ) ) <EOL> time_list = zip_lists [ <NUM_LIT:1> ] <EOL> nounit_list = [ np . float64 ( time ) for time in time_list ] <EOL> spike_dict [ '<STR_LIT>' ] = nounit_list <EOL> spike_dict [ '<STR_LIT>' ] = list ( zip_lists [ <NUM_LIT:0> ] ) <EOL> spiked_neurons = sorted ( list ( set ( spike_dict [ '<STR_LIT>' ] ) ) ) <EOL> if spiked_neurons : <EOL> self . f_set ( neurons_with_spikes = spiked_neurons ) <EOL> spikeframe = pd . DataFrame ( data = spike_dict ) <EOL> self . f_set ( spikes = spikeframe ) <EOL> elif self . _storage_mode == BrianMonitorResult . ARRAY_MODE : <EOL> format_string = self . _get_format_string ( monitor ) <EOL> self . f_set ( format_string = format_string ) <EOL> spiked_neurons = set ( ) <EOL> for neuron , spikes in monitor . spiketimes . items ( ) : <EOL> if len ( spikes ) > <NUM_LIT:0> : <EOL> spiked_neurons . add ( neuron ) <EOL> key = '<STR_LIT>' + format_string % neuron <EOL> self . f_set ( ** { key : spikes } ) <EOL> spiked_neurons = sorted ( list ( spiked_neurons ) ) <EOL> if spiked_neurons : <EOL> self . f_set ( neurons_with_spikes = spiked_neurons ) <EOL> else : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> def _extract_population_rate_monitor ( self , monitor ) : <EOL> assert isinstance ( monitor , PopulationRateMonitor ) <EOL> self . f_set ( source = str ( monitor . source ) ) <EOL> self . f_set ( times_unit = '<STR_LIT>' , rate_unit = '<STR_LIT>' ) <EOL> self . f_set ( times = monitor . times ) <EOL> self . f_set ( rate = monitor . rate ) <EOL> self . f_set ( delay = monitor . delay ) <EOL> self . f_set ( bin = monitor . _bin ) <EOL> def _extract_population_spike_counter ( self , monitor ) : <EOL> assert isinstance ( monitor , PopulationSpikeCounter ) <EOL> self . f_set ( nspikes = monitor . nspikes ) <EOL> self . f_set ( source = str ( monitor . source ) ) <EOL> self . f_set ( delay = monitor . delay ) <EOL> def _extract_multi_state_monitor ( self , monitors ) : <EOL> self . f_set ( vars_ = monitors . vars ) <EOL> if len ( monitors . times ) > <NUM_LIT:0> : <EOL> self . f_set ( times = monitors . times ) <EOL> self . f_set ( times_unit = '<STR_LIT>' ) <EOL> for idx , varname in enumerate ( monitors . vars ) : <EOL> monitor = monitors . monitors [ varname ] <EOL> if idx == <NUM_LIT:0> : <EOL> self . f_set ( record = monitor . record ) <EOL> self . f_set ( when = monitor . when ) <EOL> self . f_set ( timestep = monitor . timestep ) <EOL> self . f_set ( source = str ( monitor . P ) ) <EOL> if np . mean ( monitor . mean ) != <NUM_LIT:0.0> : <EOL> self . f_set ( ** { varname + '<STR_LIT>' : monitor . mean } ) <EOL> self . f_set ( ** { varname + '<STR_LIT>' : monitor . var } ) <EOL> if len ( monitors . times ) > <NUM_LIT:0> : <EOL> self . f_set ( ** { varname + '<STR_LIT>' : monitor . values } ) <EOL> self . f_set ( ** { varname + '<STR_LIT>' : repr ( monitor . unit ) } ) <EOL> def _extract_state_monitor ( self , monitor ) : <EOL> self . f_set ( varname = monitor . varname ) <EOL> self . f_set ( unit = repr ( monitor . unit ) ) <EOL> self . f_set ( record = monitor . record ) <EOL> self . f_set ( when = monitor . when ) <EOL> self . f_set ( timestep = monitor . timestep ) <EOL> self . f_set ( source = str ( monitor . P ) ) <EOL> self . f_set ( times_unit = '<STR_LIT>' ) <EOL> if np . mean ( monitor . mean ) != <NUM_LIT:0.0> : <EOL> self . f_set ( mean = monitor . mean ) <EOL> self . f_set ( var = monitor . var ) <EOL> if len ( monitor . times ) > <NUM_LIT:0> : <EOL> self . f_set ( times = monitor . times ) <EOL> self . f_set ( values = monitor . values ) </s>
