SparseSpatialFluxComponent#

class jolideco.models.SparseSpatialFluxComponent(flux, x_pos, y_pos, shape, use_log_flux=True, prior=None, frozen=False, wcs=None)[source]#

Bases: Module

Sparse flux component to represent a list of point sources

flux#

Initial flux tensor

Type:

~torch.Tensor

x_pos#

x position in pixel coordinates

Type:

~torch.Tensor

y_pos#

y position in pixel coordinates

Type:

~torch.Tensor

shape#

Image shape

Type:

tuple of int

use_log_flux#

Use log scaling for flux

Type:

bool

prior#

Prior for this flux component.

Type:

Prior

frozen#

Whether to freeze component.

Type:

bool

wcs#

World coordinate transform object

Type:

~astropy.wcs.WCS

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

Attributes Summary

flux

Flux (~torch.Tensor)

flux_numpy

Flux as numpy array

flux_upsampled

Upsampled flux

indices

Shape of the flux component

is_sparse

shape

Shape of the flux component

sky_coord

Positions as SkyCoord

upsampling_factor

use_log_flux

Use log flux

wcs

Flux error

x_pos_numpy

x pos as numpy array

y_pos_numpy

y pos as numpy array

Methods Summary

from_numpy(flux, x_pos, y_pos, **kwargs)

Create sparse flux component from numpy arrays

from_sky_coord(skycoord, wcs, **kwargs)

Create sparse flux component from sky coordinates

parameters([recurse])

Parameter list

plot([ax, kwargs_norm])

Plot flux component as sky image

read(filename[, format])

Read sparse flux component from file

to_dict(**kwargs)

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

write(filename[, format, overwrite])

Write flux component to file

Attributes Documentation

flux#

Flux (~torch.Tensor)

flux_numpy#

Flux as numpy array

flux_upsampled#

Upsampled flux

indices#

Shape of the flux component

is_sparse = True#
shape#

Shape of the flux component

sky_coord#

Positions as SkyCoord

upsampling_factor = 1#
use_log_flux#

Use log flux

wcs#

Flux error

x_pos_numpy#

x pos as numpy array

y_pos_numpy#

y pos as numpy array

Methods Documentation

classmethod from_numpy(flux, x_pos, y_pos, **kwargs)[source]#

Create sparse flux component from numpy arrays

flux#

Initial flux tensor

Type:

~numpy.ndarray

x_pos#

x position in pixel coordinates

Type:

~numpy.ndarray

y_pos#

y position in pixel coordinates

Type:

~numpy.ndarray

\*\*kwargs

Keyword arguments forwarded to SparseFluxComponent

Type:

dict

Returns:

sparse_flux_component – Sparse flux component

Return type:

SparseFluxComponent

classmethod from_sky_coord(skycoord, wcs, **kwargs)[source]#

Create sparse flux component from sky coordinates

Parameters:
  • skycoord (~astropy.coordinates.SkyCoord) – Sky coordinates

  • wcs (~astropy.wcs.WCS) – World coordinate transform object

Returns:

sparse_flux_component – Sparse flux component

Return type:

SparseFluxComponent

parameters(recurse=True)[source]#

Parameter list

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

Plot flux component as sky image

Parameters:
  • ax (~matplotlib.pyplot.Axes) – Plotting axes

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

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

Returns:

ax – Plotting axes

Return type:

~matplotlib.pyplot.Axes

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

Read sparse flux component from file

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

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

Returns:

flux_component – Flux component

Return type:

SparseFluxComponent

to_dict(**kwargs) dict[str, Any][source]#

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

Returns:

data – Parameter dict.

Return type:

dict

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

Write flux component to file

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

  • overwrite (bool) – Overwrite file.

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