Coverage for python/lsst/sims/maf/metrics/summaryMetrics.py : 87%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# A collection of metrics which are primarily intended to be used as summary statistics.
'NormalizeMetric', 'ZeropointMetric', 'TotalPowerMetric']
""" Metrics based on a specified area, but returning NVISITS related to area: given Asky, what is the minimum and median number of visits obtained over that much area? (choose the portion of the sky with the highest number of visits first).
Parameters ---------- col : str or list of strs, opt Name of the column in the numpy recarray passed to the summary metric. Asky : float, opt Area of the sky to base the evaluation of number of visits over. Default 18,0000 sq deg. nside : int, opt Nside parameter from healpix slicer, used to set the physical relationship between on-sky area and number of healpixels. Default 128. Nvisit : int, opt Number of visits to use as the benchmark value, if choosing to return a normalized Nvisit value. norm : boolean, opt Normalize the returned "nvisit" (min / median) values by Nvisit, if true. Default False. metricName : str, opt Name of the summary metric. Default fONv. """ norm=False, metricName='fONv', **kwargs): """Asky = square degrees """ # Determine how many healpixels are included in Asky sq deg.
return self.badval # Find the Asky's worth of healpixels with the largest # of visits. result['value'] /= float(self.Nvisit)
""" Metrics based on a specified number of visits, but returning AREA related to Nvisits: given Nvisit, what amount of sky is covered with at least that many visits?
Parameters ---------- col : str or list of strs, opt Name of the column in the numpy recarray passed to the summary metric. Nvisit : int, opt Number of visits to use as the minimum required -- metric calculated area that has this many visits. Default 825. Asky : float, opt Area to use as the benchmark value, if choosing to returned a normalized Area value. Default 18,0000 sq deg. nside : int, opt Nside parameter from healpix slicer, used to set the physical relationship between on-sky area and number of healpixels. Default 128. norm : boolean, opt Normalize the returned "area" (area with minimum Nvisit visits) value by Asky, if true. Default False. metricName : str, opt Name of the summary metric. Default fOArea. """ norm=False, metricName='fOArea', **kwargs): """Asky = square degrees """
# Identify the healpixels with more than Nvisits. result = self.badval else: result /= float(self.Asky)
""" Count the completeness (for many fields) and summarize how many fields have given completeness levels (within a series of bins). Works with completenessMetric only.
This metric is meant to be used as a summary statistic on something like the completeness metric. The output is DIFFERENT FROM SSTAR and is: element matching values 0 0 == P 1 0 < P < .1 2 .1 <= P < .2 3 .2 <= P < .3 ... 10 .9 <= P < 1 11 1 == P 12 1 < P Note the 1st and last elements do NOT obey the numpy histogram conventions. """ """ colname = the column name in the metric data (i.e. 'metricdata' usually). nbins = number of bins between 0 and 1. Should divide evenly into 100. """ # set this so runSliceMetric knows masked values should be set to zero and passed
# Calculate histogram of completeness values that fall between 0-1. # Fill in values for exact 0, exact 1 and >1. # Create labels for each value # Package the names and values up
""" Return the metric value itself .. this is primarily useful as a summary statistic for UniSlicer metrics. """ result = dataSlice[self.colname][0] else:
""" Return a metric values divided by 'normVal'. Useful for turning summary statistics into fractions. """ return result[0] else:
""" Return a metric values with the addition of 'zp'. Useful for altering the zeropoint for summary statistics. """ return result[0] else:
""" Calculate the total power in the angular power spectrum between lmin/lmax. """
# Calculate the power spectrum. else: cl = hp.anafast(dataSlice[self.colname]) |