本文整理汇总了Python中visualizer.Visualizer类的典型用法代码示例。如果您正苦于以下问题:Python Visualizer类的具体用法?Python Visualizer怎么用?Python Visualizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Visualizer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, args):
Visualizer.__init__(self, args)
self.inner_margin_width = int(self.width * INNER_MARGIN)
self.safe_width = self.width - self.inner_margin_width * 2
self.files = {}
self._smoothed_min_filenum = Smoother()
self._smoothed_max_filenum = Smoother()
开发者ID:alex-berman,项目名称:tforms,代码行数:7,代码来源:peers_lines.py
示例2: debugTestMain
def debugTestMain(folderpath, dirname):
logging.info(" setting config...")
config = SeleniumConfiguration(Browser.FireFox, "http://140.112.42.145:2000/demo/nothing/main.html")
config.set_max_depth(1)
config.set_max_length(5)
config.set_trace_amount(1)
config.set_max_states(100)
config.set_folderpath(folderpath)
config.set_dirname(dirname)
config.set_automata_fname('automata.json')
config.set_traces_fname('traces.json')
config.set_frame_tags(['iframe'])
config.set_dom_inside_iframe(True)
config.set_simple_clickable_tags()
config.set_simple_inputs_tags()
config.set_simple_normalizers()
logging.info(" setting executor...")
executor = SeleniumExecutor(config.get_browserID(), config.get_url())
logging.info(" setting crawler...")
automata = Automata(config)
databank = InlineDataBank("140.112.42.145:2000", "jeff", "zj4bj3jo37788", "test")
algorithm = MonkeyCrawler() #DFScrawler()
crawler = SeleniumCrawler(config, executor, automata, databank, algorithm)
logging.info(" crawler start run...")
crawler.run_algorithm()
logging.info(" end! save automata...")
algorithm.save_traces()
automata.save_automata(config.get_automata_fname())
Visualizer.generate_html('web', os.path.join(config.get_path('root'), config.get_automata_fname()))
config.save_config('config.json')
开发者ID:djason294,项目名称:WebTraceCollector,代码行数:34,代码来源:controller.py
示例3: __init__
def __init__(self, args):
Visualizer.__init__(self, args)
self.safe_width = int(self.width * (1 - APPEND_MARGIN - PREPEND_MARGIN))
self.prepend_margin_width = int(self.width * PREPEND_MARGIN)
self.files = {}
self._smoothed_min_filenum = Smoother()
self._smoothed_max_filenum = Smoother()
开发者ID:alex-berman,项目名称:tforms,代码行数:7,代码来源:puzzle.py
示例4: main
def main(m=5, r=2, window_size=20, batch_size=2):
gen = SimpleGenerator(num=m)
bed = TestBed(m=m, r=r, window_size=window_size, batch_size=batch_size)
vis = Visualizer()
for i in xrange(10):
bed.supply(gen.next())
for i,y in enumerate(gen):
if i % window_size == 0:
# pretrain
avg_cost = bed.pretrain(10, pretraining_lr=0.1)
print(" pretrain cost: {}".format(avg_cost))
# predict
y_pred = bed.predict()
print("{}: y={}, y_pred={}".format(i, y, y_pred))
vis.append(y, y_pred)
# finetune
bed.supply(y)
avg_cost = bed.finetune(10, finetunning_lr=0.1)
# bed.finetune(100, finetunning_lr=0.01)
# bed.finetune(100, finetunning_lr=0.001)
print(" train cost: {}".format(avg_cost))
time.sleep(.1)
开发者ID:itolab-hayashi-rafik,项目名称:weather,代码行数:26,代码来源:test_bed.py
示例5: SeleniumMain
def SeleniumMain(web_submit_id, folderpath=None, dirname=None):
logging.info(" connect to mysql")
print("connect to sql")
databank = MysqlDataBank("localhost", "root", "", "test")
url, deep, time = databank.get_websubmit(web_submit_id)
logging.info(" setting config...")
print(" setting config...")
config = SeleniumConfiguration(Browser.PhantomJS, url, folderpath, dirname)
config.set_max_depth(deep)
config.set_max_time(int(time)*60)
config.set_simple_clickable_tags()
config.set_simple_inputs_tags()
config.set_simple_normalizers()
config.set_frame_tags(['iframe'])
logging.info(" setting executor...")
executor = SeleniumExecutor(config.get_browserID(), config.get_url())
logging.info(" setting crawler...")
automata = Automata()
crawler = SeleniumCrawler(config, executor, automata, databank)
logging.info(" crawler start run...")
automata = crawler.run()
crawler.close()
logging.info(" end! save automata...")
automata.save_automata(config)
automata.save_traces(config)
Visualizer.generate_html('web', os.path.join(config.get_path('root'), config.get_automata_fname()))
config.save_config('config.json')
开发者ID:djason294,项目名称:WebTraceCollector,代码行数:33,代码来源:controller.py
示例6: run_algorithm
def run_algorithm(self):
# repeat for trace_amount times
for i in range( self.configuration.get_trace_amount() ):
self.initial()
while self.action_events:
#check time
if (time.time() - self.time_start) > self.configuration.get_max_time():
logging.info("|||| TIMO OUT |||| end crawl ")
break
string = ''.join([ str(action['action']['clickable'].get_id())+str(action['depth'])+str(action['state'].get_id()) for action in self.action_events ])
logging.info(' action_events : '+string )
state, action, depth = self.get_next_action()
self.change_state(state, action, depth)
edge = self.trigger_action(state, action, depth)
self.update_states(state, edge, action, depth)
self.close()
self.algorithm.save_traces()
self.automata.save_automata(self.configuration.get_automata_fname())
Visualizer.generate_html('web', os.path.join(self.configuration.get_path('root'), self.configuration.get_automata_fname()))
return self.automata
开发者ID:louisalflame,项目名称:WebTraceCollector,代码行数:27,代码来源:crawler.py
示例7: test_generate_report
def test_generate_report(self):
num_clickables = {
'unexamined': 5,
'true': 10,
'false': 30
}
form1 = FormField('form1')
form1.add_input(InputField('username', '//*[@id="username"]', 'castman'))
form1.add_input(InputField('password', '', '[email protected]'))
form_list = [{
'state': 1,
'form': form1,
'execution_seq': [Clickable('exe1', '//html/body/button[1]'), Clickable('exe2', '//html/body/button[1]')],
'clickable': [Clickable('btn1', '//html/body/button[1]'), Clickable('btn2', '//html/body/button[1]')]
}]
inv_violation = [{
'state': 2,
'name': '{"name": "file-not-found"}',
'sequence': [Clickable('inv-btn1', '//html/body/button[1]'), Clickable('inv-btn2', '//html/body/button[1]')]
}]
Visualizer.generate_report(
'web',
'trace/example-app-4-webide',
'automata.json',
3, num_clickables, form_list, inv_violation, 9.987
)
开发者ID:behappycc,项目名称:b2g-monkey,代码行数:26,代码来源:test.py
示例8: CBTestMain
def CBTestMain(folderpath, dirname,web_submit_id):
logging.info(" Type: Cross Browser Testing")
logging.info(" connect to mysql")
print("")
print("connect to sql")
databank = MysqlDataBank("localhost", "root", "", "test")
url, deep, time, b1, b2 = databank.get_websubmit(int(web_submit_id))
basic_browserID = str(b1)
other_browserID = str(b2)
depth = int(deep)
logging.info(" A new CBT begings...")
logging.info(" setting config...")
config = SeleniumConfiguration(int(basic_browserID),int(other_browserID), url)
# max 3
config.set_max_depth(int(depth))
# max 3
config.set_max_length(int(depth))
# should be 1
config.set_trace_amount(1)
# should be 100 no use?
config.set_max_states(5)
config.set_folderpath(folderpath)
config.set_dirname(dirname)
config.set_automata_fname('automata.json')
config.set_traces_fname('traces.json')
#config.set_frame_tags(['iframe'])
config.set_dom_inside_iframe(True)
config.set_simple_clickable_tags()
config.set_simple_inputs_tags()
config.set_simple_normalizers()
logging.info(" setting executor...")
#nothing here
executor = CBTExecutor(config.get_browserID(), config.get_url())
logging.info(" setting crawler...")
automata = Automata(config)
#databank = InlineDataBank("140.112.42.145:2000", "jeff", "zj4bj3jo37788", "test")
databank = InlineDataBank("localhost", "B00901138", "R124249166", "test")
print('start Cross Browser Testing...')
#acually it's CBT algorithm
algorithm = CBTCrawler(int(other_browserID),url)
crawler = SeleniumCrawler(config, executor, automata, databank, algorithm)
logging.info(" crawler start runing...")
crawler.run_algorithm()
print(" end! save automata...")
logging.info(" end! save automata...")
algorithm.save_traces()
automata.save_automata(config.get_automata_fname())
Visualizer.generate_html('web', os.path.join(config.get_path('root'), config.get_automata_fname()))
config.save_config('config.json')
开发者ID:djason294,项目名称:WebTraceCollector,代码行数:56,代码来源:controller.py
示例9: PhysPopulation
class PhysPopulation(AnnPopulation):
"""Population class for the physical EvoFab system. Is used to
wrap up a significant amount of information important for the
execution of the GA within members
"""
def __init__(self, random_seed, printer_runtime, size, mutation_rate, mutation_range, crossover_rate, replacement_number, num_input, num_hidden, num_output, serial_port, sensor_serial_port, conveyor_port, z_port, camera, outputfolder, crop=True, is_visual=True, dump_to_files=False):
super(PhysPopulation, self).__init__(random_seed, printer_runtime, size, mutation_rate, mutation_range, crossover_rate, replacement_number, num_input, num_hidden, num_output, outputfolder, is_visual=is_visual, dump_to_files=dump_to_files)
self.genotype_factory = PhysGenotypeFactory(self)
#TODO: should probably test that sensor and controller serial ports are valid
self.controller = EvoController(serial_port)
self.sense = EvoArray(sensor_serial_port)
self.camera = EvoCamera(camera, crop)
self.conveyor = EvoConveyor(conveyor_port)
self.visualizer = Visualizer([self.sense.getNext() for x in range(10)])
self.visualizer.update(self.sense.getNext())
self.z_axis = EvoZAxis(z_port)
listener = threading.Thread(target=kbdListener)
listener.start()
开发者ID:UnionEvoRobo,项目名称:evofab,代码行数:20,代码来源:phys_printer_genetic_algorithms.py
示例10: setup
def setup(self, window_size=20, t_in=2, w=10, h=10, d=1, t_out=1, hidden_layers_sizes=[100], pretrain_step=1):
self.bed = TestBed(window_size=window_size, t_in=t_in, w=w, h=h, d=d, t_out=t_out, hidden_layers_sizes=hidden_layers_sizes)
self.gen = SinGenerator(w=w, h=h, d=1)
# self.gen = RadarGenerator('../data/radar', w=w, h=h, left=0, top=80)
self.vis = Visualizer(w=w, h=h, t_out=t_out)
self.pretrain_step = pretrain_step
# fill the window with data
for i in xrange(window_size):
y = self.gen.next()
self.bed.supply(y)
开发者ID:itolab-hayashi-rafik,项目名称:weather,代码行数:11,代码来源:gui.py
示例11: main
def main():
# get settings from command line arguments
settings = CommandLineParser().parse_args()
# create problem
problem = GrayScottProblem(settings.size, coefficients=settings.coefficients)
# create visualizer
visualizer = Visualizer(problem.problem_size(), \
export=settings.export, \
keepalive=settings.keepalive, \
show=(not settings.noshow))
# create step generator
stop_point_generator = TimeStepper(settings.timesteps, \
settings.outputs, mode='linear')
# evolution loop
stop_point = next(stop_point_generator)
for step in range(settings.timesteps + 1):
# print progress message
if settings.verbose == True:
progress = 100 * step / settings.timesteps
print('{:3.0f}% finished'.format(progress), end='\r')
# trigger visualization
if step == stop_point:
visualizer.update(problem.v)
try:
stop_point = next(stop_point_generator)
except StopIteration:
pass
# evolve problem
problem.evolve()
else:
if settings.verbose == True:
print('\nEvolution finished')
visualizer.close()
开发者ID:michaelschaefer,项目名称:grayscott,代码行数:39,代码来源:grayscott.py
示例12: __init__
def __init__(self, random_seed, printer_runtime, size, mutation_rate, mutation_range, crossover_rate, replacement_number, num_input, num_hidden, num_output, serial_port, sensor_serial_port, conveyor_port, z_port, camera, outputfolder, crop=True, is_visual=True, dump_to_files=False):
super(PhysPopulation, self).__init__(random_seed, printer_runtime, size, mutation_rate, mutation_range, crossover_rate, replacement_number, num_input, num_hidden, num_output, outputfolder, is_visual=is_visual, dump_to_files=dump_to_files)
self.genotype_factory = PhysGenotypeFactory(self)
#TODO: should probably test that sensor and controller serial ports are valid
self.controller = EvoController(serial_port)
self.sense = EvoArray(sensor_serial_port)
self.camera = EvoCamera(camera, crop)
self.conveyor = EvoConveyor(conveyor_port)
self.visualizer = Visualizer([self.sense.getNext() for x in range(10)])
self.visualizer.update(self.sense.getNext())
self.z_axis = EvoZAxis(z_port)
listener = threading.Thread(target=kbdListener)
listener.start()
开发者ID:UnionEvoRobo,项目名称:evofab,代码行数:13,代码来源:phys_printer_genetic_algorithms.py
示例13: main
def main():
cerebellum.registerMessageHandler(TestHandler())
staticMap = StaticMap()
cerebellum.registerMessageHandler(staticMap)
logic = SimpleStackLogic(cerebellum,staticMap)
cerebellum.registerMessageHandler(logic)
if visualize:
from visualizer import Visualizer
import simple_stack_visualizer
vis = Visualizer(cerebellum, staticMap)
vis.registerDrawer(simple_stack_visualizer.createDrawer(logic))
vis.start()
vis.registerDrawer(cerebellum.insurance.draw)
mainLoop()
if visualize:
vis.terminate = True
vis.join()
开发者ID:Vlad-Shcherbina,项目名称:icfpc2008-tbd,代码行数:22,代码来源:stack_controller.py
示例14: SeleniumMutationTrace
def SeleniumMutationTrace(folderpath, dirname, config_fname, traces_fname, trace_id, method_id, modes):
logging.info(" loading config...")
config = load_config(config_fname)
config.set_folderpath(folderpath)
config.set_dirname(dirname)
config.set_mutation_trace(traces_fname, trace_id)
config.set_mutation_method(method_id)
config.set_mutation_modes(modes)
logging.info(" setting executor...")
executor = SeleniumExecutor(config.get_browserID(), config.get_url())
logging.info(" setting crawler...")
automata = Automata()
databank = MysqlDataBank("localhost", "B00901138", "R124249166", "test")
crawler = SeleniumCrawler(config, executor, automata, databank)
logging.info(" crawler start run...")
crawler.run_mutant()
logging.info(" end! save automata...")
automata.save_traces(config)
automata.save_automata(config)
Visualizer.generate_html('web', os.path.join(config.get_path('root'), config.get_automata_fname()))
开发者ID:djason294,项目名称:WebTraceCollector,代码行数:24,代码来源:controller.py
示例15: __init__
def __init__(self, vis=False):
"""
Creates a new Driver.
Args:
vis: Boolean. Whether or not to show visualization of the simulation
runs using matplotlib.
Returns:
A new Driver instance.
"""
self.vis = vis
# If visualization is selected, show it.
if self.vis:
series = ('Population Count',
'Adult Count',
'Caloric Requirements (Mcal)',
'Produced Food (Mcal)',
'Air (kg O2)',
'Power Consumption (kWh)')
self.vis = Visualizer(series=series)
开发者ID:slugwarz05,项目名称:proj2-code,代码行数:24,代码来源:driver.py
示例16: Window
class Window(QtGui.QDialog):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
# visualizer
self.vis = Visualizer(xlim=30)
# this is the Canvas Widget that displays the `figure`
# it takes the `figure` instance as a parameter to __init__
self.canvas = FigureCanvas(self.vis.getFigure())
# this is the Navigation widget
# it takes the Canvas widget and a parent
# self.toolbar = NavigationToolbar(self.canvas, self)
# Form
self.window_size_line_edit = QtGui.QLineEdit("10")
self.window_size_line_edit.textChanged.connect(self.dnnChanged)
self.m_line_edit = QtGui.QLineEdit("1")
self.m_line_edit.textChanged.connect(self.dnnChanged)
self.r_line_edit = QtGui.QLineEdit("2")
self.r_line_edit.textChanged.connect(self.dnnChanged)
self.hidden_layer_sizes_line_edit = QtGui.QLineEdit("10,10,10")
self.hidden_layer_sizes_line_edit.textChanged.connect(self.dnnChanged)
self.input_form = QtGui.QFormLayout()
self.input_form.addRow("Window SIze:", self.window_size_line_edit)
self.input_form.addRow("m:", self.m_line_edit)
self.input_form.addRow("r:", self.r_line_edit)
self.input_form.addRow("Hidden Layer Sizes:", self.hidden_layer_sizes_line_edit)
self.pretrian_epochs_line_edit = QtGui.QLineEdit("10")
self.pretrian_epochs_line_edit.textChanged.connect(self.updateWorker)
self.pretrain_lr_slider = QtGui.QSlider(QtCore.Qt.Horizontal)
self.pretrain_lr_slider.setRange(1, 10)
self.pretrain_lr_slider.setValue(1)
self.pretrain_lr_slider.valueChanged.connect(self.updateWorker)
self.finetune_epochs_line_edit = QtGui.QLineEdit("10")
self.finetune_epochs_line_edit.textChanged.connect(self.updateWorker)
self.finetune_lr_slider = QtGui.QSlider(QtCore.Qt.Horizontal)
self.finetune_lr_slider.setRange(1, 10)
self.finetune_lr_slider.setValue(1)
self.finetune_lr_slider.valueChanged.connect(self.updateWorker)
self.learn_form = QtGui.QFormLayout()
self.learn_form.addRow("finetune_epoch", self.finetune_epochs_line_edit)
self.learn_form.addRow("finetune_lr", self.finetune_lr_slider)
self.learn_form.addRow("pretrain_epoch", self.pretrian_epochs_line_edit)
self.learn_form.addRow("pretrain_lr", self.pretrain_lr_slider)
# A slider to control the plot delay
self.slider = QtGui.QSlider(QtCore.Qt.Horizontal)
self.slider.setRange(0, 99)
self.slider.setValue(25)
self.slider.valueChanged.connect(self.updateWorker)
# A slider to control K
self.k_slider = QtGui.QSlider(QtCore.Qt.Vertical)
self.k_slider.setRange(0, 100)
self.k_slider.setValue(0)
self.k_slider.valueChanged.connect(self.updateWorker)
self.n_slider = QtGui.QSlider(QtCore.Qt.Vertical)
self.n_slider.setRange(0, 100)
self.n_slider.setValue(0)
self.n_slider.valueChanged.connect(self.updateWorker)
# Just some button connected to `plot` method
self.start_stop_button = QtGui.QPushButton("Start")
self.start_stop_button.clicked.connect(self.start)
# set the layout
layout = QtGui.QGridLayout()
# layout.addWidget(self.toolbar)
layout.addWidget(self.canvas, 0, 0, 1, 2)
layout.addWidget(self.k_slider, 0, 2, 1, 1)
layout.addWidget(self.n_slider, 0, 3, 1, 1)
layout.addLayout(self.input_form, 1, 0, 1, 1)
layout.addLayout(self.learn_form, 1, 1, 1, 1)
layout.addWidget(self.slider, 2, 0)
layout.addWidget(self.start_stop_button, 2, 1)
self.setLayout(layout)
# setup worker
self.need_setup = True
self.worker = Worker(self.vis)
# setup event dispatchers
self.worker.started.connect(self.workerStarted)
self.worker.updated.connect(self.updateFigure)
self.worker.stopped.connect(self.workerStopped)
def start(self):
self.start_stop_button.setText("Stop")
self.start_stop_button.setEnabled(False)
window_size = string.atoi(self.window_size_line_edit.text())
m = string.atoi(self.m_line_edit.text())
r = string.atoi(self.r_line_edit.text())
hidden_layer_sizes = self.hidden_layer_sizes_line_edit.text().split(",")
hidden_layer_sizes = [string.atoi(n) for n in hidden_layer_sizes]
#.........这里部分代码省略.........
开发者ID:itolab-hayashi-rafik,项目名称:weather,代码行数:101,代码来源:gui.py
示例17: xrange
d = device.GearVR
devices.append(d(loc))
for i in xrange(3, 6):
d = device.OculusRift
devices.append(d(loc))
for i in xrange(6, 11):
d = device.PlayStationVR
devices.append(d(loc))
# Initialize cloud
traffic_level = 'high'
cloud_loc = loc
timeout = 10000 # 10 seconds
num_players = len(devices)
cloud = Cloud(traffic_level, cloud_loc, timeout, num_players)
# Initialize network
packet_loss_probability = 0 # % chance of network-related dropped packet
network = net.UDP(packet_loss_probability);
sim = Simulator(cloud, network, devices)
sim.runFor(10 * 60 * 1000) # Number of milliseconds
results = sim.getResults()
viz = Visualizer(results, map(lambda n: "Device " + str(n), range(1,11)))
viz.plotAverageLatency()
# TODO: Be run with passed configurations, create simulator, and produce results
开发者ID:gabe-terrell,项目名称:IOT-Simulation,代码行数:30,代码来源:test4.py
示例18: Visualizer
#!/usr/bin/python
import psyco
psyco.full()
from misc import *
from controller import connection,cerebellum,visualize,mainLoop,staticMap
##############
cerebellum.registerMessageHandler(TestHandler())
#cerebellum.command = ("moveTo",0,0)
if visualize:
from visualizer import Visualizer
vis = Visualizer(cerebellum, staticMap)
vis.start()
mainLoop()
if visualize:
vis.terminate = True
vis.join()
开发者ID:Vlad-Shcherbina,项目名称:icfpc2008-tbd,代码行数:22,代码来源:dummy_controller.py
示例19: print
#from collector import *
from collector import Node
from visualizer import Visualizer
root = Node.unpickle()
print ("childs = ", len(root.childs))
print(root.childs[0].path)
visu = Visualizer(root)
visu.run()
开发者ID:prohor33,项目名称:clearcase-history-visualizer,代码行数:10,代码来源:main.py
示例20: EpisodeBuilder
import argparse
from episode_builder import EpisodeBuilder
from visualizer import Visualizer
DEFAULT_FILE_PATH = "data/template.json"
parser = argparse.ArgumentParser(description="Visualize Conway's Game of Life")
parser.add_argument("-file_path", default=DEFAULT_FILE_PATH)
args = parser.parse_args()
file_path = args.file_path
episode_builder = EpisodeBuilder(file_path)
episode = episode_builder.get_episode()
visualizer = Visualizer(episode)
visualizer.visualize()
开发者ID:vpong,项目名称:game-of-life,代码行数:17,代码来源:run_visualization.py
注:本文中的visualizer.Visualizer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论