NPredModel#

class jolideco.models.NPredModel(exposure, psf=None, rmf=None, upsampling_factor=None)[source]#

Bases: Module

Predicted counts model with multiple components

Parameters:
  • exposure (~torch.Tensor) – Exposure tensor

  • psf (~torch.Tensor) – Point spread function

  • rmf (~torch.Tensor) – Energy redistribution matrix.

  • upsampling_factor (int) – Upsampling factor.

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Attributes Summary

shape

Shape of the NPred model

shape_upsampled

Shape of the NPred model

Methods Summary

forward(flux)

Forward folding model evaluation.

from_dataset_numpy(dataset[, ...])

Create NPred model from dataset

from_numpy(exposure, psf, upsampling_factor)

Create NPred model from numpy arrays

Attributes Documentation

shape#

Shape of the NPred model

shape_upsampled#

Shape of the NPred model

Methods Documentation

forward(flux)[source]#

Forward folding model evaluation.

Parameters:

flux (~torch.Tensor) – Flux tensor

Returns:

npred – Predicted number of counts

Return type:

~torch.Tensor

classmethod from_dataset_numpy(dataset, upsampling_factor=None, correct_exposure_edges=True)[source]#

Create NPred model from dataset

Parameters:
  • dataset (dict of ~numpy.ndarray) – Dict containing “counts”, “psf” and optionally “exposure” and “background”

  • upsampling_factor (int) – Upsampling factor for exposure, background and psf.

  • correct_exposure_edges (bool) – Correct psf leakage at the exposure edges.

Returns:

npred_model – Predicted counts model

Return type:

NPredModel

classmethod from_numpy(exposure, psf, upsampling_factor, correct_exposure_edges=True)[source]#

Create NPred model from numpy arrays

Parameters:
  • flux (~torch.Tensor) – Flux tensor

  • exposure (~torch.Tensor) – Exposure tensor

  • psf (~torch.Tensor) – Point spread function

  • upsampling_factor (int) – Upsampling factor.

  • correct_exposure_edges (bool) – Correct psf leakage at the exposure edges.

Returns:

npred_model – Predicted counts model

Return type:

NPredModel