def col_BW_wrapper(avgS, bwType, dec, depmod=False):
    """The wrapper function for different decoders in the non-uniform model:
        This function returns the decoder variables for the given model parameters as well as the decoder type.
        
        Parameters
        ----------
        avgS: float. The surround stimulus hue angle in degrees.
        bwType: string. The type of the non-uniform model normalization. "gf" gives the maximum activity normalized model,
        "gs" gives the total activity normalized model.
        dec: string. The type of the decoder. "vs" is the population vector decoder, "vm" is the von Mises fit decoder,
        "ml" is the maximum likelihood decoder, "mf" is the maximum fire rate decoder.
        depmod: boolean, optional. If this parameter is True, then the modulation depth is different as a function of 
        the surround hue angle. Otherwise, the modulation depth is the same for all surround conditions.
        
        Returns
        -------
        decNoSur: class object. Returns the chosen decoder object created by the given non-uniform model.
    """
    colMod = colclass.colmod(std2kappa(60, 1.4, 1.5),
                             1,
                             0.5, [60, 70],
                             avgSur=avgS,
                             bwType=bwType,
                             depmod=depmod)
    if dec == "vs":
        #decSur=colclass.decoder.vecsum(colMod.x,colMod.resulty,colMod.unitTracker,avgSur=avgS)
        decNoSur = colclass.decoder.vecsum(colMod.x,
                                           colMod.centery,
                                           colMod.unitTracker,
                                           avgSur=avgS)
    if dec == "vm":
        #decSur=colclass.decoder.vmfit(colMod.x,colMod.resulty,colMod.unitTracker,avgSur=avgS)
        decNoSur = colclass.decoder.vmfit(colMod.x,
                                          colMod.centery,
                                          colMod.unitTracker,
                                          avgSur=avgS)
    if dec == "ml":
        #decSur=colclass.decoder.ml(colMod.x,colMod.centery,colMod.resulty,colMod.unitTracker,avgSur=avgS)
        decNoSur = colclass.decoder.ml(colMod.x,
                                       colMod.centery,
                                       colMod.centery,
                                       colMod.unitTracker,
                                       avgSur=avgS)
    if dec == "mf":
        #decSur=colclass.decoder.maxfr(colMod.x,colMod.resulty,colMod.unitTracker,avgSur=avgS)
        decNoSur = colclass.decoder.maxfr(colMod.x,
                                          colMod.centery,
                                          colMod.unitTracker,
                                          avgSur=avgS)
    #return decSur,decNoSur
    return decNoSur
Пример #2
0
    0, r"C:\Users\Ibrahim Alperen Tunc\.spyder-py3\bachelor_arbeit\python"
)  #Change the directory accordingly.
import colclass as col
from supplementary_functions import std2kappa, depth_modulator, plotter, param_dict, circler
import cmath as c
from scipy import optimize as op

path = r"C:\Users\Ibrahim Alperen Tunc\.spyder-py3\bachelor_arbeit\thesis_figures"
"""
Take the best fit color model to start with
"""
colmod = col.colmod(1,
                    2.3,
                    0.5,
                    stdInt=[1.3, 1.2],
                    bwType="gradient/sum",
                    phase=22.5,
                    avgSur=0,
                    depInt=[0.4, 0.6],
                    depmod=True,
                    stdtransform=False)
#!!!For this model the correction is WORSE THAN the non corrected.
"""
Check the model without surround
"""
plt.figure(1)
plt.title(
    "Population activity of the non-uniform model without surround modulation",
    fontsize=20)
