-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWROCTestingApp.py
More file actions
70 lines (57 loc) · 1.85 KB
/
WROCTestingApp.py
File metadata and controls
70 lines (57 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from WROCTesting import *
from SimulationManager import *
from spyre import server
SimManager = SimulationManager()
class WROCTestingApp(server.App):
title = 'ROC W Testing'
inputs = [
dict(
type = 'dropdown',
label = 'Non-neutral tree generator',
options = [
{"label": "Neutral Tree", "value":"NeutralTreeGenerator(Parameters(birth_rate=1, death_rate=0))", "checked":True},
{"label":"Explosive Radiation", "value":"NonNeutralTreeGenerator(Parameters(rf = ExplosiveRadiationRateFunc(Parameters(timeDelay=0.1, basalRate=2, lowRate=0.05))))"},
{"label":"Trait Evolution Linear Brownian", "value":"NonNeutralTreeGenerator(Parameters(rf=TraitEvolLinearBrownian(Parameters(basalRate=1, sigma=0.8, lowestRate=0.01))))"}
],
key = 'treeGenerator'),
dict(
type='text',
key='nbTrees',
label='Number of trees',
value='10'),
dict(
type='text',
key='treeSize',
label='Tree size',
value='20')
]
outputs = [
dict(
type='plot',
id='ROCPlot',
control_id='goButton',
action_id='computeVals')
]
controls = [dict(type='button',
id='goButton',
label='Compute!')]
def GetParams(self, params):
params = Parameters(
nb_tree = int(params['nbTrees']),
tree_size = int(params['treeSize']),
treeGenerator = eval(params['treeGenerator']))
return params
def ROCPlot(self, params):
params = self.GetParams(params)
neutTreeGen = NeutralTreeGenerator(Parameters(birth_rate=1, death_rate=0))
allRes = Results()
allRes.nonneutral = SimManager.GetSimulationResult(WROCTestingSimRunner(params))
SimManager.SaveSimulations()
params.SetParam('treeGenerator', neutTreeGen)
allRes.neutral = SimManager.GetSimulationResult(WROCTestingSimRunner(params))
SimManager.SaveSimulations()
rp = WROCPlotter(allRes)
ax = rp.Plot()
return ax
app = WROCTestingApp()
app.launch()