本文整理汇总了Python中network.network方法的典型用法代码示例。如果您正苦于以下问题:Python network.network方法的具体用法?Python network.network怎么用?Python network.network使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类network
的用法示例。
在下文中一共展示了network.network方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_click
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def on_click(self, event):
if event.inaxes == self.ax and self.running == False:
self.params = model.params_three()
self.coupling = np.zeros((9), float)
self.coupling[:6] = self.network.coupling_strength
length = self.system.N_output(self.CYCLES)
self.t = self.system.dt*np.arange(length)
self.trajectory = np.zeros((length, 3), float)
self.li_b.set_data(self.t, self.trajectory[:, 0])
self.li_g.set_data(self.t, self.trajectory[:, 1]-0.06)
self.li_r.set_data(self.t, self.trajectory[:, 2]-0.12)
ticks = np.asarray(self.t[::self.t.size/10], dtype=int)
self.ax.set_xticks(ticks)
self.ax.set_xticklabels(ticks)
self.ax.set_xlim(self.t[0], self.t[-1])
self.fig.canvas.draw()
self.anim = animation.FuncAnimation(self.fig, self.compute_step, init_func=self.init, frames=self.trajectory.shape[0], interval=0, blit=True, repeat=False)
self.running = True
示例2: __init__
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def __init__(self, system, network, traces, info=None, position=None):
win.window.__init__(self, position)
self.system = system
self.network = network
self.traces = traces
self.info = info
self.GRID = 10
self.USE_GPU = False
self.PLOT_ARROWS = False
self.basin_image = None
ticks = 0.1*np.arange(11)
self.ax_traces = self.fig.add_subplot(121, xticks=ticks, yticks=ticks[1:])
self.ax_traces.set_xlabel(r'$\Delta\theta_{12}$', fontsize=20)
self.ax_traces.set_ylabel(r'$\Delta\theta_{13}$', fontsize=20)
self.ax_traces.set_xlim(0., 1.)
self.ax_traces.set_ylim(0., 1.)
self.ax_basins = self.fig.add_subplot(122, xticks=ticks, yticks=ticks[1:])
self.ax_basins.set_xlabel(r'$\Delta\theta_{12}$', fontsize=20)
self.key_func_dict.update(dict(u=torus_2D.increase_grid, i=torus_2D.decrease_grid, E=type(self).erase_traces, g=torus_2D.switch_processor, A=torus_2D.switch_arrows))
self.fig.canvas.mpl_connect('button_press_event', self.on_click)
示例3: __init__
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def __init__(self, phase_potrait, network, traces, info=None, position=None):
win.window.__init__(self, position, infoWindow=info)
self.system = phase_potrait
self.network = network
self.traces = traces
self.GRID = 6
self.USE_GPU = False
self.ax = self.fig.add_subplot(111, projection='3d', xticks=ticks, yticks=ticks, zticks=ticks)
self.ax.mouse_init(zoom_btn=None)
self.ax.set_xlabel(r'$\Delta\theta_{12}$', fontsize=15)
self.ax.set_ylabel(r'$\Delta\theta_{13}$', fontsize=15)
self.ax.set_zlabel(r'$\Delta\theta_{14}$', fontsize=15)
self.ax.set_xlim(0., 1.)
self.ax.set_ylim(0., 1.)
self.ax.set_zlim(0., 1.)
self.fig.tight_layout()
self.ax.autoscale(False)
self.key_func_dict.update( dict( u=torus.increase_grid, i=torus.decrease_grid,
R=torus.show_torus, E=torus.resetTorus, v=torus.reset_view ) )
#g=torus.switchProcessor))
self.fig.canvas.mpl_connect('button_press_event', self.clickTorus)
示例4: computeTraces
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def computeTraces(self, initial_condition=None, plotit=True):
if initial_condition == None:
initial_condition = self.initial_condition
V_i = th2.integrate_three_rk4(
initial_condition,
self.network.coupling_strength,
self.system.dt/float(self.system.stride),
self.system.N_output(self.CYCLES),
self.system.stride)
t = self.system.dt*np.arange(V_i.shape[0])
if plotit:
ticks = np.asarray(t[::t.size/10], dtype=int)
self.li_b.set_data(t, np.cos(V_i[:, 0]))
self.li_g.set_data(t, np.cos(V_i[:, 1])-2.)
self.li_r.set_data(t, np.cos(V_i[:, 2])-4.)
self.ax.set_xticks(ticks)
self.ax.set_xticklabels(ticks)
self.ax.set_xlim(t[0], t[-1])
self.fig.canvas.draw()
return t, V_i
示例5: compute_traces
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def compute_traces(self, initial_condition=None):
if initial_condition == None:
initial_condition = self.initial_condition
V_i = fh.integrate_four_rk4(
initial_condition,
self.network.get_coupling(),
self.system.dt/float(self.system.stride),
self.system.N_output(self.CYCLES),
self.system.stride)
t = self.system.dt*np.arange(V_i.shape[0])
ticks = np.asarray(t[::t.size/10], dtype=int)
self.li_b.set_data(t, V_i[:, 0])
self.li_g.set_data(t, V_i[:, 1]-2.)
self.li_r.set_data(t, V_i[:, 2]-4.)
self.li_y.set_data(t, V_i[:, 3]-6.)
self.ax.set_xticks(ticks)
self.ax.set_xticklabels(ticks)
self.ax.set_xlim(t[0], t[-1])
self.fig.canvas.draw()
return t, V_i
示例6: main
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def main():
graph = tf.Graph()
with graph.as_default():
#in_image = tf.compat.v1.placeholder(tf.float32, [None, TEST_CROP_FRAME, None, None, 4], name='input')
#gt_image = tf.compat.v1.placeholder(tf.float32, [None, TEST_CROP_FRAME, None, None, 3], name='gt')
in_image = tf.compat.v1.placeholder(tf.float32, [None, CROP_FRAME, 256, 256, 4], name='input')
gt_image = tf.compat.v1.placeholder(tf.float32, [None, CROP_FRAME, 256, 256, 3], name='gt')
out_image = network(in_image)
saver = tf.compat.v1.train.Saver(tf.compat.v1.global_variables())
sess = tf.compat.v1.Session()
sess.run(tf.compat.v1.global_variables_initializer())
sess.run(tf.compat.v1.local_variables_initializer())
saver.restore(sess, './1_checkpoint/16_bit_HE_to_HE_gt/model.ckpt')
saver.save(sess, './1_checkpoint/16_bit_HE_to_HE_gt/modelfilnal.ckpt')
graphdef = tf.compat.v1.graph_util.convert_variables_to_constants(sess, graph.as_graph_def(), ['output'])
tf.io.write_graph(graphdef, './1_checkpoint/16_bit_HE_to_HE_gt', 'lsmod_256.pb', as_text=False)
示例7: __init__
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def __init__(self, system, network, info=None, position=None):
win.window.__init__(self, position)
self.system = system
self.network = network
self.info = info
self.CYCLES = 20
self.ax = self.fig.add_subplot(111, frameon=False, yticks=[])
self.li_b, = self.ax.plot([], [], 'b-', lw=2.)
self.li_g, = self.ax.plot([], [], 'g-', lw=2.)
self.li_r, = self.ax.plot([], [], 'r-', lw=2.)
self.ax.set_xlabel(r'time (sec.)', fontsize=20)
self.ax.set_xticklabels(np.arange(0., 1., 0.1), fontsize=15)
self.ax.set_yticklabels(np.arange(0., 1., 0.1), fontsize=15)
self.ax.set_xlim(0., 100.)
self.ax.set_ylim(-5.5, 1.5)
#self.fig.tight_layout()
self.key_func_dict = dict(u=traces.increaseCycles, i=traces.decreaseCycles)
self.fig.canvas.mpl_connect('axes_enter_event', self.focusIn)
self.computeTraces()
示例8: computeTraces
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def computeTraces(self, initial_condition=None, plotit=True):
if initial_condition == None:
initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand())
V_i = fh.integrate_three_rk4(
initial_condition,
self.network.coupling_strength,
self.system.dt/float(self.system.stride),
self.system.N_output(self.CYCLES),
self.system.stride)
t = self.system.dt*np.arange(V_i.shape[0])
if plotit:
ticks = np.asarray(t[::t.size/10], dtype=int)
xscale, yscale = t[-1], 2.
for (i, li) in enumerate([self.li_b, self.li_g, self.li_r]):
tj, Vj = tl.adjustForPlotting(t, V_i[:, i], ratio=xscale/yscale, threshold=0.05*xscale)
li.set_data(tj, Vj-i*2)
self.ax.set_xticks(ticks)
self.ax.set_xticklabels(ticks)
self.ax.set_xlim(t[0], t[-1])
self.fig.canvas.draw()
return t, V_i
示例9: __init__
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def __init__(self, system, network, traces, info=None, position=None):
torus_2D.torus_2D.__init__(self, system, network, traces, info, position)
示例10: __init__
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def __init__(self, system, network, info=None, position=None):
win.window.__init__(self, position)
self.system = system
self.network = network
self.info = info
self.CYCLES = 8
self.state = system.load_initial_condition( pl.rand(), pl.rand() )
self.initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand())
self.running = False
self.pulsed = 0
self.ax = self.fig.add_subplot(111, frameon=False, yticks=[])
self.li_b, = self.ax.plot([], [], 'b-', lw=1.)
self.li_g, = self.ax.plot([], [], 'g-', lw=1.)
self.li_r, = self.ax.plot([], [], 'r-', lw=1.)
self.ax.set_xlabel(r'time (sec.)', fontsize=20)
self.ax.set_xticklabels(np.arange(0., 1., 0.1), fontsize=15)
self.ax.set_yticklabels(np.arange(0., 1., 0.1), fontsize=15)
self.ax.set_xlim(0., 100.)
self.ax.set_ylim(-0.06-0.12, 0.04)
self.key_func_dict.update(u=traces.increase_cycles, i=traces.decrease_cycles)
#self.fig.canvas.mpl_connect('button_press_event', self.on_click)
self.fig.canvas.mpl_connect('axes_enter_event', self.focus_in)
示例11: __init__
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def __init__(self, system, network, traces, info=None, position=None):
torus_2D.torus_2D.__init__(self, system, network, traces, info, position)
self.ax_traces.set_xlabel(r'phase difference $\Delta\theta_{12}$', fontsize=20)
self.ax_traces.set_ylabel(r'phase difference $\Delta\theta_{13}$', fontsize=20)
self.ax_basins.set_xlabel(r'phase difference $\Delta\theta_{12}$', fontsize=20)
示例12: phase_trace_cpu
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def phase_trace_cpu(self, i, X):
V_i = np.transpose(
type(self).model.integrate_three_rk4(
X[i, :],
self.network.coupling_strength,
self.dt/float(self.stride),
self.N_output,
self.stride))
ti, d = tl.phase_difference(V_i, V_trigger=type(self).V_trigger)
return d
示例13: compute_phase_trace_gpu
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def compute_phase_trace_gpu(self, X):
X = X.flatten()
V_all = type(self).model.cuda_integrate_three_rk4(X,
self.network.coupling_strength,
self.dt/float(self.stride),
self.N_output, self.stride)
V_all = np.swapaxes(V_all, 1, 2) # V_all[initial condition, voltage trace, time index]
return distribute.distribute(self.phase_trace_gpu, 'i', range(V_all.shape[0]), kwargs={'V': V_all})
示例14: __init__
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def __init__(self, phase_potrait, network, info=None, position=None):
self.system = phase_potrait
self.network = network
self.CYCLES = 10
self.info = info
self.initial_condition = self.system.load_initial_condition(pl.rand(), pl.rand(), pl.rand())
self.fig = pl.figure('Voltage Traces', figsize=(6, 2), facecolor='#EEEEEE')
self.ax = self.fig.add_subplot(111, frameon=False, yticks=[])
self.li_b, = self.ax.plot([], [], 'b-', lw=2.)
self.li_g, = self.ax.plot([], [], 'g-', lw=2.)
self.li_r, = self.ax.plot([], [], 'r-', lw=2.)
self.li_y, = self.ax.plot([], [], 'y-', lw=2.)
self.ax.set_xlabel(r'time (sec.)', fontsize=20)
self.ax.set_xticklabels(np.arange(0., 1., 0.1), fontsize=15)
self.ax.set_yticklabels(np.arange(0., 1., 0.1), fontsize=15)
self.ax.set_xlim(0., 100.)
self.ax.set_ylim(-0.06-0.18, 0.04)
self.fig.tight_layout()
self.key_func_dict = dict(u=traces.increase_cycles, i=traces.decrease_cycles)
self.fig.canvas.mpl_connect('key_press_event', self.on_key)
self.fig.canvas.mpl_connect('axes_enter_event', self.focus_in)
if not position == None:
try:
self.fig.canvas.manager.window.wm_geometry(position)
except:
pass
示例15: phaseTrace_cpu
# 需要导入模块: import network [as 别名]
# 或者: from network import network [as 别名]
def phaseTrace_cpu(self, i, X):
V_i = np.transpose(
model.integrate_four_rk4(
X[i, :],
self.network.get_coupling(),
self.dt/float(self.stride),
self.N_output, self.stride))
ti, d = tl.phase_difference(V_i, V_trigger=torus.V_trigger)
return d