code: def array_to_schedule(array, events, slots):
      
      scheduled = np.transpose(np.nonzero(array))
      return [
          ScheduledItem(event=events[item[0]], slot=slots[item[1]])
          for item in scheduled
      ]
docs: Convert a schedule from array to schedule form
  
      Parameters
      ----------
      array : np.array
          An E by S array (X) where E is the number of events and S the
          number of slots. Xij is 1 if event i is scheduled in slot j and
          zero otherwise
      events : list or tuple
          of :py:class:`resources.Event` instances
      slots : list or tuple
          of :py:class:`resources.Slot` instances
  
      Returns
      -------
      list
          A list of instances of :py:class:`resources.ScheduledItem`