SpHr_Histogram [ Flags ] srcWaveName, destWaveName


Obtains Histograms for values along rows of srcWaveName so that destWaveName has the same higher dimensions as srcWaveName. The /Sym or /Span flag must be specified.


Parameters

srcWaveName  Specification for single precision source matrix.


srcWaveName(startX, endX)  Specifies an x-range in the source wave.


srcWaveName[startP,endP] Specifies a point-range in the source wave.


destWaveName  Histograms are written to the wave specified by destWaveName. The wave is single precision and always overwritten.


Flags

/Sym = { binXstart, numBins }

    Symmetric histogram - equal number of negative and positive x-axis values to each side of zero.

    binXstart - first negative histogram bin value.

    numBins - number of histogram bins. An odd number sets the central bin to zero. An even number results in bins surrounding zero.


/Span = { binXstart, binXend, numBins }

    binXstart - first histogram bin value.

    binXend- last histogram bin value.

    numBins - number of histogram bins.


/IQR = { numBins [, numQs ] }

    Histograms are obtained for values between the 1st and 3rd quartiles of all srcWaveName values.

    numBins - number of histogram bins.

    numQs - if specified, the first and last bins are set as:

    first bin = median - ((median-Q25)*numQs). 

    last bin = median + ((Q75-median)*numQs). 


/C [ = c ]    Histogram x-scaling is shifted for bars or cityscapes, i.e., x-scale offset -= dimdelta(w,0)/2.

    /c=1, Same as /C alone. Histogram x-scaling is shifted.

    /c=0: Same as no /C.


/Norm [ = n ]    Normalize histograms.

    /n=1, Same as /Norm alone. Histograms normalized to a maximum of 1.

    /n=0: Same as no /Norm at all.


/Wt = WtsSrcWaveName

    Specification for a single precision wave of histogram weights. WtsSrcWaveName must have the same dimensions as srcWaveName.


/Pk [ = peakDestWaveName ]

    If srcWaveName consists of more than one column, layer, or chunk, the height of each histogram's peak is written to the wave specified by peakDestWaveName. If peakDestWaveName is omitted, the name of srcWaveName is used and the suffix "_Peaks" is added. If the wave specified by srcWaveName consists no columns the peak of the single histogram is written to a variable named V_Peak. If the /Norm flag is present, peaks are obtained prior to the normalization.


/PkX [ = peakLocDestWaveName ]

    If srcWaveName consists of more than one column, layer, or chunk, the X-axis locations of each histogram's peak is written to the wave specified by peakLocDestWaveName. If peakLocDestWaveName is omitted, the name of srcWaveName is used with the suffix "_PeakLocs". If the wave specified by srcWaveName consists no columns the peak of the single histogram is written to a variable named V_PeakLoc.


/Tr [ = troughDestWave ]

    If srcWaveName consists of more than one column, layer, or chunk, the bottom of each histogram's trough is written to the wave specified by troughDestWave. If troughDestWave is omitted, the name of srcWaveName is used with the suffix "_Troughs". If the wave specified by srcWaveName consists no columns the trough of the single histogram is written to a variable named V_Trough.


/TrX [ = troughLocDestWave ]

    If srcWaveName consists of more than one column, layer, or chunk, the X-axis locations of each histogram's trough is written to the wave specified by troughLocDestWave. If troughLocDestWave is omitted, the name of srcWaveName is used with the suffix "_TroughLocs". If the wave specified by srcWaveName consists no columns the peak of the single histogram is written to a variable named V_TroughLoc.


Example

Function SpHr_Histogram_Example()

    variable fs = 48000

    variable ITD = 0.2 // ms

    // Partially independent noise burst with 0.2 ms ITD

    SpHr_SignalBinaural/sec=1/Ramp=20/dB=70/HP=50/Buff={100,100}/Sp=1/Ind=0.1/ITD={ITD,1} fs, Noise

    SpHr_FilterCenterFreqs/R/Type=(2) 300, 600, 3, CFs // log

    SpHr_FilterBankBiquadCoefs 48000, CFs, coefBank

    SpHr_FilterBankBiquad /RMS/Dest=FilterBanks CFs, coefBank, Noise

    killwaves/Z coefBank, Noise

    SpHr_CrossingCarrierCues/ITD=ITDs CFs, FilterBanks

    SpHr_Histogram /Sym={-0.00075,201} ITDs, ITDs_Hist

    Display /K=1/W=(35,45,430,253) as "ITD Histograms"

    AppendToGraph ITDs_Hist[*][0],ITDs_Hist[*][1],ITDs_Hist[*][2]

    ModifyGraph mode=6

    ModifyGraph rgb(ITDs_Hist)=(0,0,65535),rgb(ITDs_Hist#1)=(2,39321,1)

    ModifyGraph zero(bottom)=1

    ModifyGraph fSize=10,axThick=0.5,zeroThick(bottom)=0.5

    ModifyGraph ZisZ=1,zapTZ=1,zapLZ=1

    ModifyGraph btLen=4,btThick=0.5,stLen=2,stThick=0.5

    Label bottom "ITD (\\U)"

    SetDrawLayer UserFront

    SetDrawEnv xcoord= bottom,ycoord= prel,linethick= 0.5,dash= 2

    DrawLine 0.0002,0,0.0002,1

    TextBox/C/N=text0/F=0/B=1/H={15,0,5}/A=LT "\\Z10Frequency (Hz)\r\\s(ITDs_Hist) 300\r\\s(ITDs_Hist#1) 424\r\\s(ITDs_Hist#2) 500"

End

Contact: Brian