Training sets

ecopann.cosmic_params

class ecopann.cosmic_params.ParamsProperty(param_names, params_dict=None)[source]
labels
param_fullNames
params_limit
ecopann.cosmic_params.params_dict_zoo()[source]

Information of cosmological parameters that include the labels and physical limits: [label, limit_min, limit_max]

The label is used to plot figures. The physical limits are used to ensure that the simulated parameters have physical meaning.

Note

If the physical limits of parameters is unknown or there is no physical limits, it should be set to np.nan.

ecopann.data_simulator

ecopann.data_processor

class ecopann.data_processor.InverseNormalize(x1, statistic={}, norm_type='z_score', a=0, b=1)[source]

Bases: object

Inverse transformation of class Normalize.

inverseNorm()[source]
mean()[source]
minmax()[source]
z_score()[source]
class ecopann.data_processor.Normalize(x, statistic={}, norm_type='z_score', a=0, b=1)[source]

Bases: object

Normalize data.

mean()[source]

mean normalization

minmax()[source]

min-max normalization

Rescaling the range of features to scale the range in [0, 1] or [a,b] https://en.wikipedia.org/wiki/Feature_scaling

norm()[source]
z_score()[source]

standardization/z-score/zero-mean normalization

class ecopann.data_processor.ParamsScaling(params_base)[source]

Bases: object

Data preprocessing of cosmological parameters.

Parameters:params_base (array-like) – A 1-D array that contains the base values of the cosmological parameters.
inverseScaling(params)[source]
scaling(params)[source]
class ecopann.data_processor.Statistic(x)[source]

Bases: object

Statistics of an array.

mean
statistic()[source]
std
xmax
xmin
ecopann.data_processor.cpu2cuda(data)[source]

Transfer data from CPU to GPU.

Parameters:data (array-like or tensor) – Numpy array or torch tensor.
Raises:TypeError – The data type should be np.ndarray or torch.Tensor.
Returns:Torch tensor.
Return type:Tensor
ecopann.data_processor.cuda2numpy(data)[source]

Transfer data from the torch tensor (on GPU) to the numpy array (on CPU).

ecopann.data_processor.cuda2torch(data)[source]

Transfer data (torch tensor) from GPU to CPU.

ecopann.data_processor.numpy2cuda(data, device=None)[source]

Transfer data from the numpy array (on CPU) to the torch tensor (on GPU).

ecopann.data_processor.numpy2torch(data)[source]

Transfer data from the numpy array (on CPU) to the torch tensor (on CPU).

ecopann.data_processor.torch2cuda(data, device=None)[source]

Transfer data (torch tensor) from CPU to GPU.

ecopann.data_processor.torch2numpy(data)[source]

Transfer data from the torch tensor (on CPU) to the numpy array (on CPU).