Frame#

class scarlet2.Frame(bbox, psf=None, wcs=None, channels=None)[source]#

Bases: Module

Definition of a view of the sky

This class combines all elements to determine how a piece of the sky will appear. It includes metadata about the spatial and spectral coverage and resolution.

property C: int#

Number of channels

property H: int#

number of pixels in the vertical direction

Type:

Height

property W: int#

number of pixels in the horizontal direction

Type:

Width

__call__()#

Evaluate the model

bbox: Box#

Bounding box of the frame

channels: list#

Identifiers for the spectral elements

convert_pixel_to(target, pixel=None)[source]#

Converts pixel coordinates from this frame to target frame

Parameters:
  • target (Frame) – target frame

  • pixel (array) – Pixel coordinates in this frame. If not set, convert all pixels in this frame

Returns:

coordinates at the location of pixel in the frame target

Return type:

array

static from_observations(observations, model_psf=None, model_wcs=None, reference_id=None, coverage='union')[source]#

Generates a suitable model frame for a set of observations.

This method generates a frame from a set of observations by identifying the highest resolution and the smallest PSF and use them to construct a common frame for all observations.

Parameters:
  • observations (list) – list of Observation to determine a common frame

  • model_psf (PSF, optional) – PSF to be adopted for the model frame. This is the effective resolution of the model, and all observations are to be deconvolved to this limit. If None, uses the smallest PSF across all observations and channels.

  • model_wcs (astropy.wcs.WCS) – WCS for the model frame. If None, uses WCS information of the observation with the smallest pixels.

  • reference_id (int, optional) – index of the reference observation. If set to None, uses the observation with the smallest pixels.

  • coverage ("union" or "intersection") – Sets the frame to incorporate the pixels covered by any observation (‘union’) or by all observations (‘intersection’).

get(name=None)#

Get parameter(s) from this module

Parameters:

name (str, optional) – Name of parameter. If not set, returns all parameters.

Returns:

requested data arrays for parameters

Return type:

dict

get_pixel(pos)[source]#

Get the sky coordinates from a world coordinate

Parameters:

pos (jnp.ndarray or SkyCoord) – Coordinates on the sky

Return type:

pixel coordinates in the model frame

get_sky_coord(pos)[source]#

Get the sky coordinate from a pixel coordinate

Parameters:

pos (jnp.ndarray) – Coordinates in the pixel space

Return type:

astropy.coordinates.SkyCoord

property parameters#

Parameters defined for this module

Returns:

name: (node, param) mapping for all parameters

Return type:

dict

pixel_to_angle(size)[source]#

Converts pixel size to celestial distance according to this frame WCS

Parameters:

size (float) – The size in pixels

Returns:

distance

Return type:

astropy.units.Quantity

psf: (<class 'scarlet2.psf.PSF'>, None)#

PSF of the frame

set(values)#

Set parameter(s) from this module with values

Parameters:

values (dict[str,jnp.array]) – values to replace parameters with, identified by their name

Returns:

new module with parameter(s) replaced by values

Return type:

Module

u_to_pixel(distance)[source]#

Converts celestial distance to pixel size according to this frame WCS

Parameters:

distance (astropy.units.Quantity) – Physical size, must be PhysicalType(“angle”)

Returns:

size in pixels

Return type:

float

wcs: WCS#

WCS information of the frame