예제 #1
0
def bct_description(mat_file_name):
    return extract_matlab_doc_string(os.path.join(BCT_PATH, mat_file_name))
예제 #2
0
def bct_description(mat_file_name):
    return extract_matlab_doc_string(os.path.join(BCT_PATH, mat_file_name))
예제 #3
0
 def __store_algorithms_for_group(self, group, adapter, has_sub_algorithms):
     """
     For the group passed as parameter do the following:
     If it has sub-algorithms, get the list of them, add sub-algorithm 
     references into the DB with all the required fields.
     If it is not a GroupAdapter add a single algorithm into the DB with an
     empty identifier.
     """
     if has_sub_algorithms:
         algos = adapter.get_algorithms_dictionary()
         for algo_ident in algos:
             in_params = adapter.get_input_for_algorithm(algo_ident)
             req_type, param_name, flt = self.__get_required_input(
                 in_params)
             outputs = adapter.get_output_for_algorithm(algo_ident)
             algo_description = ""
             if self.__is_matlab_parent(adapter.__class__):
                 root_folder = adapter.get_matlab_file_root()
                 file_name = adapter.get_matlab_file(algo_ident)
                 if file_name:
                     algo_description = extract_matlab_doc_string(
                         os.path.join(root_folder, file_name))
             algorithm = dao.get_algorithm_by_group(group.id, algo_ident)
             if algorithm is None:
                 #Create new
                 algorithm = model.Algorithm(group.id,
                                             algo_ident,
                                             algos[algo_ident][ATT_NAME],
                                             req_type,
                                             param_name,
                                             str(outputs),
                                             flt,
                                             description=algo_description)
             else:
                 #Edit previous
                 algorithm.name = algos[algo_ident][ATT_NAME]
                 algorithm.required_datatype = req_type
                 algorithm.parameter_name = param_name
                 algorithm.outputlist = str(outputs)
                 algorithm.datatype_filter = flt
                 algorithm.description = algo_description
             dao.store_entity(algorithm)
     else:
         input_tree = adapter.get_input_tree()
         req_type, param_name, flt = self.__get_required_input(input_tree)
         outputs = str(adapter.get_output())
         algorithm = dao.get_algorithm_by_group(group.id, None)
         if hasattr(adapter, '_ui_name'):
             algo_name = adapter._ui_name
         else:
             algo_name = adapter.__class__.__name__
         if algorithm is None:
             #Create new
             algorithm = model.Algorithm(group.id, None, algo_name,
                                         req_type, param_name, outputs, flt)
         else:
             #Edit previous
             algorithm.name = algo_name
             algorithm.required_datatype = req_type
             algorithm.parameter_name = param_name
             algorithm.outputlist = str(outputs)
             algorithm.datatype_filter = flt
         dao.store_entity(algorithm)