Exemple #1
0
 def __init__(self, world):
     # call base
     Metric.__init__(self, world)
     self.name = "compressibility"
     self.value = 0.0
     self.format = "%.2f%%"
     self.co = zlib.compressobj()
Exemple #2
0
 def __init__(self, world):
     # call base
     Metric.__init__(self, world)
     self.name = "exploration"
     self.value = 0.0
     self.format = "%.2f%%"
     # dictionary mapping hashes to ticks used for cycle detection
     self.rule_count = np.zeros(self.world.rule.size, dtype=int)
Exemple #3
0
 def __init__(self, world):
     # call base
     Metric.__init__(self, world)
     self.name = "cyclic"
     self.value = False
     # dictionary mapping hashes to ticks used for cycle detection
     self.hist = {}
     self.cycle_start = None
     self.cycle_period = None
Exemple #4
0
 def __init__(self, name, fn):
     Metric.__init__(self, name)
     self._fn = fn
     return
Exemple #5
0
 def __init__(self, world):
     # call base
     Metric.__init__(self, world)
     self.name = "population"
     self.value = self.world.get_population()
Exemple #6
0
 def __init__(self, name):
     Metric.__init__(self, name)
     self._count = 0
     return
Exemple #7
0
    def __init__(self, ministry, zbins=None, magbins=None,
                  catalog_type=['galaxycatalog'], tag=None,
                  appmag=True, lower_limit=True, cutband=None,
                  normed=True, selection_dict=None, **kwargs):
        """
        Angular Number density of objects as a function of redshift.

        inputs
        --------
        ministry - Ministry

        keywords
        ------
        zbins - np.array
          An array containing the edges of the redshift bins to use for dn/dz
        lower_limit - boolean
          Whether or not the magnitudes in magbins should be interpreted
          as bin edges or lower limits of cuts (i.e. mag<magbins[i])
        magbins - np.array
          A list of magnitudes to use as bin edges or lower limits of cuts
        catalog_type - list
          A list of catalog types, ususally not used
        tag - string
          A name for the metric to be used when making comparisons using bb-compare
        appmag - boolean
          True if we want to use apparent magnitude for cuts, false for absolute magnitudes
        cutband - int
          The index of the column of a vector of magnitudes to use
        normed - boolean
          Whether the metric integrates to N/deg^2 or not. Usually want True.
        """
        Metric.__init__(self, ministry, tag=tag, **kwargs)

        self.catalog_type = catalog_type

        if zbins is None:
            self.zbins = np.linspace(0, 2.0, 61)
        else:
            self.zbins = zbins
            self.zbins = np.array(self.zbins)

        self.nzbins = len(self.zbins)-1

        if appmag:
            self.mkey = 'appmag'
            defmbins = np.array([18, 19, 20, 21])
        else:
            self.mkey = 'luminosity'
            defmbins = np.array([-24, -23, -22, -21])

        if cutband is None:
            self.cutband = 0
        else:
            self.cutband = cutband

        self.lower_limit = lower_limit

        if magbins is None:
            self.magbins = [None]
            self.nmagbins = 0
            self.nomags = True
        else:
            self.nomags = False
            self.magbins = magbins
            if self.lower_limit:
                self.nmagbins = len(self.magbins)
            else:
                self.nmagbins = len(self.magbins) - 1

        self.normed = normed
        self.aschema = 'galaxyonly'

        if self.nmagbins > 0:
            self.mapkeys = [self.mkey, 'redshift']
            self.unitmap = {self.mkey :'mag'}
        else:
            self.mapkeys = ['redshift']
            self.unitmap = {}

        #Make selection dict here
        if (selection_dict is None) & lower_limit:
            selection_dict = {'mag':{'selection_type':'cut1d',
                                    'mapkeys':['appmag'],
                                    'bins':self.magbins,
                                    'selection_ind':self.cutband,
                                    'lower':True}}
        elif (selection_dict is None):
            selection_dict = {'mag':{'selection_type':'binned1d',
                                    'mapkeys':['appmag'],
                                    'bins':self.magbins,
                                    'selection_ind':self.cutband}}

        nmkeys = []
        for s in selection_dict:
            if 'mapkeys' in selection_dict[s]:
                ss = selection_dict[s]
                for m in ss['mapkeys']:
                    if m not in self.mapkeys:
                        self.mapkeys.append(m)
                    if m not in self.unitmap:
                        self.unitmap[m] = self.defaultUnits(m)

        self.zcounts = None
        self.selector = Selector(selection_dict)
Exemple #8
0
 def __init__(self, world):
     # call base
     Metric.__init__(self, world)
     self.name = "patterns"
     self.value = 0