# Path: redmapper/cluster.py
# class Cluster(Entry):
# class ClusterCatalog(Catalog):
#     def __init__(self, cat_vals=None, r0=None, beta=None, config=None, zredstr=None, bkg=None, cbkg=None, neighbors=None, zredbkg=None, dtype=None):
#     def reset(self):
#     def set_neighbors(self, neighbors):
#     def find_neighbors(self, radius, galcat, megaparsec=False, maxmag=None):
#     def update_neighbors_dist(self):
#     def clear_neighbors(self):
#     def _calc_radial_profile(self, idx=None, rscale=0.15):
#     def _calc_luminosity(self, normmag, idx=None):
#     def calc_bkg_density(self, r, chisq, refmag):
#     def calc_cbkg_density(self, r, col_index, col, refmag):
#     def calc_zred_bkg_density(self, r, zred, refmag):
#     def compute_bkg_local(self, mask, depth):
#     def calc_richness(self, mask, calc_err=True, index=None):
#     def calc_lambdacerr(self, maskgals, mstar, lam, rlam, pmem, cval, gamma):
#     def calc_richness_fit(self, mask, col_index, centcolor_in=None, rcut=0.5, mingal=5, sigint=0.05, calc_err=False):
#     def redshift(self):
#     def redshift(self, value):
#     def mstar(self):
#     def _update_mstar(self):
#     def mpc_scale(self):
#     def _update_mpc_scale(self):
#     def _compute_neighbor_r(self):
#     def copy(self):
#     def __copy__(self):
#     def __init__(self, array, **kwargs):
#     def from_catfile(cls, filename, **kwargs):
#     def zeros(cls, size, **kwargs):
#     def __getitem__(self, key):
# 
# Path: redmapper/_version.py



import yaml
import fitsio
import copy
import numpy as np
import re
import os
import logging
from esutil.cosmology import Cosmo
from .cluster import cluster_dtype_base, member_dtype_base
from ._version import __version__

        # validate the galfile and refmag
        type(self).__dict__['galfile'].validate('galfile')
        type(self).__dict__['refmag'].validate('refmag')

        # get galaxy file stats
        gal_stats = self._galfile_stats()
        self.galfile_area = gal_stats['area']
        if (self.area is not None):
            if self.depthfile is not None:
                self.logger.info("WARNING: You should not need to set area in the config file when you have a depth map.")
            if (np.abs(self.area - gal_stats['area']) > 1e-3):
                self.logger.info("Config area is not equal to galaxy file area.  Using config area.")
                gal_stats.pop('area')
        else:
            if self.depthfile is None and self.nside > 0 and len(self.hpix) > 0:
                raise RuntimeError("You must set a config file area if no depthfile is present and you are running a sub-region")
        self._set_vars_from_dict(gal_stats, check_none=True)

        if self.limmag_catalog is None:
            self.limmag_catalog = self.limmag_ref

        # Get wcen numbers if available
        self.set_wcen_vals()

        # Set some defaults
        if self.specfile_train is None:
            self.specfile_train = self.specfile

        # Record the cluster dtype for convenience

# Path: redmapper/cluster.py
# class Cluster(Entry):
# class ClusterCatalog(Catalog):
#     def __init__(self, cat_vals=None, r0=None, beta=None, config=None, zredstr=None, bkg=None, cbkg=None, neighbors=None, zredbkg=None, dtype=None):
#     def reset(self):
#     def set_neighbors(self, neighbors):
#     def find_neighbors(self, radius, galcat, megaparsec=False, maxmag=None):
#     def update_neighbors_dist(self):
#     def clear_neighbors(self):
#     def _calc_radial_profile(self, idx=None, rscale=0.15):
#     def _calc_luminosity(self, normmag, idx=None):
#     def calc_bkg_density(self, r, chisq, refmag):
#     def calc_cbkg_density(self, r, col_index, col, refmag):
#     def calc_zred_bkg_density(self, r, zred, refmag):
#     def compute_bkg_local(self, mask, depth):
#     def calc_richness(self, mask, calc_err=True, index=None):
#     def calc_lambdacerr(self, maskgals, mstar, lam, rlam, pmem, cval, gamma):
#     def calc_richness_fit(self, mask, col_index, centcolor_in=None, rcut=0.5, mingal=5, sigint=0.05, calc_err=False):
#     def redshift(self):
#     def redshift(self, value):
#     def mstar(self):
#     def _update_mstar(self):
#     def mpc_scale(self):
#     def _update_mpc_scale(self):
#     def _compute_neighbor_r(self):
#     def copy(self):
#     def __copy__(self):
#     def __init__(self, array, **kwargs):
#     def from_catfile(cls, filename, **kwargs):
#     def zeros(cls, size, **kwargs):
#     def __getitem__(self, key):
# 
# Path: redmapper/_version.py



# Path: redmapper/configuration.py
import yaml
import fitsio
import copy
import numpy as np
import re
import os
import logging
from esutil.cosmology import Cosmo
from .cluster import cluster_dtype_base, member_dtype_base
from ._version import __version__


        # validate the galfile and refmag
        type(self).__dict__['galfile'].validate('galfile')
        type(self).__dict__['refmag'].validate('refmag')

        # get galaxy file stats
        gal_stats = self._galfile_stats()
        self.galfile_area = gal_stats['area']
        if (self.area is not None):
            if self.depthfile is not None:
                self.logger.info("WARNING: You should not need to set area in the config file when you have a depth map.")
            if (np.abs(self.area - gal_stats['area']) > 1e-3):
                self.logger.info("Config area is not equal to galaxy file area.  Using config area.")
                gal_stats.pop('area')
        else:
            if self.depthfile is None and self.nside > 0 and len(self.hpix) > 0:
                raise RuntimeError("You must set a config file area if no depthfile is present and you are running a sub-region")
        self._set_vars_from_dict(gal_stats, check_none=True)

        if self.limmag_catalog is None:
            self.limmag_catalog = self.limmag_ref

        # Get wcen numbers if available
        self.set_wcen_vals()

        # Set some defaults
        if self.specfile_train is None:
            self.specfile_train = self.specfile

        # Record the cluster dtype for convenience

        self.cluster_dtype = copy.copy(cluster_dtype_base)