當前位置: 首頁>>代碼示例>>Python>>正文


Python network.network方法代碼示例

本文整理匯總了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 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:27,代碼來源:traces.py

示例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) 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:26,代碼來源:torus_2D.py

示例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) 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:27,代碼來源:torus.py

示例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 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:27,代碼來源:traces.py

示例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 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:27,代碼來源:traces.py

示例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) 
開發者ID:PINTO0309,項目名稱:PINTO_model_zoo,代碼行數:24,代碼來源:00_freeze_lsmod.py

示例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() 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:29,代碼來源:traces.py

示例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 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:30,代碼來源:traces.py

示例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) 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:4,代碼來源:torus.py

示例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) 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:30,代碼來源:traces.py

示例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) 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:7,代碼來源:torus.py

示例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 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:12,代碼來源:torus_2D.py

示例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}) 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:10,代碼來源:torus_2D.py

示例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 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:36,代碼來源:traces.py

示例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 
開發者ID:jusjusjus,項目名稱:Motiftoolbox,代碼行數:11,代碼來源:torus.py


注:本文中的network.network方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。