def fig_network_input_structure(fig, params, bottom=<NUM_LIT:0.1>, top=<NUM_LIT>, transient=<NUM_LIT:200>, T=[<NUM_LIT>, <NUM_LIT:1000>], Df= <NUM_LIT:0.>, mlab= True, NFFT=<NUM_LIT>, srate=<NUM_LIT:1000>,<EOL>window=plt.mlab.window_hanning, noverlap=<NUM_LIT>*<NUM_LIT:3>/<NUM_LIT:4>, letters='<STR_LIT>', flim=(<NUM_LIT:4>, <NUM_LIT>),<EOL>show_titles=True, show_xlabels=True, show_CSD=False):
<EOL>networkSim = CachedNetwork(**params.networkSimParams)<EOL>if analysis_params.bw:<EOL><INDENT>networkSim.colors = phlp.get_colors(len(networkSim.X))<EOL><DEDENT>gs1 = gridspec.GridSpec(<NUM_LIT:5>, <NUM_LIT:5>, bottom=bottom, top=top)<EOL>ax0 = fig.add_subplot(gs1[:, <NUM_LIT:0>])<EOL>phlp.remove_axis_junk(ax0)<EOL>phlp.annotate_subplot(ax0, ncols=<NUM_LIT:5>, nrows=<NUM_LIT:1>, letter=letters[<NUM_LIT:0>],<EOL>linear_offset=<NUM_LIT>)<EOL>x, y = networkSim.get_xy(T, fraction=<NUM_LIT:1>)<EOL>networkSim.plot_raster(ax0, T, x, y,<EOL>markersize=<NUM_LIT>, marker='<STR_LIT:_>',<EOL>alpha=<NUM_LIT:1.>,<EOL>legend=False, pop_names=True,<EOL>rasterized=False)<EOL>ax0.set_ylabel('<STR_LIT>', labelpad=<NUM_LIT:0.>)<EOL>ax0.set_xticks([<NUM_LIT>,<NUM_LIT>,<NUM_LIT:1000>])<EOL>if show_titles:<EOL><INDENT>ax0.set_title('<STR_LIT>',va='<STR_LIT>')<EOL><DEDENT>if show_xlabels:<EOL><INDENT>ax0.set_xlabel(r'<STR_LIT>', labelpad=<NUM_LIT:0.>)<EOL><DEDENT>else:<EOL><INDENT>ax0.set_xlabel('<STR_LIT>')<EOL><DEDENT>T_all=[transient, networkSim.simtime]<EOL>bins = np.arange(transient, networkSim.simtime+<NUM_LIT:1>)<EOL>x, y = networkSim.get_xy(T_all, fraction=<NUM_LIT:1>)<EOL>ax_ = fig.add_subplot(gs1[:, <NUM_LIT:1>])<EOL>phlp.annotate_subplot(ax_, ncols=<NUM_LIT:5>, nrows=<NUM_LIT:1>, letter=letters[<NUM_LIT:1>],<EOL>linear_offset=<NUM_LIT>)<EOL>if show_titles:<EOL><INDENT>ax_.set_title('<STR_LIT>', va='<STR_LIT>')<EOL><DEDENT>ax_.axis('<STR_LIT>')<EOL>colors = phlp.get_colors(len(params.Y))+['<STR_LIT:k>']<EOL>COUNTER = <NUM_LIT:0><EOL>label_set = False<EOL>tits = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>if x['<STR_LIT>'].size > <NUM_LIT:0>:<EOL><INDENT>TC = True<EOL><DEDENT>else:<EOL><INDENT>TC = False<EOL><DEDENT>BAxes = []<EOL>for i, X in enumerate(networkSim.X):<EOL><INDENT>if i % <NUM_LIT:2> == <NUM_LIT:0>:<EOL><INDENT>ax1 = fig.add_subplot(gs1[COUNTER, <NUM_LIT:1>])<EOL>phlp.remove_axis_junk(ax1)<EOL>if x[X].size > <NUM_LIT:0>:<EOL><INDENT>ax1.text(<NUM_LIT>, <NUM_LIT>, tits[COUNTER],<EOL>horizontalalignment='<STR_LIT:left>',<EOL>verticalalignment='<STR_LIT>',<EOL>transform=ax1.transAxes)<EOL><DEDENT>BAxes.append(ax1)<EOL><DEDENT>hist = np.histogram(x[X], bins=bins)[<NUM_LIT:0>].astype(float)<EOL>hist -= hist.mean()<EOL>if mlab:<EOL><INDENT>Pxx, freqs=plt.mlab.psd(hist, NFFT=NFFT,<EOL>Fs=srate, noverlap=noverlap, window=window)<EOL><DEDENT>else:<EOL><INDENT>[freqs, Pxx] = hlp.powerspec([hist], tbin= <NUM_LIT:1.>,<EOL>Df=Df, pointProcess=False)<EOL>mask = np.where(freqs >= <NUM_LIT:0.>)<EOL>freqs = freqs[mask]<EOL>Pxx = Pxx.flatten()<EOL>Pxx = Pxx[mask]<EOL>Pxx = Pxx/(T_all[<NUM_LIT:1>]-T_all[<NUM_LIT:0>])**<NUM_LIT:2><EOL><DEDENT>if x[X].size > <NUM_LIT:0>:<EOL><INDENT>ax1.loglog(freqs[<NUM_LIT:1>:], Pxx[<NUM_LIT:1>:],<EOL>label=X, color=colors[i],<EOL>clip_on=True)<EOL>ax1.axis(ax1.axis('<STR_LIT>'))<EOL>ax1.set_ylim([<NUM_LIT>,<NUM_LIT>])<EOL>ax1.set_yticks([<NUM_LIT>,<NUM_LIT>,<NUM_LIT>])<EOL>if label_set == False:<EOL><INDENT>ax1.set_ylabel(r'<STR_LIT>', labelpad=<NUM_LIT:0.>)<EOL>label_set = True<EOL><DEDENT>if i > <NUM_LIT:1>:<EOL><INDENT>ax1.set_yticklabels([])<EOL><DEDENT>if i >= <NUM_LIT:6> and not TC and show_xlabels or X == '<STR_LIT>' and TC and show_xlabels:<EOL><INDENT>ax1.set_xlabel('<STR_LIT>', labelpad=<NUM_LIT:0.>)<EOL><DEDENT>if TC and i < <NUM_LIT:8> or not TC and i < <NUM_LIT:6>:<EOL><INDENT>ax1.set_xticklabels([])    <EOL><DEDENT><DEDENT>else:<EOL><INDENT>ax1.axis('<STR_LIT>')<EOL><DEDENT>ax1.set_xlim(flim)<EOL>if i % <NUM_LIT:2> == <NUM_LIT:0>:<EOL><INDENT>COUNTER += <NUM_LIT:1><EOL><DEDENT>ax1.yaxis.set_minor_locator(plt.NullLocator())<EOL><DEDENT>ax2 = fig.add_subplot(gs1[:, <NUM_LIT:2>])<EOL>phlp.annotate_subplot(ax2, ncols=<NUM_LIT:5>, nrows=<NUM_LIT:1>, letter=letters[<NUM_LIT:2>],<EOL>linear_offset=<NUM_LIT>)<EOL>phlp.remove_axis_junk(ax2)<EOL>plot_signal_sum(ax2, params,<EOL>fname=os.path.join(params.savefolder, '<STR_LIT>'),<EOL>unit='<STR_LIT>', T=T, ylim=[-<NUM_LIT>, <NUM_LIT>],<EOL>rasterized=False)<EOL>if show_CSD:<EOL><INDENT>im = plot_signal_sum_colorplot(ax2, params, os.path.join(params.savefolder, '<STR_LIT>'),<EOL>unit=r'<STR_LIT>', T=[<NUM_LIT>, <NUM_LIT:1000>],<EOL>colorbar=False,<EOL>ylim=[-<NUM_LIT>, <NUM_LIT>], fancy=False, cmap=plt.cm.get_cmap('<STR_LIT>', <NUM_LIT>),<EOL>rasterized=False)<EOL>cb = phlp.colorbar(fig, ax2, im,<EOL>width=<NUM_LIT>, height=<NUM_LIT>,<EOL>hoffset=-<NUM_LIT>, voffset=<NUM_LIT>)<EOL>cb.set_label('<STR_LIT>', labelpad=<NUM_LIT:0.1>)<EOL><DEDENT>ax2.set_xticks([<NUM_LIT>,<NUM_LIT>,<NUM_LIT:1000>])<EOL>ax2.axis(ax2.axis('<STR_LIT>'))<EOL>if show_titles:<EOL><INDENT>if show_CSD:<EOL><INDENT>ax2.set_title('<STR_LIT>', va='<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>ax2.set_title('<STR_LIT>', va='<STR_LIT>')<EOL><DEDENT><DEDENT>if show_xlabels:<EOL><INDENT>ax2.set_xlabel(r'<STR_LIT>', labelpad=<NUM_LIT:0.>)<EOL><DEDENT>else:<EOL><INDENT>ax2.set_xlabel('<STR_LIT>')<EOL><DEDENT>freqs, PSD = calc_signal_power(params, fname=os.path.join(params.savefolder,<EOL>'<STR_LIT>'),<EOL>transient=transient, Df=Df, mlab=mlab,<EOL>NFFT=NFFT, noverlap=noverlap,<EOL>window=window)<EOL>channels = [<NUM_LIT:0>, <NUM_LIT:3>, <NUM_LIT:7>, <NUM_LIT:11>, <NUM_LIT>]<EOL>ax_ = fig.add_subplot(gs1[:, <NUM_LIT:3>])<EOL>phlp.annotate_subplot(ax_, ncols=<NUM_LIT:5>, nrows=<NUM_LIT:1>, letter=letters[<NUM_LIT:3>],<EOL>linear_offset=<NUM_LIT>)<EOL>if show_titles:<EOL><INDENT>ax_.set_title('<STR_LIT>',va='<STR_LIT>')<EOL><DEDENT>ax_.axis('<STR_LIT>')<EOL>for i, ch in enumerate(channels):<EOL><INDENT>ax = fig.add_subplot(gs1[i, <NUM_LIT:3>])<EOL>phlp.remove_axis_junk(ax)<EOL>if i == <NUM_LIT:0>:<EOL><INDENT>ax.set_ylabel('<STR_LIT>', labelpad=<NUM_LIT:0>)<EOL><DEDENT>ax.loglog(freqs[<NUM_LIT:1>:],PSD[ch][<NUM_LIT:1>:], color='<STR_LIT:k>')<EOL>ax.xaxis.set_ticks_position('<STR_LIT>')<EOL>ax.yaxis.set_ticks_position('<STR_LIT:left>')<EOL>if i < <NUM_LIT:4>:<EOL><INDENT>ax.set_xticklabels([])<EOL><DEDENT>ax.text(<NUM_LIT>, <NUM_LIT>,'<STR_LIT>' %(channels[i]+<NUM_LIT:1>),<EOL>horizontalalignment='<STR_LIT:left>',<EOL>verticalalignment='<STR_LIT>',<EOL>fontsize=<NUM_LIT:6>,<EOL>transform=ax.transAxes)<EOL>ax.tick_params(axis='<STR_LIT:y>', which='<STR_LIT>', bottom='<STR_LIT>')<EOL>ax.axis(ax.axis('<STR_LIT>'))<EOL>ax.yaxis.set_minor_locator(plt.NullLocator())<EOL>ax.set_xlim(flim)<EOL>ax.set_ylim(<NUM_LIT>,<NUM_LIT>)<EOL>if i != <NUM_LIT:0> :<EOL><INDENT>ax.set_yticklabels([])<EOL><DEDENT><DEDENT>if show_xlabels:<EOL><INDENT>ax.set_xlabel('<STR_LIT>', labelpad=<NUM_LIT:0.>)<EOL><DEDENT>ax4 = fig.add_subplot(gs1[:, <NUM_LIT:4>])<EOL>phlp.annotate_subplot(ax4, ncols=<NUM_LIT:5>, nrows=<NUM_LIT:1>, letter=letters[<NUM_LIT:4>],<EOL>linear_offset=<NUM_LIT>)<EOL>fname=os.path.join(params.savefolder, '<STR_LIT>')<EOL>im = plot_signal_power_colorplot(ax4, params, fname=fname, transient=transient, Df=Df,<EOL>mlab=mlab, NFFT=NFFT, window=window,<EOL>cmap=plt.cm.get_cmap('<STR_LIT>', <NUM_LIT:12>),<EOL>vmin=<NUM_LIT>, vmax=<NUM_LIT>)<EOL>phlp.remove_axis_junk(ax4)<EOL>ax4.set_xlim(flim)<EOL>cb = phlp.colorbar(fig, ax4, im,<EOL>width=<NUM_LIT>, height=<NUM_LIT:0.5>,<EOL>hoffset=-<NUM_LIT>, voffset=<NUM_LIT:0.5>)<EOL>cb.set_label('<STR_LIT>', labelpad=<NUM_LIT:0.1>)<EOL>if show_titles:<EOL><INDENT>ax4.set_title('<STR_LIT>', va='<STR_LIT>')<EOL><DEDENT>if show_xlabels:<EOL><INDENT>ax4.set_xlabel(r'<STR_LIT>', labelpad=<NUM_LIT:0.>)<EOL><DEDENT>else:<EOL><INDENT>ax4.set_xlabel('<STR_LIT>')<EOL><DEDENT>return fig<EOL>
This figure is the top part for plotting a comparison between the PD-model
and the modified-PD model