pygwtf.fresnel.kernel
=====================

.. py:module:: pygwtf.fresnel.kernel


Functions
---------

.. autoapisummary::

   pygwtf.fresnel.kernel.analytic_kernel_constructor


Module Contents
---------------

.. py:function:: analytic_kernel_constructor(config: dict, _get_amplitude: Callable, _get_phi_f_fdot: Callable, _get_channels: Callable, compute_statistic: bool = False, tdi_type: int | None = None)

   Constructor method used to generate a kernel function for computing Fresnel waveforms and derived inner-product statistics (d_h and h_h).

   Parameters:
   ----------
   config: dict
       Configuration dictionary containing the following keys:
       - dT: float, the duration of each time segment.
       - nF: int, the number of frequency bins.
       - dF: float, the width of each frequency bin.
       - kernel_width: int, the number of frequency bins on either side of the central frequency to include in the kernel computation.
       - nparams: int, the number of parameters describing each source. This is used to allocate local arrays in the GPU kernel.

   Following are waveform specific functions, and can be substituted for any waveform written in the same format.    
   _get_amplitude: Callable
       Function that takes in time, frequency, frequency derivative, and source parameters, and returns the amplitude of h_22 at that time.
   _get_phi_f_fdot: Callable
       Function that takes in time and source parameters, and returns the phase, frequency, and frequency derivative of h_22 at that time.

   Generalised "Response function/Channel construction" method. 
   Can be either a frequency domain response function, or a function within the waveform itself that returns the waveform polarizations. 
   Frequency domain response function can in principle be substituted for any response function in the frequency domain (within time-segment)
   _get_channels: Callable
       Function that takes in frequency-domain (within each time-segment) waveforms, in the format h_lm and 
           - either transforms to TDI channels using the detector response. 
           - or converts to waveform polarizations h_+ and h_x in the frequency domain and returns that. 
       
   kernel_cpu: Callable
       A CPU kernel function that can be called to compute Fresnel waveforms and statistics.
   kernel_gpu: Callable
       A GPU kernel function that can be called to compute Fresnel waveforms and statistics.

   Returns:
   -------
   kernel_cpu: Callable
       A CPU kernel function that can be called to compute Fresnel waveforms and statistics.
   kernel_gpu: Callable
       A GPU kernel function that can be called to compute Fresnel waveforms and statistics.



