# 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/core/skysim.py
# def clarray(aps, lmax, zarray, zromb=3, zwidth=None):
# def mkfullsky(corr, nside, alms=False, rng=None):
# def mkconstrained(corr, constraints, nside):
# 
# Path: cora/util/hputil.py
# def ang_positions(nside):
# def nside_for_lmax(lmax, accuracy_boost=1):
# def unpack_alm(alm, lmax, fullm=False):
# def pack_alm(almarray, lmax=None):
# def _make_full_alm(alm_half, centered=False):
# def _make_half_alm(alm_full):
# def sphtrans_real(hpmap, lmax=None, lside=None):
# def sphtrans_complex(hpmap, lmax=None, centered=False, lside=None):
# def sphtrans_real_pol(hpmaps, lmax=None, lside=None):
# def sphtrans_complex_pol(hpmaps, lmax=None, centered=False, lside=None):
# def sphtrans_inv_real(alm, nside):
# def sphtrans_inv_real_pol(alm, nside):
# def sphtrans_inv_complex(alm, nside):
# def sphtrans_sky(skymap, lmax=None):
# def sphtrans_inv_sky(alm, nside):
# def coord_x2y(map, x, y):
# def coord_g2c(map_):
# def coord_c2g(map_):
# def sph_ps(map1, map2=None, lmax=None):
# 
# Path: cora/foreground/gaussianfg.py
# class ForegroundMap(maps.Sky3d):
# class ForegroundSCK(ForegroundMap):
# class Synchrotron(ForegroundSCK):
# class ExtraGalacticFreeFree(ForegroundSCK):
# class GalacticFreeFree(ForegroundSCK):
# class PointSources(ForegroundSCK):
#     def angular_ps(self, l):
#     def frequency_covariance(self, nu1, nu2):
#     def angular_powerspectrum(self, l, nu1, nu2):
#     def generate_weight(self, regen=False):
#     def getfield(self):
#     def angular_ps(self, larray):
#     def frequency_covariance(self, nu1, nu2):
#     def frequency_variance(self, nu):
#     def frequency_correlation(self, nu1, nu2):
#     def frequency_correlation_dlog(self, dlognu):
#     def angular_correlation(self, tarray):
#             def cf(theta):
#     A = 7.00e-4
#     A = 1.40e-8
#     A = 8.80e-8
#     A = 5.70e-5


from os.path import join, dirname
from cora.core import maps, skysim
from cora.util import hputil
from cora.foreground import gaussianfg
import numpy as np
import healpy

        # Bump up the variance of the fluctuations according to the variance map
        vm = healpy.smoothing(fg[0], sigma=np.radians(0.5), verbose=False)
        vm = healpy.smoothing(
            map_variance(vm, 16) ** 0.5, sigma=np.radians(2.0), verbose=False
        )
        mv = vm.mean()

        # Construct the fluctuations map
        fgt = (am / mv) * (fg - fgs)

        if not debug:
            del fg, fgs

        # Get the smooth, large scale emission from Haslam+spectralmap
        fgsmooth = haslam[np.newaxis, :] * ((efreq / 408.0)[:, np.newaxis] ** sc)

        # Rescale to ensure output is always positive, do this inplace where
        # possible to save memory
        def tanh_lin(x):
            return np.where(x < 0, np.tanh(x), x)

        fgt /= fgsmooth
        fgt = tanh_lin(fgt)
        fgt += 1
        fgt *= fgsmooth
        fgt = fgt[2:]

        # Co-ordinate transform if required
        if celestial:

# 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/core/skysim.py
# def clarray(aps, lmax, zarray, zromb=3, zwidth=None):
# def mkfullsky(corr, nside, alms=False, rng=None):
# def mkconstrained(corr, constraints, nside):
# 
# Path: cora/util/hputil.py
# def ang_positions(nside):
# def nside_for_lmax(lmax, accuracy_boost=1):
# def unpack_alm(alm, lmax, fullm=False):
# def pack_alm(almarray, lmax=None):
# def _make_full_alm(alm_half, centered=False):
# def _make_half_alm(alm_full):
# def sphtrans_real(hpmap, lmax=None, lside=None):
# def sphtrans_complex(hpmap, lmax=None, centered=False, lside=None):
# def sphtrans_real_pol(hpmaps, lmax=None, lside=None):
# def sphtrans_complex_pol(hpmaps, lmax=None, centered=False, lside=None):
# def sphtrans_inv_real(alm, nside):
# def sphtrans_inv_real_pol(alm, nside):
# def sphtrans_inv_complex(alm, nside):
# def sphtrans_sky(skymap, lmax=None):
# def sphtrans_inv_sky(alm, nside):
# def coord_x2y(map, x, y):
# def coord_g2c(map_):
# def coord_c2g(map_):
# def sph_ps(map1, map2=None, lmax=None):
# 
# Path: cora/foreground/gaussianfg.py
# class ForegroundMap(maps.Sky3d):
# class ForegroundSCK(ForegroundMap):
# class Synchrotron(ForegroundSCK):
# class ExtraGalacticFreeFree(ForegroundSCK):
# class GalacticFreeFree(ForegroundSCK):
# class PointSources(ForegroundSCK):
#     def angular_ps(self, l):
#     def frequency_covariance(self, nu1, nu2):
#     def angular_powerspectrum(self, l, nu1, nu2):
#     def generate_weight(self, regen=False):
#     def getfield(self):
#     def angular_ps(self, larray):
#     def frequency_covariance(self, nu1, nu2):
#     def frequency_variance(self, nu):
#     def frequency_correlation(self, nu1, nu2):
#     def frequency_correlation_dlog(self, dlognu):
#     def angular_correlation(self, tarray):
#             def cf(theta):
#     A = 7.00e-4
#     A = 1.40e-8
#     A = 8.80e-8
#     A = 5.70e-5


# Path: cora/foreground/galaxy.py
from os.path import join, dirname
from cora.core import maps, skysim
from cora.util import hputil
from cora.foreground import gaussianfg
import numpy as np
import healpy


        # Bump up the variance of the fluctuations according to the variance map
        vm = healpy.smoothing(fg[0], sigma=np.radians(0.5), verbose=False)
        vm = healpy.smoothing(
            map_variance(vm, 16) ** 0.5, sigma=np.radians(2.0), verbose=False
        )
        mv = vm.mean()

        # Construct the fluctuations map
        fgt = (am / mv) * (fg - fgs)

        if not debug:
            del fg, fgs

        # Get the smooth, large scale emission from Haslam+spectralmap
        fgsmooth = haslam[np.newaxis, :] * ((efreq / 408.0)[:, np.newaxis] ** sc)

        # Rescale to ensure output is always positive, do this inplace where
        # possible to save memory
        def tanh_lin(x):
            return np.where(x < 0, np.tanh(x), x)

        fgt /= fgsmooth
        fgt = tanh_lin(fgt)
        fgt += 1
        fgt *= fgsmooth
        fgt = fgt[2:]

        # Co-ordinate transform if required
        if celestial:

            fgt = hputil.coord_g2c(fgt)