original_docstring:  Calculation of the event correlation function using GPU
  
      :param events: 1D array of events values
      :param times: 1D array of times
      :param offsets: 1D array of offsets
      :param shape: list shape of the 2D frame
      :param nframes: int number of frame
      :param dtype: type of the events array
      :param qqmask: 2D array q mask
      :param max_nnz: maximum number frames with event
  
      :return: CorrelationResult structure with correlation functions
      
docstring: Calculation of the event correlation function using GPU
docstring_tokens: Calculation of the event correlation function using GPU
code: def gpu_ecorr_q(events, times, offsets, shape, nframes, dtype, qqmask, max_nnz):
      """ Calculation of the event correlation function using GPU
  
      :param events: 1D array of events values
      :param times: 1D array of times
      :param offsets: 1D array of offsets
      :param shape: list shape of the 2D frame
      :param nframes: int number of frame
      :param dtype: type of the events array
      :param qqmask: 2D array q mask
      :param max_nnz: maximum number frames with event
  
      :return: CorrelationResult structure with correlation functions
      """
  
      print("start calculation of the correlation functions")
      from dynamix.correlator.event import EventCorrelator
      t0 = time.perf_counter()
      qm = qqmask.max()
      res = np.zeros((qm, nframes - 1), np.float32)
      dev = np.zeros_like(res)
      E = EventCorrelator(shape, nframes, max_nnz, qmask=qqmask, dtype=dtype, total_events_count=events.size)
      result = E.correlate(times, events, offsets)
      for q in range(1, qm + 1, 1):
          print("Number of pixels for q %d is %d" % (q, E.scale_factors[q]))
          res[q - 1,:] = result[q - 1][1:]  # 1 time correlation function
          dev[q - 1,:] = result[q - 1][1:] * 1e-3  # error of the 1 time correlation function
      print("Total correlation time %2.2f sec" % (time.perf_counter() - t0))
      trc = 0
      return CorrelationResult(res, dev, trc)
code_tokens: def gpu_ecorr_q ( events , times , offsets , shape , nframes , dtype , qqmask , max_nnz ) : print ( "start calculation of the correlation functions" ) from dynamix . correlator . event import EventCorrelator t0 = time . perf_counter ( ) qm = qqmask . max ( ) res = np . zeros ( ( qm , nframes - 1 ) , np . float32 ) dev = np . zeros_like ( res ) E = EventCorrelator ( shape , nframes , max_nnz , qmask = qqmask , dtype = dtype , total_events_count = events . size ) result = E . correlate ( times , events , offsets ) for q in range ( 1 , qm + 1 , 1 ) : print ( "Number of pixels for q %d is %d" % ( q , E . scale_factors [ q ] ) ) res [ q - 1 , : ] = result [ q - 1 ] [ 1 : ] dev [ q - 1 , : ] = result [ q - 1 ] [ 1 : ] * 1e-3 print ( "Total correlation time %2.2f sec" % ( time . perf_counter ( ) - t0 ) ) trc = 0 return CorrelationResult ( res , dev , trc )
short_docstring: Calculation of the event correlation function using GPU
short_docstring_tokens: Calculation of the event correlation function using GPU
comment: """ Calculation of the event correlation function using GPU
  
      :param events: 1D array of events values
      :param times: 1D array of times
      :param offsets: 1D array of offsets
      :param shape: list shape of the 2D frame
      :param nframes: int number of frame
      :param dtype: type of the events array
      :param qqmask: 2D array q mask
      :param max_nnz: maximum number frames with event
  
      :return: CorrelationResult structure with correlation functions
      """$SEP$# 1 time correlation function$SEP$# error of the 1 time correlation function