# Path: cora/core/maps.py
# class Map2d(object):
# class Map3d(Map2d):
# class Sky3d(Map3d):
#     def like_map(cls, mapobj, *args, **kwargs):
#     def _width_array(self):
#     def _num_array(self):
#     def x_pixels(self):
#     def y_pixels(self):
#     def nside(self):
#     def nside(self, value):
#     def like_map(cls, mapobj, *args, **kwargs):
#     def _width_array(self):
#     def _num_array(self):
#     def nu_num(self):
#     def nu_num(self, num):
#     def frequencies(self):
#     def frequencies(self, freq):
#     def like_kiyo_map(cls, mapobj, *args, **kwargs):
#     def angular_powerspectrum(self, l, nu1, nu2):
#     def mean_nu(self, freq):
#     def getfield(self):
#     def getsky(self):
#     def getpolsky(self):
#     def getalms(self, lmax):
# 
# Path: cora/util/fftutil.py
# def rfftfreqn(n, d=None):
# def rfftn(arr):
# def irfftn(arr):
# 
# Path: cora/util/units.py
# G = 6.6742e-11


import numpy as np
import math
from cora.core import maps
from cora.util import fftutil, units
        from cora.util.cubicspline import LogInterpolater
            from os.path import dirname, join

        Notes
        -----
        Frequencies are in terms of wavenumber. That is the positive
        frequencies for one axis are:
        ```
        0, 2*math.pi / self._w[0], 2 * 2*math.pi / self._w[0], 3 * 2*math.pi / self._w[0]....
        ```
        """
        raise Exception("Abstract method: need to override.")

    def generate_kweight(self, regen=False):
        r"""Pregenerate the k weights array.

        Parameters
        ==========
        regen : boolean, optional
            If True, force regeneration of the weights, to be used if
            parameters have been changed,
        """

        # Perform some sanity checks
        self._check_input()

        # If already generated return array now.
        if self._kweightgen == True and not regen:
            return

        spacing = self._w / self._n


# Path: cora/core/maps.py
# class Map2d(object):
# class Map3d(Map2d):
# class Sky3d(Map3d):
#     def like_map(cls, mapobj, *args, **kwargs):
#     def _width_array(self):
#     def _num_array(self):
#     def x_pixels(self):
#     def y_pixels(self):
#     def nside(self):
#     def nside(self, value):
#     def like_map(cls, mapobj, *args, **kwargs):
#     def _width_array(self):
#     def _num_array(self):
#     def nu_num(self):
#     def nu_num(self, num):
#     def frequencies(self):
#     def frequencies(self, freq):
#     def like_kiyo_map(cls, mapobj, *args, **kwargs):
#     def angular_powerspectrum(self, l, nu1, nu2):
#     def mean_nu(self, freq):
#     def getfield(self):
#     def getsky(self):
#     def getpolsky(self):
#     def getalms(self, lmax):
# 
# Path: cora/util/fftutil.py
# def rfftfreqn(n, d=None):
# def rfftn(arr):
# def irfftn(arr):
# 
# Path: cora/util/units.py
# G = 6.6742e-11


# Path: cora/core/gaussianfield.py
import numpy as np
import math
from cora.core import maps
from cora.util import fftutil, units
        from cora.util.cubicspline import LogInterpolater
            from os.path import dirname, join


        Notes
        -----
        Frequencies are in terms of wavenumber. That is the positive
        frequencies for one axis are:
        ```
        0, 2*math.pi / self._w[0], 2 * 2*math.pi / self._w[0], 3 * 2*math.pi / self._w[0]....
        ```
        """
        raise Exception("Abstract method: need to override.")

    def generate_kweight(self, regen=False):
        r"""Pregenerate the k weights array.

        Parameters
        ==========
        regen : boolean, optional
            If True, force regeneration of the weights, to be used if
            parameters have been changed,
        """

        # Perform some sanity checks
        self._check_input()

        # If already generated return array now.
        if self._kweightgen == True and not regen:
            return

        spacing = self._w / self._n


        kvec = fftutil.rfftfreqn(self._n, spacing / (2 * math.pi))