plt.ylabel("Unit activity [a.u.]", fontsize=15)
plt.xlabel("Center hue angle [°]", fontsize=15)
for j in range(23, len(colmod.centery) + 1, 23):
Пример #3
0
"""
Development script of the von Mises fit decoder, can be ignored, similar codes are also in colclass.py von Mises fit decoder part
Decoder by fitting a von Mises distribution to population activity
Returns the plots of the fit parameters and the color tilt curve.
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.insert(0,r"C:\Users\Ibrahim Alperen Tunc\.spyder-py3\bachelor_arbeit\python")#!Change the directory where colclass.py is
from colclass import colmod
from scipy.optimize import curve_fit as fit

'''
Call colmod to create center units, surround effect etc.
'''
colMod=colmod(1.5,1,0.5,[60,70],bwType="regular")

'''
To start with the fit first define the von Mises function with parameters to be changed,
than take the population activity for a given stimulus hue angle and use function fit.
'''

def fit_func(ang,amp,kappa,avg):
    """The distribution function:
        This function returns the von Mises distribution values for the given parameters. This will be later used to fit the parameters
        by using the population activity values for the given angle.
        
        Parameters
        ----------
        ang: float. The angle value in degrees. These values are in x-axis. This parameter can also be given as a list.
        amp: float. The amplitude of the distribution.
Пример #4
0
'''
Maximum fire rate decoder: look at the population activity in given angle and most active unit ist the decoded angle (winner takes all decoder)
The codes in this script is the further transported to colclass.py. Thus, this script is redundant and is only to check the codes in greater detail/to test
the decoder.
Returns the colortilt plot.
'''
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.insert(0,
                r"C:\Users\Ibrahim Alperen Tunc\.spyder-py3\bachelor_arbeit")
from colclass import colmod
'''
As always start with modelling the units and stuff with colmod
'''
colMod = colmod(2, 0.6, 0.7)


