code: def frequency2phase(freqdata, rate):
      
      dt = 1.0 / float(rate)
      # Protect against NaN values in input array (issue #60)
      # Reintroduces data trimming as in commit 503cb82
      freqdata = trim_data(freqdata)
      phasedata = np.cumsum(freqdata) * dt
      phasedata = np.insert(phasedata, 0, 0) # FIXME: why do we do this?
      # so that phase starts at zero and len(phase)=len(freq)+1 ??
      return phasedata
docs: integrate fractional frequency data and output phase data
  
      Parameters
      ----------
      freqdata: np.array
          Data array of fractional frequency measurements (nondimensional)
      rate: float
          The sampling rate for phase or frequency, in Hz
  
      Returns
      -------
      phasedata: np.array
          Time integral of fractional frequency data, i.e. phase (time) data
          in units of seconds.
          For phase in units of radians, see phase2radians()