code: def binarize_rdp(netin, level, sign='pos', axis='time'):
      
      netin, netinfo = process_input(netin, ['C', 'G', 'TO'])
      trajectory = rdp(netin, level)
  
      contacts = []
      # Use the trajectory points as threshold
      for n in range(trajectory['index'].shape[0]):
          if sign == 'pos':
              sel = trajectory['trajectory_points'][n][trajectory['trajectory']
                                                       [n][trajectory['trajectory_points'][n]] > 0]
          elif sign == 'neg':
              sel = trajectory['trajectory_points'][n][trajectory['trajectory']
                                                       [n][trajectory['trajectory_points'][n]] < 0]
          else:
              sel = trajectory['trajectory_points']
          i_ind = np.repeat(trajectory['index'][n, 0], len(sel))
          j_ind = np.repeat(trajectory['index'][n, 1], len(sel))
          contacts.append(np.array([i_ind, j_ind, sel]).transpose())
      contacts = np.concatenate(contacts)
  
      # Create output dictionary
      netout = dict(netinfo)
      netout['contacts'] = contacts
      netout['nettype'] = 'b' + netout['nettype'][1]
      netout['dimord'] = 'node,node,time'
      netout['timetype'] = 'discrete'
      netout['diagonal'] = 0
      # If input is graphlet, output graphlet
      if netinfo['inputtype'] == 'G':
          netout = contact2graphlet(netout)
      else:
          netout.pop('inputtype')
  
      return netout
docs: Binarizes a network based on RDP compression.
  
      Parameters
      ----------
  
      netin : array or dict
          Network (graphlet or contact representation),
      level : float
          Delta parameter which is the tolorated error in RDP compression.
      sign : str, default='pos'
          States the sign of the thresholding. Can be 'pos', 'neg' or 'both'. If "neg", only negative values are thresholded and vice versa.
  
      Returns
      -------
  
      netout : array or dict (dependning on input)
          Binarized network