def max_fr(stimulusAngle, unitStep=1, avgSur=180):
    """Maximum fire rate decoder:
        This function takes the population activity after surround modulation for a given center-surround stimulus. The decoded center hue angle
        is the preferred hue of the most active center unit.
        
        Parameters
        ----------
        stimulusAngle: float. The center hue stimulus angle in degrees.
        unitStep: integer, optional. The number of units to be skipped while decoding. unitStep=1 means all units are taken into account for the
        decoding.
        avgSur: float, optional. The surround hue stimulus angle in degrees.
        
        Returns
Пример #5
0
def surr_analysis(
        surr, grType,
        depmod):  #Make plot titles for each condition (bwType,depmod)!
    """Color tilt plotter function for the given model type:
        This function creates the plots of exemplary population activity at 100° center stimulus hue, tuning curves of the model units 
        after surround modulation as well as the color tilt curves for all decoders.
        
        Parameters
        ----------
        surr: float. The surround stimulus hue angle in degrees. This parameter can also be given as tuple/list.
        grType: string. The model type. Can be "norm" (uniform model), "gf" (non-uniform maximum unit activity normalized model), 
        or "gs" (non-uniform total unit activity normalized model).
        depmod: booelan. If true, surround modulation is also non-uniform with different suppression strength depending on the surround
        stimulus hue angle
        
        Note that phase of the non-uniform model is 22.5°, meaning that the strongest suppression is at surround angle=22.5° and the center
        unit with preferred hue angle of 22.5° has the narrowest tuning. These parameters change then as a gradient within a 180° period. 
        
        Returns
        -------
        dictPar: dictionary. The dictionary with important color tilt curve values for each decoder and surround.
    """
    titmap = [
        "uniform model", "non-uniform model maximum activity normalized",
        "non-uniform model total activity normalized",
        "uniform surround modulation", "non-uniform surround modulation"
    ]  #Plot title map for different grType and depMod
    if grType == "norm":
        tit = titmap[0]
    if grType == "gf":
        tit = titmap[1]
    if grType == "gs":
        tit = titmap[2]
    if depmod == False:
        tit2 = titmap[3]
    if depmod == True:
        tit2 = titmap[4]
    fig1 = plotter.plot_template(auto=True)
    plt.title(
        "Hue shift for the %s with %s" % (tit, tit2), y=1.08, fontsize=20
    )  #1st plot is the color tilt curve, subplots with different surrounds
    plt.xlabel("Hue difference between center and surround [°]", fontsize=15)
    plt.ylabel("Induced hue shift [°]", fontsize=15)

    fig2 = plotter.plot_template(
        auto=True
    )  #2nd plot is the population activity for center stimulus=100°, subplots with different surrounds
    plt.xlabel("Center stimulus angle [°]", fontsize=15)
    plt.ylabel("Population activity [a.u.]", fontsize=15, x=-0.1)
    plt.title("Pop. activity (100°) %s with %s" % (tit, tit2),
              x=0.55,
              y=1.08,
              fontsize=20)

    fig3 = plotter.plot_template(
        auto=True
    )  #Tuning curves of the chromatic filters, subplots with different surrounds
    plt.xlabel("Center stimulus angle [°]", fontsize=15)
    plt.ylabel("Unit activity [a.u.]", fontsize=15, x=-0.1)
    plt.title("Tuning curves of the %s with %s" % (tit, tit2),
              y=1.08,
              fontsize=20)

    colMap = ("blue", "red", "black")  #color map for each decoder in fig 1.
    labMap = ("von Mises fit", "vector sum", "maximum likelihood"
              )  #label map for legend
    for i in range(0, len(surr)):  #start of the plotting for each surround
        if i == 0:
            print("computing 1st surround angle")
        """
        Create the chosen model
        """
        if grType == "norm":
            colMod = col.colmod(std2kappa(60, 1, 1.5),
                                1,
                                0.5, [60, 70],
                                avgSur=surr[i],
                                bwType="regular",
                                depmod=depmod,
                                phase=22.5)
        if grType == "gf":
            colMod = col.colmod(std2kappa(60, 1, 1.5),
                                1,
                                0.5, [60, 70],
                                avgSur=surr[i],
                                bwType="gradient/max",
                                depmod=depmod,
                                phase=22.5)
        if grType == "gs":
            colMod = col.colmod(std2kappa(60, 1, 1.5),
                                1,
                                0.5, [60, 70],
                                avgSur=surr[i],
                                bwType="gradient/sum",
                                depmod=depmod,
                                phase=22.5)
        """
        Different decoders to be used in fig. 1
        """
        decvm = col.decoder.vmfit(colMod.x,
                                  colMod.resulty,
                                  colMod.unitTracker,
                                  avgSur=surr[i])  #von Mises fit
        decvs = col.decoder.vecsum(colMod.x,
                                   colMod.resulty,
                                   colMod.unitTracker,
                                   avgSur=surr[i])  #population vector
        print("takes some time")
        decml = col.decoder.ml(colMod.x,
                               colMod.centery,
                               colMod.resulty,
                               colMod.unitTracker,
                               avgSur=surr[i])  #maximum likelihood

        ax1 = plotter.subplotter(
            fig1, i
        )  #Create the passing subplot for the surround hue for the moment.
        """
        Plottings in the subplot for all decoders
        """
        ax1.plot(decvm.centSurDif,
                 decvm.angShift,
                 color=colMap[0],
                 label=labMap[0])
        ax1.plot(decvs.centSurDif,
                 decvs.angShift,
                 color=colMap[1],
                 label=labMap[1])
        ax1.plot(decml.centSurDif,
                 decml.angShift,
                 color=colMap[2],
                 label=labMap[2])
        """
        Subplot formatting
        """
        ax1.set_xticks(np.linspace(
            -180, 180,
            9))  #x ticks are between +-180, in obliques and cardinal angles
        ax1.tick_params(axis='both', which='major',
                        labelsize=15)  #major ticks are bigger labeled
        ax1.xaxis.set_major_locator(
            MultipleLocator(90))  #major ticks are set at 0,90,180,...
        ax1.xaxis.set_major_formatter(FormatStrFormatter('%d'))
        ax1.xaxis.set_minor_locator(
            MultipleLocator(45))  #minor ticks are set at 45,135,...
        ax1.set_ylim(bottom=-30, top=30)  #y axis is between +-30
        """
        Same manipulations for the fig 2.
        """
        ax2 = plotter.subplotter(fig2, i)
        ax2.plot(np.linspace(0, 359, 360),
                 decvm.surDecoder[np.where(colMod.unitTracker == 100)[0][0]],
                 color="black",
                 label="with surround modulation")
        ax2.plot(np.linspace(0, 359, 360),
                 col.decoder.nosurround(100, colMod.x, colMod.centery).noSur,
                 color="grey",
                 label="without surround modulation")
        ax2.set_xticks(np.linspace(0, 360, 9))
        ax2.tick_params(axis='both', which='major', labelsize=15)
        ax2.xaxis.set_major_locator(MultipleLocator(90))
        ax2.xaxis.set_major_formatter(FormatStrFormatter('%d'))
        ax2.xaxis.set_minor_locator(MultipleLocator(45))
        """
        Legends of the figures 1/2
        """
        if i == 7:
            print("putting legends")
            ax1.legend(loc="best", bbox_to_anchor=(1, 1), fontsize=15)
            ax2.legend(loc="best", bbox_to_anchor=(1, 1), fontsize=15)
        """
        Same work done for fig 3. Problem with this figure, the figure is but unnecessary, so can be discarded for the time being
        """
        ax3 = plotter.subplotter(fig3, i)
        for l in range(
                0, len(surr)
        ):  #This for loops plots for each subplot all tuning curves with preferred hue angle as in surr list!
            if l == 4:  #As there is no unit with preferred hue angle of 0, for surround=0° the activity in 360° is given
                ax3.plot(np.linspace(0, 359.9, 3600),
                         colMod.resulty[np.where(
                             colMod.unitTracker == 360)[0][0]][np.where(
                                 colMod.x == 0)[0][0]:np.where(
                                     colMod.x == 360)[0][0]],
                         color="black",
                         linewidth=1.0)
            else:
                ax3.plot(np.linspace(0, 359.9, 3600),
                         colMod.resulty[np.where(
                             colMod.unitTracker == surr[l])[0][0]][np.where(
                                 colMod.x == 0)[0][0]:np.where(
                                     colMod.x == 360)[0][0]],
                         color="black",
                         linewidth=1.0)
        ax3.set_xticks(np.linspace(0, 360, 9))
        ax3.xaxis.set_major_locator(MultipleLocator(90))
        ax3.xaxis.set_major_formatter(FormatStrFormatter('%d'))
        ax3.xaxis.set_minor_locator(MultipleLocator(45))
        ax3.tick_params(axis='x', which='major', labelsize=15)
        ax3.tick_params(axis='y', which='major', labelsize=15)

        if i in (0, 3):
            ax1.axes.get_xaxis().set_visible(False)
            ax2.axes.get_xaxis().set_visible(False)

        elif i in (6, 7):
            ax1.axes.get_yaxis().set_visible(False)
            ax2.axes.get_yaxis().set_visible(False)
        elif i in (1, 2):
            ax1.axes.get_yaxis().set_visible(False)
            ax1.axes.get_xaxis().set_visible(False)
            ax2.axes.get_yaxis().set_visible(False)
            ax2.axes.get_xaxis().set_visible(False)
        elif i == 5:
            ax1.axes.get_yaxis().set_visible(True)
            ax1.axes.get_xaxis().set_visible(True)
            ax2.axes.get_yaxis().set_visible(True)
            ax2.axes.get_xaxis().set_visible(True)
        """
        Mayhem is the collection of all important color tilt values for each decoder and each surround condition.
        """
        mayhem=(surr[i],max(decvm.angShift),max(decvs.angShift),max(decml.angShift),\
              decvm.centSurDif[np.where(decvm.angShift==max(decvm.angShift))[0][0]],decvs.centSurDif[np.where(decvs.angShift==max(decvs.angShift))[0][0]],decml.centSurDif[np.where(decml.angShift==max(decml.angShift))[0][0]],\
              min(decvm.angShift),min(decvs.angShift),min(decml.angShift),\
              decvm.centSurDif[np.where(decvm.angShift==min(decvm.angShift))[0][0]],decvs.centSurDif[np.where(decvs.angShift==min(decvs.angShift))[0][0]],decml.centSurDif[np.where(decml.angShift==min(decml.angShift))[0][0]],\
              decvm.angShift[decvm.centSurDif.index(0)],decvs.angShift[decvs.centSurDif.index(0)],decml.angShift[decml.centSurDif.index(0)])
        """
        Print the summary values to give feedback that function is up&working, these summary values also cause the waiting time to go faster, as reading the summary is a nice hobby inbetween.
        """
        print("Summary: surround angle=%s \
            maximum angular shift: vm=%s, vs=%s, ml=%s\
            csd at max ang. shift: vm=%s, vs=%s, ml=%s\
            minimum angular shift: vm=%s, vs=%s, ml=%s\
            csd at min ang. shift: vm=%s, vs=%s, ml=%s\
            decoding precision stim=surround: vm=%s, vs=%s, ml=%s"\
            %(mayhem))
        """
        Create the colortilt values dictionary
        """
        for j in range(0, len(dec)):
            for k in range(0, len(params)):
                dictPar[dec[j]][params[k]].update(
                    {surr[i]: mayhem[j + 3 * k + 1]})

        print("computing next surround angle")
        print("")
    return dictPar
Пример #6
0
import matplotlib.pyplot as plt
import colclass as col
import sys
sys.path.insert(0, col.pathes.runpath)  #!Change the directory accordingly
from supplementary_functions import std2kappa, kappa2std, depth_modulator, plotter, param_dict

#OLE TRY_1
#See Salinas&Abbot 1994

#Import a random model
model = col.colmod(None,
                   2,
                   None,
                   stdInt=[2, 1],
                   bwType="gradient/sum",
                   phase=0,
                   avgSur=180,
                   startAvg=1,
                   endAvg=360,
                   depInt=[0.2, 0.6],
                   depmod=True,
                   stdtransform=False)

kapMod = (2 - 1) / 2 * np.cos(
    2 * np.deg2rad(np.linspace(1, 360, 360) - 0)
) + 1 + (
    2 - 1
) / 2  #Kappa Modulator, see also depth_modulator() in supplementary_functions.py


def OLE(unitactivity, x):  #SOMETHING NOT RIGHT, DEBUG SOME TIME LATER
    #L_j=integral(stimulusVector*responseToStimulus)
Пример #7
0
def model_decoder(
    Kcent,
    Ksur,
    maxInhRate,
    plotStep=10
):  #Kappa bigger means distribution more dense around peak,1/Kappa ananlogous to variance ?HOW TO IMPLEMENT SIMILAR TO SD
    """Model test function:
        Enables to try different model parameters for the unifor model and surround stimulus angle=180
        
        Parameters
        ----------
        Kcent: float. Kappa value of the center unit tuning curves 
        Ksur: float. Kappa value of the surround suppression curve
        maxInhRate: float. Maximum value of the surround suppression curve. values between 0,1
        plotStep: integer, optional. Number of units to be skipped for the plot of center unit tuning curves
        
        Returns
        -------
        Plots of the center units before and after surround modulation as well as color tilt curve (with population vector decoder)"""

    avgS = 180  #Surround stimulus angle is set to 180 for the test
    colMod = colmod(Kcent, Ksur, maxInhRate, avgSur=avgS)
    '''
    now +surround
    '''
    def vector_decoder(
            stimulusAngle,
            unitStep=1):  #vector sum decoding (used in Gilbert et al.).
        surDecoder = []
        for i in range(0, len(colMod.resulty), unitStep):
            surDecoder.append(
                colMod.resulty[i][np.where(colMod.x == stimulusAngle)[0][0]])
        popSurVector = []
        for i in range(0, len(surDecoder)):
            popSurVector.append(
                surDecoder[i] *
                np.e**(1j * np.deg2rad(colMod.unitTracker[i * unitStep]))
            )  #each unit is transformed into vectors in complex plain with vector length equal to
            #unit activity and angle equal to preferred unit angle (in form of z=r*e**(i*angle)), !Computations for angle are done here in radiants

        np.sum(popSurVector)  #vector sum of neural population
        decodedAngleSur = np.rad2deg(c.phase(np.sum(popSurVector)))
        if decodedAngleSur < 0:
            decodedAngleSur = 360 + decodedAngleSur  #transform the negative angles into angles>180.
        return decodedAngleSur - stimulusAngle, stimulusAngle - avgS  #returns the shift of decoded angle and center-surround difference

    """
    Induced angular shift against the center-surround discrepancy
    """
    centSurDif = []
    angShift = []
    for i in range(0, len(colMod.unitTracker)):
        angShift.append(vector_decoder(stimulusAngle=colMod.unitTracker[i])[0])
        centSurDif.append(
            vector_decoder(stimulusAngle=colMod.unitTracker[i])[1])
    """   
     Plottings all together down here ;)
    """

    def plotter():
        for i in range(0, len(colMod.centery),
                       plotStep):  #range of 90-270 also possible
            plt.plot(colMod.x, colMod.centery[i])
        plt.title('Tuning curves of center units before surround effect')
        plt.xlabel('Angle')
        plt.ylabel('Neural activity')

        plt.figure()
        plt.plot(colMod.x, colMod.surroundy)
        plt.title('effect of surround angle (180) on center units')
        plt.xlabel('Preferred Unit Angle')
        plt.ylabel('Neural activity inhibition rate')

        plt.figure()
        for i in range(0, len(colMod.resulty), plotStep):
            plt.plot(
                colMod.x, colMod.resulty[colMod.unitTracker[i] - 2]
            )  #-2 is to plot maximally inhibited curve as well (resulty[179])
        plt.title('Tuning curves of center units after surround effect')
        plt.xlabel('Angle')
        plt.ylabel('Neural activity')

        plt.figure()
        plt.plot(centSurDif, angShift)
        plt.plot([-180, 180], [0, 0])
        plt.title('Angular shift relative to center-surround angle difference')
        plt.ylabel('Difference between perceived and real angles')
        plt.xlabel('Center-surround difference')
        return

    return plotter()
Пример #8
0
sys.path.insert(
    0, r"C:\Users\Ibrahim Alperen Tunc\.spyder-py3\bachelor_arbeit\python"
)  #!Change directory where colclass.py is.
from colclass import colmod
"""
Create wrapped normal distribution curve for center population
"""
Kcent = 5  #Kappa bigger means distribution more dense around peak,1/Kappa ananlogous to variance ?HOW TO IMPLEMENT SIMILAR TO SD
startAvg = 1
endAvg = 360
Ksur = 2
avgSur = 180
maxInhRate = 0.5
colMod = colmod(Kcent,
                Ksur,
                maxInhRate,
                avgSur=avgSur,
                startAvg=startAvg,
                endAvg=endAvg)
'''
Make a look-up table for ML-decoding (the population activity for each stimulus angle without surround modulation)!!!! 
'''


def tab_look(stimulusAngle):
    tableML = {}
    tableInd = []
    #stimulusAngle=100
    for i in range(1, len(colMod.unitTracker) + 1):
        tableInd.append(
            colMod.centery[np.where(colMod.unitTracker == i)[0][0]][np.where(
                colMod.x == stimulusAngle)[0][0]])
Пример #9
0
def param_scan(Ksur, mod, angShiftThresh, centSurDifThresh, decoder="vmFit"):
    """Parameter scan function:
        This function makes a parameter scan on the uniform model. Beacuse maximum likelihood and von Mises fit decode the same hues in case
        of the uniform model, here the von Mises fit decoder is used due to its speed.
        
        Parameters
        ---------
        Ksur:list or array. The surround modulation curve kappa values for the scan.
        mod: list or array. Maximum surround suppression values (modulation depth) for the scan.
        angShiftThresh: list. The threshold of the maximum induced hue shift value for the scan to choose the model. It is given in the form of
        [hsb,hsu] where hsb is the lower limit of the threshold interval and hsu is the upper limit. Any model predicting a hue shift in
        this interval is chosen by the scan.
        centSurDifThresh: list. The threshold of the center surround difference value at the maximum induced hue shift for the scan to 
        choose the model. It is given in the form of [csdb,csdu] where csdb is the lower limit of the threshold interval and csdu is 
        the upper limit. Any model predicting a center surround difference in this interval is chosen by the scan.
        decoder: string, optional. The decoder to be used in the scan. von Mises fit "vmFit" is used as default. Other possiblities: 
        "vecSum" for population vector, "mL" for maximum likelihood and "maxFR" for the maximum fire rate decoder.
        
        Returns
        -------
        foundParams: dictionary. The parameter values of the model fitting to the scan criterion (Ksur,mod) as well as the maximum induced hue shift (angShift)
        and its location in form of center-surround difference angle (centSurDif) are included in the dictionary.
    """
    foundParams = {"Ksur": [], "mod": [], "centSurDif": [], "angShift": []}
    for i in range(0, len(Ksur)):
        for j in range(0, len(mod)):
            colMod = colclass.colmod(std2kappa(60, 1.4, 1.5), Ksur[i], mod[j])

            if decoder == "vecSum":
                dec = colclass.decoder.vecsum(colMod.x, colMod.resulty,
                                              colMod.unitTracker)

            if decoder == "vmFit":
                dec = colclass.decoder.vmfit(colMod.x, colMod.resulty,
                                             colMod.unitTracker)

            if decoder == "mL":
                dec = colclass.decoder.ml(colMod.x, colMod.centery,
                                          colMod.resulty, colMod.unitTracker)

            if decoder == "maxFR":
                dec = colclass.decoder.maxfr(colMod.x, colMod.resulty,
                                             colMod.unitTracker)

            if angShiftThresh[0]<=max(dec.angShift)<=angShiftThresh[1] and \
            centSurDifThresh[0]<=dec.centSurDif[np.where(dec.angShift==max(dec.angShift))[0][0]]<=centSurDifThresh[1]:
                print("found parameters matching the requierements")
                print("BINGO YOU HIT THE JACKPOT, Ksur=%s and mod=%s" %
                      (Ksur[i], mod[j]))
                print(
                    "Maximum angular shift is %s at the center surround difference of %s"
                    % (max(dec.angShift), dec.centSurDif[np.where(
                        dec.angShift == max(dec.angShift))[0][0]]))
                foundParams["Ksur"].append(Ksur[i]), foundParams["mod"].append(
                    mod[j])
                foundParams["centSurDif"].append(dec.centSurDif[np.where(
                    dec.angShift == max(dec.angShift))[0][0]])
                foundParams["angShift"].append(max(dec.angShift))
                plt.figure()
                plt.plot(dec.centSurDif, dec.angShift)
                plt.title("plot with Ksur %s and modulation depth %s" %
                          (Ksur[i], mod[j]))
                #print("Maximum angular shift is %s at the center surround difference of %s"%(max(vecSum.angShift),
                #vecSum.centSurDif[np.where(vecSum.angShift==max(vecSum.angShift))[0][0]]))
                #if 10<=max(vecSum.angShift)<=18 & 40<=vecSum.centSurDif[np.where(vecSum.angShift==max(vecSum.angShift))[0][0]]<=50:
                #print("BINGO YOU HIT THE JACKPOT, Ksur=%s and mod=%s"%(Ksur[i],mod[j]))
                while True:
                    if plt.waitforbuttonpress(0):
                        break
                plt.close()
                print("waiting for next plot...")
            else:
                print(
                    "Parameters do not match the requierements for Ksur=%s and mod=%s"
                    % (Ksur[i], mod[j]))
                continue
    return foundParams
Пример #10
0
    ax.xaxis.set_major_formatter(FormatStrFormatter('%d'))
    ax.xaxis.set_minor_locator(MultipleLocator(45))
    ax.tick_params(axis='both', which='major', labelsize=15)

ax.legend(['maxfr','totarea'], prop={"size":12})
"""
"""
Figure: population activity at 0° with and without surround modulation as well as population activity at ml best model
predicted hue bias at 0° with 0° surround.
"""
mltabest = {
    'depInt': [0.2, 0.3999999999999999],
    'bwType': 'gradient/sum',
    'stdInt': [1.2, 0.9],
    'Ksur': 2.3,
    'phase': 22.5,
    'depmod': True,
    'stdtransform': False,
    'Kcent': None,
    'maxInhRate': None
}

mltamod = col.colmod(**mltabest)
"""
FIGURES TO PUT:
Parameter distribution DONE BUT MANUAL
Best fit of both models in same plot without data DONE BUT MANUAL
Non-uniform tuning curves best fit ML DONE
Parameter scan description (methods oder first sentence of the results scan subset.)
Skype Freitag 14.00 (skype thomas.wachtler)
"""