code: def convert_to_array(pmap, nsites, imtls, inner_idx=0):
      
      lst = []
      # build the export dtype, of the form PGA-0.1, PGA-0.2 ...
      for imt, imls in imtls.items():
          for iml in imls:
              lst.append(('%s-%s' % (imt, iml), F32))
      curves = numpy.zeros(nsites, numpy.dtype(lst))
      for sid, pcurve in pmap.items():
          curve = curves[sid]
          idx = 0
          for imt, imls in imtls.items():
              for iml in imls:
                  curve['%s-%s' % (imt, iml)] = pcurve.array[idx, inner_idx]
                  idx += 1
      return curves
docs: Convert the probability map into a composite array with header
      of the form PGA-0.1, PGA-0.2 ...
  
      :param pmap: probability map
      :param nsites: total number of sites
      :param imtls: a DictArray with IMT and levels
      :returns: a composite array of lenght nsites