class rubin_sim.maf.metrics.StarDensityMetric(mag_limit=25.0, filtername='r', units='stars/sq arcsec', maps=['StellarDensityMap'], **kwargs)

Bases: BaseMetric

Interpolate the stellar luminosity function to return the number of stars per square arcsecond brighter than the mag_limit. Note that the map is built from CatSim stars in the range 20 < r < 28. mag_limit values outside that the range of the map’s starMapBins will return self.badval

The stellar density maps are available in any bandpass, but bandpasses other than r band must use a pre-configured StellarDensityMap (not just the default). In other words, when setting up the metric bundle for an i-band stellar density using (as an example) a HealpixSlicer: ` map = maf.StellarDensityMap(filtername='i') metric = maf.StarDensityMetric(filtername='i', mag_limit=25.0) slicer = maf.HealpixSlicer() bundle = maf.MetricBundle(metric, slicer, "", mapsList=[map]) `

mag_limitfloat, opt

Magnitude limit at which to evaluate the stellar luminosity function. Returns number of stars per square arcsecond brighter than this limit. Default 25.

filternamestr, opt

Which filter to evaluate the luminosity function in; Note that using bands other than r will require setting up a custom (rather than default) version of the stellar density map. Default r.

unitsstr, opt

Units for the output values. Default “stars/sq arcsec”.

mapslist of str, opt

Names for the maps required. Default “StellarDensityMap”.


Number of stars brighter than mag_limit in filtername, based on the stellar density map.

Methods Summary

run(data_slice[, slice_point])

Calculate metric values.

Methods Documentation

run(data_slice, slice_point=None)

Calculate metric values.


Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

slice_pointdict or None

Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

metricValue: int float or object

The metric value at each slice_point.