FluxComponents#

class jolideco.models.FluxComponents(modules: Mapping[str, Module] | None = None)[source]#

Bases: ModuleDict

Flux components

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

Attributes Summary

flux_total_numpy

Usampled total flux

flux_upsampled_total

Total summed flux (~torch.tensor)

flux_upsampled_total_numpy

Usampled total flux

fluxes_numpy

Fluxes (dict of ~numpy.ndarray)

fluxes_upsampled_numpy

Upsampled fluxes (dict of ~numpy.ndarray)

priors

Priors associated with the componenet

Methods Summary

from_dict(data)

Create flux components from dict

parameters()

Parameter list

plot([figsize, kwargs_norm])

Plot images of the flux components

read(filename[, format])

Read flux components from file

set_flux_errors(flux_errors)

Set flux errors

to_dict([include_data])

Convert flux component configuration to dict, with simple data types.

to_flux_tuple()

Fluxes as tuple (tuple of ~torch.tensor)

to_numpy()

Fluxes of the components (dict of ~numpy.ndarray)

write(filename[, overwrite, format])

Write flux components to file

Attributes Documentation

flux_total_numpy#

Usampled total flux

flux_upsampled_total#

Total summed flux (~torch.tensor)

flux_upsampled_total_numpy#

Usampled total flux

fluxes_numpy#

Fluxes (dict of ~numpy.ndarray)

fluxes_upsampled_numpy#

Upsampled fluxes (dict of ~numpy.ndarray)

priors#

Priors associated with the componenet

Methods Documentation

classmethod from_dict(data)[source]#

Create flux components from dict

Parameters:

data (dict) – Parameter dict.

Returns:

flux_components – Flux components

Return type:

FluxComponents

parameters()[source]#

Parameter list

plot(figsize=None, kwargs_norm=None, **kwargs)[source]#

Plot images of the flux components

Parameters:
  • fisize (tuple of int) – Figure size.

  • kwargs_norm (dict) – Keyword arguments passed to ~astropy.visualization.simple_norm

  • **kwargs (dict) – Keywords forwarded to ~matplotlib.pyplot.imshow

Returns:

axes – Plot axes

Return type:

list of ~matplotlib.pyplot.Axes

classmethod read(filename, format=None)[source]#

Read flux components from file

Parameters:
  • filename (str or Path) – Output filename

  • format ({'asdf', 'yaml', 'fits'}) – Format to use.

Returns:

flux_components – Flux components

Return type:

FluxComponents

set_flux_errors(flux_errors)[source]#

Set flux errors

to_dict(include_data=None)[source]#

Convert flux component configuration to dict, with simple data types.

Parameters:

include_data (None or {"numpy"}) – Optionally include data array in the given format

Returns:

data – Parameter dict.

Return type:

dict

to_flux_tuple()[source]#

Fluxes as tuple (tuple of ~torch.tensor)

to_numpy()[source]#

Fluxes of the components (dict of ~numpy.ndarray)

write(filename, overwrite=False, format=None, **kwargs)[source]#

Write flux components to file

Parameters:
  • filename (str or Path) – Output filename

  • overwrite (bool) – Overwrite file.

  • format ({'asdf', 'yaml', 'fits'}) – Format to use.