C version - Methods
- class glow.freq_domain_c.Fw_FFT_C(It, p_prec={})
Bases:
FwGeneral_C
Computation of the amplification factor as the FFT of \(I(\tau)\).
This class uses the information about the images stored in
p_crits
to regularize the time-domain integral:\[I_\text{reg}(\tau) \equiv I(\tau) - I_\text{sing}(\tau)\]where \(I_\text{sing}(\tau)\) is analytical and depends on the images. This regular part is then Fourier transformed (with a FFT) to obtain \(F_\text{reg}(w)\). Finally, we add back the (analytical) Fourier transform of the singular part, \(F_\text{sing}(w)\), to get the amplification factor:
\[F(w) = F_\text{reg}(w) + F_\text{sing}(w)\]Additional information: theory, default parameters.
(Only new parameters and attributes are documented. See
FwGeneral_C
for the internal information of the parent class)- Parameters:
- p_precdict, optional
Precision parameters. New keys:
wmin
,wmax
(float) – Minimum and maximum frequencies to be computed.window_transition
(float) – Width of the Tukey window function.smallest_tau_max
(float) – Ensure that \(I(\tau)\) is always computed, at least, up to this value.eval_mode
(str) – Behaviour ofeval_Fw()
, to compute \(F(w)=F_\text{reg}(w)+F_\text{sing}(w)\). In both cases, \(F_\text{reg}\) is computed with a FFT on a grid and then evaluated using an interpolation function. The two options control how \(F_\text{sing}\) is computed.'interpolate'
: \(F_\text{sing}(w)\) is precomputed on the same grid as \(F_\text{reg}\), and then evaluated using an interpolation function.'exact'
: \(F_\text{sing}(w)\) is evaluated analytically for each \(w\).
FFT method
(str) – The options are:'standard'
: Perform a single FFT. When the frequency range is very large, this method can become very time-consuming and noisy.'multigrid'
: Perform independent FFTs, with varying time resolution, and patch them together.
N_above_discard
,N_below_discard
,N_keep
(int) – Parameters used with the'multigrid'
option. In this mode, the frequency range is divided into \(n = \frac{1}{N_\text{keep}}\log(w_\text{max}/w_\text{min})\) intervals of frequency, logarithmically spaced. We then perform \(n\) independent FFTs in these intervals. To reduce the errors at high and low frequencies we actually perform the FFT in each interval starting from higher and lower frequencies (that are later discarded). The actual size of each of the FFTs is \(\log_2(N_{FFT}) = N_\text{below} + N_\text{keep} + N_\text{above}\).parallel
(bool) – Perform the computation in parallel (one FFT per thread).
- Attributes:
- w_gridarray
Grid of frequencies where the FFT has been computed.
- Fw_reg_gridarray
FFT of the regular part of the time-domain integral, i.e. \(F_\text{reg}(w)\).
- Fw_gridarray
If we are working in the inteporlation mode,
Fw_grid
stores the grid of values that will be used for interpolation. Otherwise it contains zeroes.
Methods
compute
()Computation of \(F(w)\).
(subclass defined) Initialize the default parameters.
Get internal information about the multigrid method.
- default_params()
(subclass defined) Initialize the default parameters.
- get_FreqTable()
Get internal information about the multigrid method.
- Returns:
- freq_tabledict
Each entry in this dictionary contains a list, whose length corresponds to the number of FFTs that have been computed in the multigrid method. The available information is:
n_fft
(list of int) – Size of each FFT performed.n_fft_keep
(list of int) – Number of points actually used in the final result.df
(list of float) – Frequency resolution.dtau
(list of float) – Time resolution.wmin_real
,wmax_real
(list of float) – Frequency range of the FFT.wmin_batch
,wmax_batch
(list of float) – Range of frequencies kept for the final result.tau_max
(list of float) – Maximum \(\tau\) where \(I_\text{reg}(\tau)\) has been evaluated.
- compute()
Computation of \(F(w)\).
- Returns:
- w_grid, Fw_grid, Fw_reg_gridarray
Grids with the frequencies, \(F(w)\) and its regular part.
- class glow.freq_domain_c.Fw_SemiAnalyticSIS_C(y, p_prec={}, psi0=1)
Bases:
FwGeneral_C
Semi-analytic computation of the amplification factor for the SIS.
To arrive at this result, the radial integral is first solved analitically and then the angular integral is performed numerically.
Additional information: theory, default parameters.
- Parameters:
- yfloat
Impact parameter.
- psi0float
Normalization of the SIS lensing potential, \(\psi(x)=\psi_0 x\).
- p_precdict, optional
Precision parameters. New keys:
parallel
(bool) – Perform the evaluation in parallel.method
(str) – Method used for the integration. Options:'direct'
: It can be faster in some regions of the parameter space, but it cannot be used for high frequencies.'osc'
: Special method adapted for oscillatory integrals.
Methods
compute
(w)Computation of \(F(w)\).
(subclass defined) Initialize the default parameters.
- default_params()
(subclass defined) Initialize the default parameters.
- compute(w)
Computation of \(F(w)\).
- Parameters:
- wfloat or array
Dimensionless frequency \(w\).
- Returns:
- Fwcomplex or array
\(F(w)\).
- class glow.freq_domain_c.Fw_AnalyticPointLens_C(y, p_prec={})
Bases:
FwGeneral_C
Analytic computation of the amplification factor for the point lens.
Additional information: theory, default parameters.
(Only new parameters and attributes are documented. See
FwGeneral_C
for the internal information of the parent class)- Parameters:
- yfloat
Impact parameter.
- p_precdict, optional
Precision parameters. New keys:
parallel
(bool) – Perform the evaluation in parallel.
Methods
compute
(w)Computation of \(F(w)\).
(subclass defined) Initialize the default parameters.
- default_params()
(subclass defined) Initialize the default parameters.
- compute(w)
Computation of \(F(w)\).
- Parameters:
- wfloat or array
Dimensionless frequency \(w\).
- Returns:
- Fwcomplex or array
\(F(w)\).
- class glow.freq_domain_c.Fw_DirectFT_C(It, p_prec={})
Bases:
FwGeneral_C
Direct Fourier transform of \(I(\tau)\).
If we compute \(I(\tau)\) on a grid and approximate it as a linear interpolation function, its Fourier transform can be easily computed analitically. This method will be generally slower than
Fw_FFT_C
, but its accuracy can be easily controlled by improving the sampling of \(I(\tau)\).In this case no grid of frequencies is precomputed, so the evaluation is performed exactly at each point \(w\).
Additional information: theory, default parameters.
(Only new parameters and attributes are documented. See
FwGeneral_C
for the internal information of the parent class)- p_precdict, optional
Precision parameters. New keys:
parallel
(bool) – Perform the evaluation in parallel.
Methods
compute
(w)Computation of \(F(w)\).
(subclass defined) Initialize the default parameters.
- default_params()
(subclass defined) Initialize the default parameters.
- compute(w)
Computation of \(F(w)\).
- Parameters:
- wfloat or array
Frequency \(w\).
- Returns:
- Fw, Fw_regfloat or array
\(F(w)\) and its regular part.