Commit f5389ecf authored by vpodpecan's avatar vpodpecan

merge with latest MUSE widget changes

Merge branch 'dev' of source.ijs.si:kt/mothra into dev
parents 3990fb64 17f26dc0
......@@ -182,3 +182,40 @@ def base_extract_results(input_dict):
output_dict = {}
output_dict['results']=results
return output_dict
def base_unzip_list(input_dict):
'''
Unzips a list of tuples for the given index.
Example inputs:
index = 0
input_list = [(a, 1), (b, 2), (c, 3)]
result: [a, b, c]
or
index = 1
input_list = [(a, 1), (b, 2), (c, 3)]
result: [1, 2, 3]
'''
idx = int(input_dict.get('index', 0))
input_list = input_dict['input_list']
unzipped_list = [el[idx] for el in input_list]
return {'unzipped_list': unzipped_list}
def base_average_list(input_dict):
'''
Computes the average of the given input list.
'''
input_list = input_dict['input_list']
if input_list:
average = sum(input_list)/float(len(input_list))
else:
average = None
return {'average': average}
[
{
"model": "workflows.abstractwidget",
"fields": {
"category": "01ad639d-acb8-45c0-bc5e-bc8739bb4c95",
"treeview_image": "",
"uid": "5e9c83ea-9a53-4f16-bb69-d1bf66140f78",
"windows_queue": false,
"package": "base",
"interaction_view": "",
"has_progress_bar": false,
"image": "",
"description": "Unzips a list of tuples for the given index.\r\n\r\n Example inputs:\r\n\r\n index = 0\r\n input_list = [(a, 1), (b, 2), (c, 3)]\r\n\r\n result: [a, b, c]\r\n\r\n or\r\n\r\n index = 1\r\n input_list = [(a, 1), (b, 2), (c, 3)]\r\n\r\n result: [1, 2, 3]",
"static_image": "",
"action": "base_unzip_list",
"visualization_view": "",
"streaming_visualization_view": "",
"post_interact_action": "",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"is_streaming": false,
"order": 1,
"name": "Unzip list"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "5e9c83ea-9a53-4f16-bb69-d1bf66140f78",
"name": "List",
"short_name": "lst",
"default": "",
"description": "Input list",
"required": true,
"multi": false,
"parameter_type": null,
"variable": "input_list",
"parameter": false,
"order": 1,
"uid": "40170147-20b9-4cb1-9c57-5d6b6fbde603"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "5e9c83ea-9a53-4f16-bb69-d1bf66140f78",
"name": "Index",
"short_name": "idx",
"default": "0",
"description": "Tuple index to unzip",
"required": false,
"multi": false,
"parameter_type": "text",
"variable": "index",
"parameter": true,
"order": 2,
"uid": "e01147cc-2c37-4155-85ce-d1f22a515de8"
}
},
{
"model": "workflows.abstractoutput",
"fields": {
"widget": "5e9c83ea-9a53-4f16-bb69-d1bf66140f78",
"name": "List",
"short_name": "lst",
"description": "Output list",
"variable": "unzipped_list",
"order": 1,
"uid": "af772a1c-6b82-4873-b385-63ab315bb13e"
}
}
]
\ No newline at end of file
[
{
"model": "workflows.abstractwidget",
"fields": {
"category": "01ad639d-acb8-45c0-bc5e-bc8739bb4c95",
"treeview_image": "",
"uid": "d7f6848d-c01b-429a-88ba-c90741096d10",
"windows_queue": false,
"package": "base",
"interaction_view": "",
"has_progress_bar": false,
"image": "",
"description": "Computes the average of the given input list.",
"static_image": "",
"action": "base_average_list",
"visualization_view": "",
"streaming_visualization_view": "",
"post_interact_action": "",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"is_streaming": false,
"order": 1,
"name": "List average"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "d7f6848d-c01b-429a-88ba-c90741096d10",
"name": "List",
"short_name": "lst",
"default": "",
"description": "Input list",
"required": true,
"multi": false,
"parameter_type": null,
"variable": "input_list",
"parameter": false,
"order": 1,
"uid": "863c108e-5908-446b-84e9-31478e36dea7"
}
},
{
"model": "workflows.abstractoutput",
"fields": {
"widget": "d7f6848d-c01b-429a-88ba-c90741096d10",
"name": "Average",
"short_name": "avg",
"description": "Average value",
"variable": "average",
"order": 1,
"uid": "4cb1845d-17d9-4f0a-af27-5a64869d9881"
}
}
]
\ No newline at end of file
This diff is collapsed.
......@@ -10,7 +10,7 @@ try:
from SubgroupDiscovery.SDRule import SDRules
import Orange
except:
print logging.warning('Could not import subgroup discovery orange package.')
logging.warning('Could not import subgroup discovery orange package.')
class SubgroupDiscovery:
# Available algorithms and their parameters
......
......@@ -56,4 +56,5 @@ class WidgetEngineTest(TestCase):
o = wid.outputs.all()[0].value
self.assertEqual(o,[[[[u'2'], [u'1']], [u'3'], 1],
[[[u'3'], [u'1']], [u'2'], 1],
[[[u'3'], [u'2']], [u'1'], 1]])
\ No newline at end of file
[[[u'3'], [u'2']], [u'1'], 1]])
......@@ -562,17 +562,6 @@ def add_cv(request):
output.outer_input = input
output.save()
# input: number of folds
cv_input_fold = Widget()
cv_input_fold.workflow = workflow
cv_input_fold.x=int(request.POST['scrollLeft'])+50
y=int(request.POST['scrollTop'])+50
while workflow.widgets.filter(y=y,x=cv_input_fold.x).count()>0:
y = y + 100
cv_input_fold.y=y
cv_input_fold.name = 'cv input2'
cv_input_fold.type = 'cv_input2'
cv_input_fold.save()
output = Output()
output.name = 'cv input data'
......@@ -590,18 +579,6 @@ def add_cv(request):
output.outer_input = input
output.save()
# input: seed
cv_input_fold = Widget()
cv_input_fold.workflow = workflow
cv_input_fold.x=int(request.POST['scrollLeft'])+50
y=int(request.POST['scrollTop'])+50
while workflow.widgets.filter(y=y,x=cv_input_fold.x).count()>0:
y = y + 100
cv_input_fold.y=y
cv_input_fold.name = 'cv input3'
cv_input_fold.type = 'cv_input3'
cv_input_fold.save()
output = Output()
output.name = 'cv input data'
output.short_name = 'sed' # subproces inner input
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment