magrittetorch.algorithms.solvers

magrittetorch.algorithms.solvers.compute_level_populations(model: Model, device: device, max_n_iterations: int = 50, use_ng_acceleration: bool = True, use_ALI: bool = True, max_its_between_ng_accel: int = 8) None

Computes the level populations of the given model using an iterative approach, utilizing the mean line intensities to solve the statistical equilibrium equations. Optionally also uses Ng-acceleration and local ALI to speed up the convergence.

Parameters:
  • model (Model) – The model for which to compute the level populations.

  • device (torch.device) – The device on which to compute.

  • max_n_iterations (int, optional) – The maximum number of iterations to perform. Defaults to 50.

  • use_ng_acceleration (bool, optional) – Whether to use Ng-acceleration. Defaults to True.

  • use_ALI (bool, optional) – Whether to use ALI. Defaults to True.

  • max_its_between_ng_accel (int, optional) – The maximum number of iterations between Ng-acceleration. Defaults to 8.

Returns:

None

magrittetorch.algorithms.solvers.image_model(model: Model, ray_direction: Tensor, freqs: Tensor, device: device, Nxpix: int = 256, Nypix: int = 256, imageType: ImageType = ImageType.Intensity) None

Computes an image of the model for a given ray direction at the specified indices. Appends the resulting image to model.images

Parameters:
  • model (Model) – The model to use for computing the image.

  • ray_direction (torch.Tensor) – The direction of the ray. Has dimensions [3].

  • freqs (torch.Tensor) – The frequency range to use for computing the image. Has dimensions [NFREQS].

  • device (torch.device) – The device on which to compute.

  • Nxpix (int, optional) – The number of pixels in the x direction. Defaults to 256.

  • Nypix (int, optional) – The number of pixels in the y direction. Defaults to 256.

  • imageType (ImageType, optional) – The type of image to compute. Defaults to ImageType.Intensity.

Returns:

None