Skip to content

Commit

Permalink
hotfix, to support modal tools,
Browse files Browse the repository at this point in the history
  • Loading branch information
denphi committed May 30, 2019
1 parent 790e7e1 commit e4ec987
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion nanohubtools/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
# Daniel Mejia (denphi), Purdue University (denphi@denphi.com)


version_info = (0, 1, 9)
version_info = (0, 1, 10)
__version__ = ".".join(map(str, version_info))

1 change: 1 addition & 0 deletions nanohubtools/pntoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, credentials, **kwargs):
self.parameters_additional = [
]
parameters = self.parameters_structure + self.parameters_materials + self.parameters_ambient + self.parameters_additional
kwargs.setdefault('title', 'P-N junction')
Rappturetool.__init__(self, credentials, "pntoy", parameters, extract_method="id", **kwargs)


Expand Down
9 changes: 8 additions & 1 deletion nanohubtools/qdottools.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def __init__(self, credentials, parameters, **kwargs):
self.tool = "qdot"
Rappturetool.__init__(self, credentials, self.tool, parameters, **kwargs)

def displayExperiment(self, experiment, disable=[]):
Rappturetool.displayExperiment(self, experiment, disable+["sequences"])

class SimpleQuantumDot (Qdotexplorer):
def __init__(self, credentials, **kwargs):
self.parameters_structure = [
Expand Down Expand Up @@ -90,6 +93,7 @@ def __init__(self, credentials, **kwargs):
'npts'
]
parameters = self.parameters_structure + self.parameters_optical
kwargs.setdefault('title', 'Simple Quantum-dot lab')
Qdotexplorer.__init__(self, credentials, parameters, extract_method="id", **kwargs)


Expand Down Expand Up @@ -196,6 +200,7 @@ def __init__(self, credentials, **kwargs):
'structchoice'
]
parameters = self.parameters_structure + self.parameters_optical + self.parameters_layer + self.parameters_additional
kwargs.setdefault('title', 'Stacked Quantumdot lab')
Qdotexplorer.__init__(self, credentials, parameters, extract_method="id", **kwargs)
self.options[self.parameters_additional[0]] = ui.String(name='Quantum Dot Structure', value='Multi-Layer Quantum Dot', description='Quantum Dot Structure')

Expand Down Expand Up @@ -275,4 +280,6 @@ def displayOptions(self):
sqdottab.set_title(2, "Layers")
sqdottab.set_title(1, "Structure")

self.options_cont.children = [sqdottab]
self.options_cont.children = [sqdottab]


37 changes: 15 additions & 22 deletions nanohubtools/rappturetool.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def loadExperiment(self, session_id):
self.displayExperiment(experiment)


def displayExperiment(self, experiment):
def displayExperiment(self, experiment, disable=[]):

params_b = []

Expand Down Expand Up @@ -229,20 +229,10 @@ def displayExperiment(self, experiment):
if g.text in groups:
groups[g.text].append(el)
else:
groups[g.text] = [el]










groups[g.text] = [el]

out_curves.children = oc_children
if len(oc_children) > 0:
if len(oc_children) > 0 and "curves" not in disable:
acc_item = acc_item+1
acc_children.append(out_curves)
acc_titles.append('Curves')
Expand All @@ -256,7 +246,7 @@ def displayExperiment(self, experiment):
but.on_click(lambda a, b=self, c=g,d=experiment['modal'] : Rappturetool.plotXY(b,c,d))
op_children.append(but)
out_plots.children = op_children
if len(op_children) > 0:
if len(op_children) > 0 and "plots" not in disable:
acc_item = acc_item+1
acc_children.append(out_plots)
acc_titles.append('Plots')
Expand All @@ -274,7 +264,7 @@ def displayExperiment(self, experiment):
but.on_click(lambda a, b=self, c=sequences[i],d=experiment['modal'] : Rappturetool.plotSequence(b,c,d))
os_children.append(but)
out_sequences.children = os_children
if len(os_children) > 0:
if len(os_children) > 0 and "sequences" not in disable:
acc_item = acc_item+1
acc_children.append(out_sequences)
acc_titles.append('Sequences')
Expand All @@ -291,7 +281,7 @@ def displayExperiment(self, experiment):
but.on_click(lambda a, b=self, c=tables[i],d=experiment['modal'] : Rappturetool.plotTable(b,c,d))
ot_children.append(but)
out_tables.children = ot_children
if len(ot_children) > 0:
if len(ot_children) > 0 and "tables" not in disable:
acc_item = acc_item+1
acc_children.append(out_tables)
acc_titles.append('Tables')
Expand All @@ -314,7 +304,7 @@ def displayExperiment(self, experiment):
but.on_click(lambda a, b=self, c=v, d=component, e=experiment['modal'] : Rappturetool.plotVTK(b,c,d,e))
ov_children.append(but)
out_volumes.children = ov_children
if len(ov_children) > 0:
if len(ov_children) > 0 and "volumes" not in disable:
acc_item = acc_item+1
acc_children.append(out_volumes)
acc_titles.append('Volumes')
Expand All @@ -337,7 +327,7 @@ def displayExperiment(self, experiment):
but.on_click(lambda a, b=self, c=el.find('current'),d=experiment['modal'] : Rappturetool.plotLog(b,c,d))
ol_children.append(but)
out_logs.children = ol_children
if len(ol_children) > 0:
if len(ol_children) > 0 and "logs" not in disable:
acc_item = acc_item+1
acc_children.append(out_logs)
acc_titles.append('Logs')
Expand Down Expand Up @@ -608,7 +598,7 @@ def plotSequence(self, sequence, out, labels=None):
if(len(groups)>0):
index = self.getText(seq, ["index"])
options.append(index)
tr, lay = self.buiildXYPlotly(groups[list(groups.keys())[0]])
tr, lay = self.buildXYPlotly(groups[list(groups.keys())[0]])
if len(traces) == 0:
layout = lay
traces = tr
Expand All @@ -628,19 +618,22 @@ def plotSequence(self, sequence, out, labels=None):


if out == None:
out = Floatview(title=title, mode = 'split-bottom')
out = Floatview(title=label, mode = 'split-bottom')
out.clear_output()
with out:
display(container)
return fig

def plotXY(self, fields, out, labels=None):
traces, layout = self.buiildXYPlotly(fields, labels)
traces, layout = self.buildXYPlotly(fields, labels)
fig = FigureWidget({
'data': traces,
'layout': layout
})
if out == None:
title = ""
for field in (fields):
title = self.getText(field, ["about","group"])
out = Floatview(title=title, mode = 'split-bottom')
out.clear_output()
but = Button(description="Compare Data", icon='check', disable=False, layout=layout)
Expand All @@ -650,7 +643,7 @@ def plotXY(self, fields, out, labels=None):
display(but)
return fig

def buiildXYPlotly(self, fields, labels=None):
def buildXYPlotly(self, fields, labels=None):
traces = []
for i, field in enumerate(fields):
component = self.getXY(field, 'component')
Expand Down
1 change: 1 addition & 0 deletions nanohubtools/semi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, credentials, **kwargs):
self.parameters_additional = [
]
parameters = self.parameters_structure + self.parameters_materials + self.parameters_ambient + self.parameters_additional
kwargs.setdefault('title', 'Drift diffusion lab')
Rappturetool.__init__(self, credentials, "semi", parameters, extract_method="id", **kwargs)


Expand Down

0 comments on commit e4ec987

Please sign in to comment.