コード例 #1
0
ファイル: bumps.py プロジェクト: ikhaliq42/GridCellModel
def flatFiringRate(FR,
                   times,
                   labely=None,
                   labelx=None,
                   units="ms",
                   titleStr="",
                   nticks=2):
    globalAxesSettings(mpl.gca())
    N = len(FR)  # no. of rows == no. of neurons
    T, N_id = np.meshgrid(times, np.arange(N))
    pcolormesh(T, N_id, FR)
    loc = LinearLocator(nticks)
    loc.tick_values(0, N - 1)
    mpl.gca().yaxis.set_major_locator(loc)
    if (labelx is None):
        xlabel("Time (%s)" % units)
    elif (labelx != ""):
        xlabel(labelx)

    if (labely is None):
        ylabel("Neuron #")
    elif (labely != ""):
        ylabel(labely)

    if (titleStr != ""):
        title(titleStr)

    axis('tight')
    createColorbar(mpl.gca(), data=FR, label='Firing rate (Hz)')
    tight_layout()
コード例 #2
0
ファイル: radar.py プロジェクト: yuwei2010/grapy
def scale_radar(array, n=6, kind='max'):

    from matplotlib.ticker import MaxNLocator, LinearLocator

    if array.ndim == 1:

        array = np.atleast_2d(array).T

    if kind == 'linear':
        locator = LinearLocator(n)
    else:
        locator = MaxNLocator(n)

    tvalues = ([
        locator.tick_values(*aminmax)
        for aminmax in zip(array.min(axis=0), array.max(axis=0))
    ])

    aminmax = np.vstack((arr.min(), arr.max()) for arr in tvalues)
    amins = aminmax[:, 0]
    aptps = aminmax.ptp(axis=1)

    ticks = np.vstack(tvalue[:n] for tvalue in tvalues)

    arrays = (array - amins) / aptps

    return arrays, ticks