def calculate(self,funcs): ## always count the data funcs = [{'function':len,'name':'count'}] + funcs ## check the function definition dictionary for common problems check_function_dictionary(funcs) ## convert the time vector for faster referencing time_conv = [[getattr(time,grp) for grp in self.time_grouping] for time in self.sub.timevec] ## the shared list all_attrs = Manager().list() if self.procs > 1: processes = [Process(target=self.f_calculate, args=(all_attrs, self.sub, groups, funcs, time_conv, self.time_grouping, self.grouping)) for groups in self.groups] self.run_parallel(processes) else: self.f_calculate(all_attrs,self.sub,self.groups[0],funcs,time_conv,self.time_grouping,self.grouping) return(all_attrs)
def calculate(self,funcs): ## always count the data base_funcs = [{'function':len,'name':'count_agg','raw':False}] ## check if there are raw calculation functions if any([f['raw'] for f in funcs]): has_raw = True if self.sub.value_set == {}: raise(ValueError('Raw aggregate statistics requested with no "value_set_coll"!!')) else: has_raw = False ## need to count the raw data values if raw value are present if has_raw: base_funcs.append({'function':len,'name':'count_raw','raw':True}) ## append the rest of the functions funcs = base_funcs + funcs ## check the function definition dictionary for common problems check_function_dictionary(funcs) ## convert the time vector for faster referencing time_conv = [[getattr(time,grp) for grp in self.time_grouping] for time in self.sub.timevec] ## the shared list all_attrs = Manager().list() if self.procs > 1: processes = [Process(target=self.f_calculate, args=(all_attrs, self.sub, groups, funcs, time_conv, self.time_grouping, self.grouping, has_raw)) for groups in self.groups] pmanager = ProcessManager(processes,self.procs) pmanager.run() else: self.f_calculate(all_attrs, self.sub, self.groups[0], funcs, time_conv, self.time_grouping, self.grouping, has_raw) self.stats = merge_dict_list(list(all_attrs))
def calculate(self, funcs): ## always count the data base_funcs = [{'function': len, 'name': 'count_agg', 'raw': False}] ## check if there are raw calculation functions if any([f['raw'] for f in funcs]): has_raw = True if self.sub.value_set == {}: raise (ValueError( 'Raw aggregate statistics requested with no "value_set_coll"!!' )) else: has_raw = False ## need to count the raw data values if raw value are present if has_raw: base_funcs.append({ 'function': len, 'name': 'count_raw', 'raw': True }) ## append the rest of the functions funcs = base_funcs + funcs ## check the function definition dictionary for common problems check_function_dictionary(funcs) ## convert the time vector for faster referencing time_conv = [[getattr(time, grp) for grp in self.time_grouping] for time in self.sub.timevec] ## the shared list all_attrs = Manager().list() if self.procs > 1: processes = [ Process(target=self.f_calculate, args=(all_attrs, self.sub, groups, funcs, time_conv, self.time_grouping, self.grouping, has_raw)) for groups in self.groups ] pmanager = ProcessManager(processes, self.procs) pmanager.run() else: self.f_calculate(all_attrs, self.sub, self.groups[0], funcs, time_conv, self.time_grouping, self.grouping, has_raw) self.stats = merge_dict_list(list(all_attrs))
def calculate(self, funcs): ## always count the data funcs = [{'function': len, 'name': 'count'}] + funcs ## check the function definition dictionary for common problems check_function_dictionary(funcs) ## convert the time vector for faster referencing time_conv = [[getattr(time, grp) for grp in self.time_grouping] for time in self.sub.timevec] ## the shared list all_attrs = Manager().list() if self.procs > 1: processes = [ Process(target=self.f_calculate, args=(all_attrs, self.sub, groups, funcs, time_conv, self.time_grouping, self.grouping)) for groups in self.groups ] self.run_parallel(processes) else: self.f_calculate(all_attrs, self.sub, self.groups[0], funcs, time_conv, self.time_grouping, self.grouping) return (all_attrs)
def _get_(self): stat = OcgStatFunction() function_list = stat.get_function_list(self.url_arg[0].split(' ')) check_function_dictionary(function_list) return(function_list)
def _get_(self): stat = OcgStatFunction() function_list = stat.get_function_list(self.url_arg[0].split(' ')) check_function_dictionary(function_list) return (function_list)