Histogram function - Python

Looking for someone who can explain this to me:

phase = mod(phase,Nper*2*pi)
cl_phase = arange(0,Nper*2*pi+step,step)
c,p = histogram(phase,cl_phase)

while 0 in c:
    step = step*2
    cl_phase = arange(0,Nper*2*pi+step,step)
    c,p = histogram(phase,cl_phase)

Where phase is the phase of a wave, Nper is the number of periods I'm analysing.

What I want to know is if some one can give me the name/link to an explanation of the histogram function..! Im not even sure from what package it comes from. Maybe numpy? Or maybe it even is a function that comes with python..! Super lost here..!

Any help here would be greatly appreciated!!

Upvotes: 0

Views: 128

Answers (1)

Abhyuday Vaish
Abhyuday Vaish

Reputation: 2379

histogram() function is from numpy library. It doesn't come as a default function in Python.

You can use it by:

import numpy as np
np.histogram(phase,cl_phase)

In your code, it looks like you are using it as:

from numpy import histogram
histogram(phase,cl_phase)

c,p = histogram(phase, cl_phase) will give you two values as output. c will be the values of the histogram, and p will return the bin edges. You should take a look at the above docs for more info.

Upvotes: 1

Related Questions