API Reference
This page summarizes the callable interfaces and the main implementation
functions in the current wlcov source tree. The stable user interfaces are
the command-line executable and the wlcovpy.wlcov Cython class. The C
functions are useful for developers who are extending the code or checking the
wrapper declarations.
Command-Line Interface
- Executable
./wlcov- Help
./wlcov --help- Parameter file
./wlcov paramfile=path/to/parameters.txt- Power-spectrum input
clsfile=path/to/two-column-table.txt
See Command-Line Usage for the complete parameter table.
Python Module
- class wlcovpy.wlcov(default=False)
Cython wrapper around the compiled C core. The wrapper builds a CLASS-style in-memory parameter file, validates that all supplied parameters were read, calls the C initialization and integration routines, and exposes selected results back to Python.
- Parameters:
default (bool) – If true, initialize wrapper defaults before user parameters are added. The current default is
False.
- pars
Dictionary of parameters currently staged for the next run.
- state
Lightweight readiness flag. It currently returns
True.
- set(*pars, **kwargs)
Add or update runtime parameters. Parameters may be supplied as one mapping positional argument or as keyword arguments.
model.set({"clsfile": "tests/input/Cls_ep2.txt", "ellmax": 25}) model.set(verbose=0, verbose_log=0)
- Run(level=['EndRun'])
Execute the requested C routine chain. The default runs input parsing, common initialization, parameter-file writing, thread setup,
MainLoop, andEndRun. Returns measuredMainLoopCPU time.
- clean()
Clear the Python-side parameter dictionary.
- struct_cleanup()
Release allocated C-side command and global-data state when a run has partially or fully initialized those structures.
- clean_all()
Release allocated C-side state and clear Python-side parameters.
- abi_sizes()
Return the
cmdline_dataandglobal_datasizes reported by the C library. The wrapper checks these sizes during construction to catch stalecwlcovpy.pxddeclarations.
- getNThreads()
Return the parsed thread count after
Runhas initialized the C structures.
- getIntegral()
Return the final radial integral stored in
global_data.intval.
Wrapper Exceptions
- exception wlcovpy.CosmoError
Base wrapper exception.
- exception wlcovpy.CosmoSevereError
Raised for invalid wrapper calls, unread parameters, ABI mismatches, or string values that cannot be safely copied into C buffers.
- exception wlcovpy.CosmoComputationError
Raised when an initialized C stage returns
FAILURE.
C Entry Points
The public C prototypes are declared in include/protodefs.h and related
addon headers.
Function |
Purpose |
|---|---|
|
Initialize command-line and global structures from process arguments or a parameter file. |
|
Shared initialization used by both the executable and |
|
Write the used-values parameter file into the configured output directory. |
|
Configure OpenMP threads when compiled with |
|
Open output/log paths after runtime directories are prepared. |
|
Execute the weak-lensing covariance numerical workflow and store the
final integral in |
|
Close logs, print final timing information, and release state that must not outlive a run. |
|
Free dynamically allocated command-parameter strings. |
|
Free dynamically allocated global-data strings. |
|
Return the C compiler’s size for |
|
Return the C compiler’s size for |
Numerical Integration Helpers
The following functions are implemented in source/wlcov.c. They are
currently internal implementation details rather than a stable public C library
API, but they are useful orientation points for contributors.
Function |
Purpose |
|---|---|
|
Interpolate the tabulated angular power spectrum |
|
Evaluate the integrand for the two-point function term
|
|
Numerically integrate |
|
Evaluate the coupled |
|
Integrate the coupled multipole contribution for a pair of angular scales. |
|
Evaluate the single- |
|
Integrate the single- |
|
Evaluate the single- |
|
Integrate the single- |
|
Combine |
|
Thin wrapper around the GSL integer-order Bessel function routine. |
|
Small utility functions used when selecting integration scales. |
Input and Parser Helpers
The CLASS-style parser lives in addons/class_lib and is used by the Python
wrapper and parameter-file path.
Function |
Purpose |
|---|---|
|
Resolve a parameter file path against the current run context. |
|
Set the root path used for resolving relative input files. |
|
Read a parsed |
|
Dispatch parameter parsing across the core code and enabled addons. |
|
Parse common parameters such as |
|
Populate command defaults when the wrapper is constructed. |
|
Load a text parameter file into key/value records. |
|
Read typed scalar values from the parsed records. |
|
Read typed list values from parameter records. |
|
Validate an option string against an allowed option list. |
Optional Cosmology Addon
addons/cosmo_lib is present in this source tree but disabled by default
with COSMOLIBON = 0 in addons/Makefile_addons_settings. When enabled,
it adds cosmology parameters and helper functions for growth factors, distance
grids, lensing kernels, and C_ell construction.
Function |
Purpose |
|---|---|
|
Initialize cosmology-addon state. |
|
Compute background quantities for the configured cosmology. |
|
Build a convergence power-spectrum table from cosmological inputs. |
|
Read the linear matter power-spectrum table. |
|
Read a galaxy-window table as a function of comoving distance. |
|
Evaluate the linear growth factor and its integrand. |
|
Build distance-grid arrays for quadrature. |
|
Compute the lensing kernel used by the addon. |
|
Interpolate or evaluate the configured power spectrum. |
Example-Script Functions
The scripts in tests/python are examples rather than installed package
modules, but they are documented here because they are useful starting points
for analysis workflows.
Function |
Purpose |
|---|---|
|
Run one compact wrapper calculation and return |
|
Copy a two-column |
|
Build a boolean mask for selected covariance-matrix entries. |
|
Convert a mask into row/column index pairs. |
|
Run one wrapper integral for a selected pair of angular scales. |
|
Build a symmetric covariance matrix by repeatedly calling
|