parameters: (h, K)
return_statement: return pool
docstring: Select (up to) K random segmented reads from the dataset `h`. Return as a dictionary of pooled scaled samples
      of form { <REGION_NAME> :: str -> <SAMPLES> :: NDArray(float) }.
docstring_summary: Select (up to) K random segmented reads from the dataset `h`. Return as a dictionary of pooled scaled samples
      of form { <REGION_NAME> :: str -> <SAMPLES> :: NDArray(float) }.
docstring_tokens: Select ( up to ) K random segmented reads from the dataset h . Return as a dictionary of pooled scaled samples of form { <REGION_NAME > :: str - > <SAMPLES > :: NDArray ( float ) } .
function: def pool_reads(h, K):
      """
      Select (up to) K random segmented reads from the dataset `h`. Return as a dictionary of pooled scaled samples
      of form { <REGION_NAME> :: str -> <SAMPLES> :: NDArray(float) }.
      """
      # collect scaled samples for each state:
      pool = defaultdict(list)
      rnames = random.sample(h['scaled'].keys(), min(K, len(h['scaled'].keys())))
      for rid in tqdm(rnames):
          try:
              assert(len(h['scaled'][rid]) == len(h['states'][rid]))
              for k in range(len(h['states'][rid])):
                  pool[ h['states'][rid][k] ].append( h['scaled'][rid][k] )
          except:
              pass
  
      # process into a dict of numpy arrays and return:
      pool = dict(pool)
      for k, v in pool.items():
          pool[k] = np.array(v)
      return pool
function_tokens: def pool_reads ( h , K ) : # collect scaled samples for each state: pool = defaultdict ( list ) rnames = random . sample ( h [ 'scaled' ] . keys ( ) , min ( K , len ( h [ 'scaled' ] . keys ( ) ) ) ) for rid in tqdm ( rnames ) : try : assert ( len ( h [ 'scaled' ] [ rid ] ) == len ( h [ 'states' ] [ rid ] ) ) for k in range ( len ( h [ 'states' ] [ rid ] ) ) : pool [ h [ 'states' ] [ rid ] [ k ] ] . append ( h [ 'scaled' ] [ rid ] [ k ] ) except : pass # process into a dict of numpy arrays and return: pool = dict ( pool ) for k , v in pool . items ( ) : pool [ k ] = np . array ( v ) return pool