Bases: object
The catalog module handles a galaxy catalog consisting out of coordinates, ellipticities, weights and tomographic bins for each galaxy. Main functionalities: Can rotate the catalog on the sky, output survey mask, weight maps, shear and convergence maps. The convergence maps are calculated from the shear maps using spherical Kaiser-Squires. Also allows generation of shape noise catalogs or shape noise maps using random rotation of the galaxies in place. Can also pass additional scalar and obtain maps for these.
The most important functionalities are:
rotate_catalog:
Allows to rotate the survey on the sky by given angles. The spin-2 ellipticity field can also be rotated by the appropriate angle.
get_mask:
Returns the survey mask as a binary Healpix (Gorski et al. 2005) map.
get_map:
Can return Healpix shear maps, convergence maps or a weight map (number of galaxies per pixel). The convergence map is calculated from the ellipticities of the galaxies using the spherical Kaiser-Squires routine (Wallis et al. 2017). The shear and convergence maps are weighted by the galaxy weights.
generate_shape_noise_map:
Generates a shape noise Healpix shear map by random rotation of the galaxies ellipticities in place. The weights are considered in the generation of the noise.
The accepted keywords are:
NSIDE:
default: 1024
choices: an integer being a power of 2
The Healpix resolution that is used to produce the map products.
degree:
default: True
choices: True, False
If True the coordinates are assumed to be given in degrees otherwise in radians.
colat:
default: False
choices: True, False
If True the second coordinate is assumed to be a co-latitude otherwise a normal latitude is assumed.
prec:
default: 32
choices: 64, 32, 16
Size of the float values in the Healpix maps in bits. For less then 32 hp.UNSEEN is mapped to -inf -> No RAM optimization anymore
Clips ellipticities at a provided value. All objects exceeding sqrt(e1^2+e2^2) > clip_value are removed.
clip_value – The maximum absolute values of the ellipticities that is allowed
Generates shape noise which resembles the noise in the original catalog by randomly rotating the ellipticities in place.
seed – Seeding for the random generation of the rotation.
bin – Redshift bin to use (0=full sample)
fields – Can also provide a list of fields to randomize. If two field names are given as a list they are intrepreted as the two components of a spin-2 field and rotated like the ellipticities, otherwise a scalar field is assumed and the noise is drawn from its global distribution.
input_fields – Provide list of fields directly instead of using internal fields.
The new randomized fields
Generates shape noise maps. :param seed: Seeding for the random generation of the rotation :param pix: Alternative operation mode. Uses the stored pixel catalogs instead of the actual coordinates(-1 not used, greater or equal than 0 indicates the map to use) :param bin: Redshift bin to use (0=full sample) :param normalize: If True the maps are normalized by the sum of all object weights per pixel. :param fields: Can also provide a list of fields to randomize. If two field names are given as a list they are intrepreted as the two components of a spin-2 field and rotated like the ellipticities, otherwise a scalar field is assumed and the noise is drawn from its global distribution. :return: Two shape noise maps.
Returns the coordinates of the catalog objects
bin – Indicate the redshift bin of the objects which should be returned. If 0 all bins are used.
Returns the ellipticities of the catalog objects
bin – Indicate the redshift bin of the objects which should be returned. If 0 all bins are used.
Creates number count, weight, shear and convergence maps or custom field map from the catalog. Can optionally rotate the catalog before map creation. :param type: Can be counts, weights, ellipticities, convergence, a custom field or a list of them. Indicates types of the maps that are returned. The object weights are applied in the creation of all the maps except for the counts and weights map. Note that ellipticities and convergence return two maps each (e1, e2) and (E, B) respectively. :param bin: Redshift bin to use (0=full sample) :param alpha_rot: The angle along the first coordinates to rotate :param delta_rot: The angle along the second coordinates to rotate :param pix: Alternative operation mode. Uses the stored pixel catalogs instead of the actual coordinates (-1 not used, greater or equal than 0 indicates the instance to use) :param trimming: If True applies stricter masking to convergence map (some values on edges of survey mask can be very off due to spherical harmonics transformation). :param mirror: If True mirrors coordinates on equator :param normalize: If True all maps except for the counts and weights maps are normalized by the sum of all object weights per pixel. :param method: Mass mapping method for convergence maps. At the moment can only be KS (Kaiser-Squires). :return: The desired maps in a list (map1, map2, …)
Returns binary survey mask. Can optionally rotate catalog on sky.
bin – Redshift bin to use (0=full sample)
alpha_rot – The angle along the first coordinates to rotate
delta_rot – The angle along the second coordinates to rotate
mirror – If True mirrors coordinates on equator
A Healpix mask (0 outside and 1 inside of mask)
Returns the pixel of each object, all unique pixels where the objects are located and the object indices in each pixel. Can optionally rotate the catalog before returning products.
bin – Redshift bin to use (0=full sample)
alpha_rot – The angle along the first coordinates to rotate
delta_rot – The angle along the second coordinates to rotate
pix – Alternative operation mode. Uses the stored pixel catalogs instead of the actual coordinates (-1 not used, greater or equal than 0 indicates the map to use)
mirror – If True mirrors coordinates on equator
Three lists containing the different pixelization information
Returns the shears of the catalog objects
pix_key – If multiple rotated versions of the original catalog are stored can access them with the pix_key index. Only works if store_pix was set to True.
bin – Indicate the redshift bin of the objects which should be returned. If 0 all bins are used.
Returns the redshift bins of the catalog objects
bin – Indicate the redshift bin of the objects which should be returned. If 0 all bins are used.
Given a Healpix mask creates a trimmed mask, meaning it removes some pixels which are distored by edge effects in shear->convergence procedure. Optionally allows rotation of catalog.
bin – Redshift bin to use (0=full sample)
alpha_rot – The angle along the first coordinates to rotate
delta_rot – The angle along the second coordinates to rotate
mirror – If True mirrors coordinates on equator
accepted_error – Maximum fractional error of pixels after smoothing for trimming
smoothing – FWHM of Gaussian kernel for smoothing in arcmin.
The trimmed Healpix mask
Returns the weights of the catalog objects
bin – Indicate the redshift bin of the objects which should be returned. If 0 all bins are used.
Rotates the galaxy coordinates on the sky. Can overwrite coordinates or just store the pixel coordinates of the rotated survey.
alpha_rot – The angle along the first coordinates to rotate (in radians)
delta_rot – The angle along the second coordinates to rotate (in radians)
store_pixels – If False the old coordinates are overwritten. If True old coordinates are conserved and only the pixel numbers of the rotated objects are stored in self.pixels. Allows holding many rotated catalogs without requiring too much memory.
mirror – If True mirrors all coordinates on the equator
rotate_ellipticities – If True rotates the ellipticities as well. Only supported for store_pixels=False and mirror=False.
Sets coordinate arrays :param alphas: First coordinates :param deltas: Second coordinates :param pixels: Alternatively can pass list of pixels instead of angular coordinates
Sets elliticity arrays
e1s – First ellipticity component
e2s – Second ellipticity component
Bases: object
Class meant to perform parameter inference based on predictions of the data-vectors and covariance matrices at different parameter configurations.
The main functionality is to calculate the negative logarithm of the likelihood at a given parameter configuration given a measurement data-vector.
The parameter space is broken down into two parts called parameters and nuisances, that are treated differently.
For the parameter part it is assumed that the space is sampled densly with simulations and an emulator is built from the simulations.
For the nuisances it is assumed that only delta simulations at the fiducial parameter configuration are available where only this one parameters is varied. In this case polynomial scaling relations are fitted for each bin of the data vector that are used to describe the influence of the parameter when predicting the statistic. This implicitly assumes that these parameters are independent from all other parameters.
The data vectors can also be compressed using PCA or MOPED compression.
The most important functionalities are:
readin_interpolation_data:
Loads data used for interpolation. The data is expected to be in a format as used by the estats.summary module.
convert_to_PCA_space:
Builds PCA compression and converts all data vectors to PCA space. All output will be in PCA space afterwards.
convert_to_MOPED_space:
Builds MOPED compression and converts all data vectors to MOPED space. Requires emulator to be built before. All output will be in MOPED space afterwards.
build_emulator:
Builds the emulator for the parameter space used to interpolate the expected data-vectors between different parameter configurations. There are three different choices for the type of interpolator used at the moment: linear: Uses N-Dimensional linear interpolator GPR: Gaussian Process Regressor NN: Neural network
build_scalings:
Builds the polynomial scaling realtions for the nuisance parameters individually for each data bin. A polynomial function is fitted for each bin and each nuisance parameter.
get_neg_loglikelihood:
Returns negative logarithmic likelihood given a measurement data-vector at the location in parameter space indicated.
The accepted keywords are:
statistic:
default: Peaks
choices: name of one of the statistic plugins
Decides which statistic plugin to use. In the likelihood module only the filter function is used from the plugin.
parameters:
default: [Om, s8]
choices: list of strings
The names of the parameters to consider
parameter_fiducials:
default: [0.276, 0.811]
choices: list of floats
The default values of the parameters. Used to decide on the fiducial covariance matrix if no interpolation of the covariance matrix is used.
nuisances:
default: [IA, m, z]
choices: list of strings
The names of the nuisance parameters to consider
nuisance_fiducials:
default: [0.0, 0.0, 0.0]
choices: list of floats
The default values of the nuisance parameters. Used to decide on the fiducial covariance matrix if no interpolation of the covariance matrix is used.
n_tomo_bins:
default: 3
choices: integer
The number of tomographic bins considered. Only needed if the special emulator is used or a statistic with the name Cross in it.
cross_ordering:
default: []
choices: a list of labels
Indicates the order of the tomographic bin labels that is assumed in the filter function.
The labels could be bin1xbin2 for example, and the corresponding cross_ordering could be [1x1, 1x2, 2x2, 2x3, 3x3].
multi_bin:
default: [False, True, True]
choices: A boolean list
Indicates if a nuisance parameter in nuisances is a global parameter (False) or a corresponding parameter should be introduced for each tomographic bin (True).
Build the interpolator for the parameters used to interpolate between different parameter setups. The interpolator is buit for all parameters and nuisances with nuisance_mode set to full. The different interpolation methods are multi and GP (Gaussian process).
interpolation_mode – Either linear (N-Dim linear interpolator), GPR (Gaussian process regressor) or NN (neural network)
selector – Can provide a boolean array to preselect the mean datavectors to be considered for the construction of the interpolator
GPR_kernel – Can provide a scikit kernel that is used to build the GPR. By default a RBF kernel is used.
GP_cache_file – Optional path to a pickle file loading premade GPR interpolators. If a path is provided that does not exist the built interpolator will be cached there.
scales – Can pass a list of scales for the RBF kernel for the GPR. Default is none and the scales are optimized using cross validation. If scales is passed the RBF(scales, ‘fixed’) kernel is used.
NN_cache_file – Can provide path to a cache file holding pretrained network weights
pos_drop – Position of dropout layer in the NN. If negative no dropout is used.
n_epochs – Number of epochs for NN training.
batchsize – Batchsize used in NN training.
learning_rate – Adam learning rate used in NN training.
droprate – Dropout rate used by the dropout layer.
n_neurons – Number of neurons for each layer.
load_weights – If True attempts to load pretrained NN weights from the cache file.
activation – Activation funtion for the hidden layers.
l2reg – If positive is interpreted as the fractional contribution of L2 regularizer or the hidden layers to the loss function.
Uses the fiducial data vector realisations to build the precision matrix. :param check_inversion: If True performs some stability checks for the inversion. :param neglect_correlation: If True all off-diagonal elements in the cov matrix are set to 0.
Builds the emulators for the nuisance parameters individually for each data bin that have mode fiducial or marginal. Fits a polynomial for each nuisance individually (assuming each nuisance parameter to be independent of the other ones and the parameters).
selector – Can provide a boolean array to preselect the mean datavectors to be considered for the construction of the emulator.
fitting – Method used for fitting. Format is nd-poly, where n indicates the degree of the polynomial to fit.
Clear out large arrays that are no longer needed after emulator and interpolator are built.
Builds MOPED compression matrix. All results are returned in MOPED space afterwards.
check_inversion – If True checks numerical stability of inversion of the fiducial covariance matrix
neglect_correlation – Reduces the covariance matrix to its diagonal before inverting.
build_precision_matrix – To build precision matrix from fdicuial_data_path realisations.
MOPED_matrix – Can pass MOPED compression matrix directly instead of building it.
incremental_values – Need to calculate numerical derivatives. This dictionary defines the incremental values used to calculate the derivatives in each parameter direction.
Builds PCA compression matrix. All results are returned in MOPED space afterwards.
PCA_cache_path – Alternatively provide PCA basis directly via pickle file. If path does not exist will cache built basis to there.
inc_var – Amount of variance included in the PCA in percent.
truncate – Maximum number of PCA components to keep. Overrides inc_var.
build_precision_matrix – To build precision matrix from fdicuial_data_path realisations.
check_inversion – If True checks numerical stability of inversion of the fiducial covariance matrix
neglect_correlation – Reduces the covariance matrix to its diagonal
partial_PCA – If True builds a PCA compression for each statistic otherwise builds a single one for the whole statistic (only used in case of a combined statistic)
Predict interpolated datavector at a parameter configuration.
params: Dictionary or list of paramters for filtering.
Interpolated data vector
Access the mean data vectors stored.
params: Dictionary or list of paramters for filtering.
Original means
Access the meta data table
params: Dictionary or list of paramters for filtering.
(Filtered) meta data
Returns negative loglikelihood given a measurement data vector at the location in parameter space indicated by params. Can also pass a mean data vector directly to test. :param params: List/Dictionary of the parameters at which to calculate the neg loglikelihood :param measurement: The measurement data vector to compare to :param mean: Test data vector instead of calculating the expected datavector from the emulator. :param debias: If True use likelihood considering estimated precision matrix and data vectors :param evaluate_prior: If True adds the prior to the likelihood :param prior_mode: Either emcee or polychord (polychord requires a different kind of prior) :return: Negative loglikelihood
Loads data used for interpolation. The data is expected to be in a format as used by the estats.summary module
means_path – Path to file holding mean datavectors for each cosmology or the data array directly. Shape: (realisations, length of data)
meta_path – Path to file holding meta data table or the data array directly. Shape: (realisations, number of meta data entries)
error_path – Path to file holding error vectors or the data array directly. Shape: (realisations, length of data)
check_inversion – If True checks numerical stability of inversion of the fiducial covariance matrix
fiducial_data_path – Can readin a file containing realisations at the fiducial parameter setting to build covariance matrix from there.
chosen_bins – If a list of strings is passed, they indicate the bins that are considered. For example: [1x1, 1x2, 3x4]
neglect_correlation – Reduces the covariance matrix to its diagonal before inverting.
filter – Can provide a custom filter function instead of using the one built using the plugins.
build_precision_matrix – To build precision matrix from fdicuial_data_path realisations.
reduce_to_selected_scales – If True reduces the datavetor by applying the filter function in the stats plugin.
parameters – Reduce parameters to passed set of parameters.
nuisances – Reduce nuisances to passed set of nuisances.
normalizer_cache – Path to pickle cache file. Normalizers are loaded from there and saved to there.
normalize_input – If True input features are normalized.
normalize_output – If True output features are normalized.
Bases: object
The map module handles shear and convergence maps and calculates summary statistics from them.
The summary statistics are defined via plugins that are located in the estats.stats folder. This allows users to easily add their own summary statistic without having to modify the internals of the code. See the Implementing your own summary statistic Section to learn how to do that.
The summary statistics can be calculated from the shear maps, the convergence maps or from smoothed convergence maps (multiscale approach for extraction of non-Gaussian features).
If only one set of weak lensing maps is given the statistics will be calculated from that set directly. If two sets are given and the name of the statistic to be computed contains the word Cross both sets are passed to the statistics plugin. This can be used to calculate cross-correlations between maps from different tomographic bins for example. In the case of a multiscale statictics the maps are convolved into a cross-correlated map. If the statitic to compute contains the word Full all maps are passed over.
The most important functionalities are:
convert_convergence_to_shear:
Uses spherical Kaiser-Squires to convert the internal shear maps to convergence maps. The maps are masked using the internal masks. By default the trimmed mask is used to allow the user to disregard pixels where the spherical harmonics transformation introduced large errors.
convert_shear_to_convergence:
Uses spherical Kaiser-Squires to convert the internal E-mode convergence map to shear maps. The maps are masked using the internal masks. By default the trimmed mask is used to allow the user to disregard pixels where the spherical harmonics transformation introduced large errors.
smooth_maps:
Applies a Gaussian smoothing kernel to all internal convergence maps (E- and B-modes). The fwhm parameter decides on the FWHM of the Gaussian smoothing kernel. It is given in arcmin.
calc_summary_stats:
Main functionality of the module. Allows to use statistics plugins located in the estats.stats folder to calculate map based statistics.
See the Implementing your own summary statistic Section to learn how the statistics plugins look like and how to make your own one.
The summary statistics can be calculated from the shear maps, the convergence maps or from a smoothed convergence maps (multiscale approach for extraction of non-Gaussian features).
Instead of using the internal masks for masking, extra masks can be used. This allows to use maps with multiple survey cutouts on it and select a different cutout each time the function is called.
If use_shear_maps is set to True the function will convert the shear maps into convergence maps using spherical Kaiser-Squires instead of using the convergence maps directly.
If copy_obj is set to False, no copies of the internal maps are made. This can save RAM but it also leads to the internal maps being overwritten. If you wish to use the internal maps after the function call set this to True!
By default the function returns the calculated statistics in a dictionary. But if write_to_file is set to True it will append to files that are defined using the defined_parameters, undefined_parameters, output_dir and name arguments using ekit.paths.
The accepted keywords are:
NSIDE:
default: 1024
choices: an integer being a power of 2
The Healpix resolution that is used to produce the map products.
scales:
default: [31.6, 29.0, 26.4, 23.7, 21.1, 18.5, 15.8, 13.2, 10.5, 7.9, 5.3, 2.6]
choices: A list of floats indicating the FWHM of the Gaussian smoothing kernels to be applied in arcmin.
For summary statistics that are of the multi type (see Implementing your own summary statistic) the summary statistics are extracted from the convergence maps for a number of scales (multiscale approach). To do so the maps are smoothed with Gaussian smoothing kernels of different size. The scales indicate the FWHM of these scales.
polarizations:
default: ‘A’
choices: ‘E’, ‘B’, ‘A’
If E only returns E-mode statistics only when calc_summary_stats is used. If B only returns B-mode statistics only when calc_summary_stats is used. If A both E- and B-mode statistics are returned when calc_summary_stats is used.
prec:
default: 32
choices: 64, 32, 16
Size of the float values in the Healpix maps in bits. For less then 32 hp.UNSEEN is mapped to -inf -> No RAM optimization anymore
Calculates the summary statistics from the maps Can provide a mask or trimmed_mask which will be used instead of the internal masks, allowing to store multiple cutouts on a single map (can save memory)
statistics – Statistcs to calculate.
mask – Can provide an additional mask, otherwise internal mask used
trimmed_mask – Can provide an additional trimmed mask
scales – Smoothing scales to apply for multiscale analysis for Non-Gaussian statistics (multi type) (FWHM in arcmins). If not given uses internal scales from context
use_shear_maps – If set to True will calculate convergence maps from shear maps for convergence map based statistics. Otherwise uses the convergence maps directly.
use_kappa_maps – If set to True will calculate shear maps from kappa maps for shear map based statistics. Otherwise uses the shear maps directly.
output_dir – If write_to_file is True used to build the output path. See ekit docs.
defined_parameters – If write_to_file is True used to build the output path. See ekit docs
undefined_parameters – If write_to_file is True used to build the output path. See ekit docs
name – If write_to_file is True used to build the output path. See ekit docs
copy_obj – If True preserves the map objects, otherwise overwrites them with masked maps in the extraction process
write_to_file – If True appends to files directly instead of returning the results as a dictionary
method – Mass mapping method. Currently only Kaiser-Squires supported.
cross_bins – For cross-statistics can indicate which map instances to use.
bin – For single bin statistics can indicate which map instance to use.
trimming – If True uses trimmed mask for convergence statistics.
Calculates shear maps from the convergence maps and sets them (retrieve with get_shear_maps).
bin – Index of the map instance (starting at 0)
trimming – If True apply trimmed mask instead of normal mask to get rid of pixels close to mask edge.
use_B_modes – If True uses B mode convergence maps instead of E modes.
Calculates convergence maps from the shear maps and sets them (retrieve with get_convergence_maps).
bin – Index of the map instance (starting at 0)
trimming – If True apply trimmed mask instead of normal mask to get rid of pixels close to mask edge.
Returns the convergence maps (E and B mode maps). If not set tries to calculate from the internal shear maps.
trimming – If True apply trimmed mask instead of normal mask to get rid of pixels close to mask edge. If False just the normal mask is applied.
bin – Index of the map instance (starting at 0)
Returns the mask
bin – Index of the map instance (starting at 0)
Returns the shear maps. If they are not set tries to calculate from internal convergence maps.
trimming – If True apply trimmed mask instead of normal mask to get rid of pixels close to the edges of the mask. If False just the normal mask is applied.
bin – Index of the map instance (starting at 0)
use_B_modes – If True uses B mode convergence maps instead of E modes.
Returns the trimmed mask
bin – Index of the map instance (starting at 0)
Returns the weight maps
bin – Index of the map instance (starting at 0)
Sets the convergence E and B maps
kappa_E – E mode convergence map
kappa_B – B mode convergence map
bin – Index of the map instance (starting at 0)
Sets the mask
mask – The mask to set
bin – Index of the map instance (starting at 0)
apply – If True directly applies the set mask to the weights, convergence maps and shear maps
Sets the shear maps
shear_1 – First shear map component
shear_2 – binond shear map component
bin – Index of the map instance (starting at 0)
Sets the trimmed mask
trimmed_mask – The trimmed mask to set
bin – Index of the map instance (starting at 0)
apply – If True directly applies the set mask to the weights, convergence maps and shear maps
Bases: object
The summary module is meant to postprocess summary statistics measurements.
The main functionality of the summary module is to calculate mean data-vectors, standard deviations and covariance or precision matrices for the summary statistics at different parameter configurations, based on a set of realizations of the summary statistic at each configuration.
The meta data (e.g. cosmology setting, precision settings, tomographic bin and so on) for each set of realizations (read-in from a file or an array directly) can be given to the module on read-in directly or parsed from the filename. Directly after read-in a first postprocessing can be done using the process function defined in the statistic plugin. The read-in data-vectors are stored appended to a data table for each statistic and the meta data is added to an internal meta data table. The realizations are ordered according to their meta data entry. There are two special entries for the meta data (tomo: label for the tomographic bin of the data-vectors, NREALS: the number of data-vectors associated to each entry (is inferred automatically)). All other entries can be defined by the user.
The summary module allows to downbin the potentially very long data-vectors into larger bins using a binning scheme. The decide_binning_scheme function in the statistic plugin is used to decide on that scheme, which defines the edges of the large bins based on the bins of the original data-vectors. For plotting purposes the binning scheme can also define the values of each data bin (for example its signal-to-noise ratio). The slice function in the statistic plugin then defines how exactly the binning scheme is used to downbin each data-vector. See the Implementing your own summary statistic Section for more details.
The summary module allows to combine summary statistics calculated for different tomographic bins to perform a tomographic analysis. The tomo entry in the meta data table defines the label of the tomographic bin for each set of data-vector realizations. One can define the order of the labels when combined into a joint data-vector using the cross_ordering keyword.
The summary module also allows to combine different summary statistics into a joint data-vector.
The most important functionalities are:
generate_binning_scheme:
Uses the decide_binning_scheme function from the statistic plugin to create a binning scheme. The scheme can be created for different tomographic bins and scales. See the Section Implementing your own summary statistic for more details.
readin_stat_files:
Reads in data-vector realizations from a file. The process function from the statistics plugin is used to perform a first processing of the data. The meta data for each file can either be given directly or can be parsed from the file name by giving a list of parameters indicating the fields to be parsed (using ekit).
downbin_data:
Uses the created binning scheme to bin the data-vector entries into larger bins. Uses the slice function from the statistics plugin to do so.
join_redshift_bins:
Joins all data-vector realizations of a specific statistic at the same configuration. The tomo entry in the meta data table defines the label of the tomographic bin for each set of data-vector realizations. One can define the order of the labels when combined into a joint data-vector using the cross_ordering keyword. If for a specific parameter configuration different number of realizations are found for different tomographic bins, only the minimum number of realizations is used to calculate the combined data-vectors.
join_statistics:
Creates a new statistic entry including the data table and the meta data table, by concatenating the data-vectors of a set of statistics. The new statistic has the name statistic1-statistic2-… If for a specific parameter configuration different number of realizations are found for different statistics, only the minimum number of realizations is used to calculate the combined data-vectors.
get_means:
Returns the mean data vectors of a statistic for the different parameter configurations.
get_meta:
Returns the full meta data table for a statistic.
get_errors:
Returns the standard deviation of the data vectors of a statistic for the different configurations.
get_covariance_matrices:
Returns the covariance matrices estimated from the realizations at each configuration. Can also invert the covariance matrices directly to obtain the precision matrices.
The accepted keywords are:
cross_ordering:
default: []
choices: a list of labels
Indicates the order of the tomographic bin labels that is used by join_redshift_bins to combine data-vectors from different tomographic bins.
The labels could be bin1xbin2 for example, and the corresponding cross_ordering could be [1x1, 1x2, 2x2, 2x3, 3x3].
Use binning scheme to downbin data vectors into larger bins.
statistics – The statistics for which to perform the binning
Generates a binning scheme for different statistics for a given tomographic bin.
statistics – A list of statistics for which to compute the binning scheme
bin – The tomographic bin for which to calculate the binning scheme
Get binning scheme for a certain statistic and tomographic bin :param statistic: Statistic for which to return the binning scheme :param bin: Tomographic bin for which to return the binning scheme :return: bin edges and bin centers
Returns the covariance matrices for all different parameter configurations for a given statistic. :param statistic: Statistic for which to return errors :param invert: If True attempts to invert the covariance matrices. If numerically unstable raises Error :param set_to_id_if_failed: If True sets matrices to identity matrix if the inversion fails. :param plot_fiducial_correlation: If True plots the correlation matrix and covariance matrix for the fiducial parameter setting indicated by Fiducials :param plot_fiducial_incov: If True plots the inverted covariance matrix for the fiducial parameter setting indicated by Fiducials :param Fiducials: The fiducial parameter values for which to plot :param store_fiducial_cov: If True stores fiducial covariance matrix separately (less RAM in MCMC) :return: An array containing the (inverted) covariance matrices as (number of parameter configurations, data vector length, data vector length)
Get full data array for a certain statistic :param statistic: Statistic for which to return data array :param params: Can provide dictionary of parameter values. Returns only realisations with those parameters. :return: All data vector realisations for the statistic
Returns the error datavectors for all different parameter configurations for a given statistic.
statistic – Statistic for which to return errors
An array containing the error data vectors as (number of parameter configurations, data vector length)
Returns the mean datavectors, errors and (inverted) covariance matrices for all different parameter configurations for a given statistic.
statistic – Statistic for which to return errors
invert – If True attempts to invert the covariance matrices. If numerically unstable raises Error
set_to_id_if_failed – If True sets matrices to identity matrix if the inversion fails.
plot_fiducial_correlation – If True plots the correlation matrix and covariance matrix for the fiducial parameter setting indicated by Fiducials
plot_fiducial_incov – If True plots the inverted covariance matrix for the fiducial parameter setting indicated by Fiducials
Fiducials – The fiducial parameter values for which to plot
label – Label used to create path for cov and corr matrix plots
check_stability – If True performs numerical stability checks wheFn inverting covariance matrices
calc_covs – Can turn off the calculation of covariance matrices. For example when SVD should be used.
calc_fiducial_cov – If True and calc_covs is False it only computes the fiducial matrix
store_fiducial_cov – If True stores fiducial covariance matrix separately (less RAM in MCMC)
3 objects. Means, errors and (inverted) covariance matrices
Returns the mean datavectors for all different parameter configurations for a given statistic. :param statistic: Statistic for which to return means :return: An array containing the mean data vectors as (number of parameter configurations, data vector length)
Get full meta table for a certain statistic :param statistic: Statistic for which to return meta data :return: Full meta table for the statistic
Concatenates datavector realisations for the different tomographic bins. The old single bin entries get deleted and the new entries have tomographic bin set to -1.
Join datavectors for different statistics. Creates a new instance for meta and data objects with the key as the single statistics concatinated by ‘-‘s.
statistics – The statistics which should be combined.
Processesing of a chunk of realisations belonging to the same parameter configuration.
data – An array containing the realisations as (n_reals, length of datavectors)
statistic – The name of the statistic to which the realisations belong
meta_list – Can provide a list for the meta data of the shape (1, num_of_parameters)
parse_meta_from_file_names – If set to True will try to get meta parameters from file name passed by file (name need to be in ekit format)
parameters – List of strings indicating the parameter names that should be extracted from the file name
file – A path from which the meta data can be parsed
sort_data – If True performs lexsort of full data array
Reads in data from files and does a first processesing.
files – A list of filepaths containing the realisations for different parameter configurations
statistic – The name of the statistic to which the files belong
meta_list – Can provide a list for the meta data of the shape (num_of files, num_of_parameters)
parse_meta – If set to True will try to get meta parameters from file names (names need to be in ekit format)
parameters – List of strings indicating the parameter names that should be extracted from the file names
Devides each databin by the median of the samples. Useful when performing SVD for example.
statistic – The name of the statistic to which the files belong
Set binning scheme
bin_centers – Centers of the bins to set (only used for plotting)
bin_edges – Edges of the bins to set
statistic – The statistic for which to set the binning scheme
bin – The tomographic bin for which to set the binning scheme