# spacepy.empiricals.omniFromDirectionalFlux

spacepy.empiricals.omniFromDirectionalFlux(fluxarr, alphas, norm=True)

  Calculate omnidirectional flux [(s cm^2 kev)^-1] from directional flux [(s sr cm^2 keV)^-1] array

  J = 2.pi integ(j sin(a) da) If kwarg ‘norm’ is True (default), the omni flux is normalized by 4.pi to make it per steradian, in line with the PRBEM guidelines

  Parameters:
    fluxarr arraylike

      Array of directional flux values

    alphas arraylike

      Array of pitch angles corresponding to fluxarr

  Returns:
    omniflux float

      Omnidirectional flux value

  Examples

  Roundtrip from omni flux, to directional flux (Vampola model), integrate to get back to omni flux.

      >>> from spacepy.empiricals import vampolaPA, omniFromDirectionalFlux
      >>> dir_flux, pa  = vampolaPA(3000, alpha=range(0,181,2), order=4)
      >>> dir_flux[:10], pa[:10]
      (array([  0.00000000e+00,   6.64032473e-04,   1.05986545e-02,
            5.34380898e-02,   1.67932162e-01,   4.06999226e-01,
            8.36427502e-01,   1.53325140e+00,   2.58383611e+00,
            4.08170975e+00]), [0, 2, 4, 6, 8, 10, 12, 14, 16, 18])
      >>> omniFromDirectionalFlux(dir_flux, pa, norm=False)
      3000.0000008112293

  Calculate “spin-averaged” flux, giving answer per steradian

      >>> omniFromDirectionalFlux(dir_flux, pa, norm=True)
      238.73241470239859