def extract_mfd(dstore, what):
    """
    Display num_ruptures by magnitude for event based calculations.
    Example: http://127.0.0.1:8800/v1/calc/30/extract/event_based_mfd
    """
    dd = collections.defaultdict(int)
    for rup in dstore['ruptures'].value:
        dd[rup['mag']] += 1
    dt = numpy.dtype([('mag', float), ('freq', int)])
    magfreq = numpy.array(sorted(dd.items(), key=operator.itemgetter(0)), dt)
    return magfreq