def to_psf3d(self, rad=None):
    'Create a PSF3D from an analytical PSF.\n\n        Parameters\n        ----------\n        rad : `~astropy.units.u.Quantity` or `~astropy.coordinates.Angle`\n            the array of position errors (rad) on which the PSF3D will be defined\n\n        Returns\n        -------\n        psf3d : `~gammapy.irf.PSF3D`\n            the PSF3D. It will be defined on the same energy and offset values than the input psf.\n        '
    offsets = self.offset_axis.center
    energy = self.energy_axis_true.center
    if (rad is None):
        rad = (np.linspace(0, 0.66, 67) * u.deg)
    rad_axis = MapAxis.from_edges(rad, name='rad')
    shape = (self.energy_axis_true.nbin, self.offset_axis.nbin, rad_axis.nbin)
    psf_value = (np.zeros(shape) * u.Unit('sr-1'))
    for (idx, offset) in enumerate(offsets):
        table_psf = self.to_energy_dependent_table_psf(offset)
        psf_value[:, idx, :] = table_psf.evaluate(energy, rad_axis.center)
    return PSF3D(energy_axis_true=self.energy_axis_true, rad_axis=rad_axis, offset_axis=self.offset_axis, data=psf_value, meta=self.meta.copy())
Create a PSF3D from an analytical PSF.

Parameters
----------
rad : `~astropy.units.u.Quantity` or `~astropy.coordinates.Angle`
    the array of position errors (rad) on which the PSF3D will be defined

Returns
-------
psf3d : `~gammapy.irf.PSF3D`
    the PSF3D. It will be defined on the same energy and offset values than the input psf.
def to_psf3d(self, rad=None):
    'Create a PSF3D from an analytical PSF.\n\n        Parameters\n        ----------\n        rad : `~astropy.units.u.Quantity` or `~astropy.coordinates.Angle`\n            the array of position errors (rad) on which the PSF3D will be defined\n\n        Returns\n        -------\n        psf3d : `~gammapy.irf.PSF3D`\n            the PSF3D. It will be defined on the same energy and offset values than the input psf.\n        '
    offsets = self.offset_axis.center
    energy = self.energy_axis_true.center
    if (rad is None):
        rad = (np.linspace(0, 0.66, 67) * u.deg)
    rad_axis = MapAxis.from_edges(rad, name='rad')
    shape = (self.energy_axis_true.nbin, self.offset_axis.nbin, rad_axis.nbin)
    psf_value = (np.zeros(shape) * u.Unit('sr-1'))
    for (idx, offset) in enumerate(offsets):
        table_psf = self.to_energy_dependent_table_psf(offset)
        psf_value[:, idx, :] = table_psf.evaluate(energy, rad_axis.center)
    return PSF3D(energy_axis_true=self.energy_axis_true, rad_axis=rad_axis, offset_axis=self.offset_axis, data=psf_value, meta=self.meta.copy())