nifty7.library.los_response module

class LOSResponse(domain, starts, ends, sigmas=None, truncation=3.0)[source]

Bases: nifty7.operators.linear_operator.LinearOperator

Line-of-sight response operator

This operator transforms from a single RGSpace to an UnstructuredDomain with as many entries as there were lines of sight passed to the constructor. Adjoint application is also provided.

Parameters
  • domain (RGSpace or DomainTuple) – The operator’s input domain. This must be a single RGSpace.

  • starts (numpy.ndarray(float) with two dimensions) – Arrays containing the start and end points of the individual lines of sight. The first dimension must have as many entries as domain has dimensions. The second dimensions must be identical for both arrays and indicated the total number of lines of sight.

  • ends (numpy.ndarray(float) with two dimensions) – Arrays containing the start and end points of the individual lines of sight. The first dimension must have as many entries as domain has dimensions. The second dimensions must be identical for both arrays and indicated the total number of lines of sight.

  • sigmas (numpy.ndarray(float) (optional)) – If this is not None, the inverse of the lengths of the LOSs are assumed to be Gaussian distributed with these sigmas. The start point will remain the same, but the endpoint is assumed to be unknown. This is a typical statistical model for astrophysical parallaxes. The LOS response then returns the expected integral over the input given that the length of the LOS is unknown and therefore the result is averaged over different endpoints. Default: None.

  • truncation (float (optional)) – Use only if the sigmas keyword argument is used! This truncates the probability of the endpoint lying more sigmas away than the truncation. Used to speed up computation and to avoid negative distances. It should hold that 1./(1./length-sigma*truncation)>0 for all lengths of the LOSs and all corresponding sigma of sigmas. If unsure, leave blank. Default: 3.

Notes

starts, `ends, sigmas, and truncation have to be identical on every calling MPI task (i.e. the full LOS information has to be provided on every task).

apply(x, mode)[source]

Applies the Operator to a given x, in a specified mode.

Parameters
  • x (Field) – The input Field, defined on the Operator’s domain or target, depending on mode.

  • mode (int) –

    • TIMES: normal application

    • ADJOINT_TIMES: adjoint application

    • INVERSE_TIMES: inverse application

    • ADJOINT_INVERSE_TIMES or INVERSE_ADJOINT_TIMES: adjoint inverse application

Returns

The processed Field defined on the Operator’s target or domain, depending on mode.

Return type

Field

apply_erf(wgt, dist, lo, mid, hi, sig, erf)[source]