jaxtronomy.Data package¶
Submodules¶
jaxtronomy.Data.image_noise module¶
- class ImageNoise(image_data, exposure_time=None, background_rms=None, noise_map=None, flux_scaling=1, gradient_boost_factor=None, verbose=True)[source]¶
Bases:
objectClass that deals with noise properties of imaging data.
- __init__(image_data, exposure_time=None, background_rms=None, noise_map=None, flux_scaling=1, gradient_boost_factor=None, verbose=True)[source]¶
- Parameters:
image_data – numpy array, pixel data values
exposure_time – int or array of size the data; exposure time (common for all pixels or individually for each individual pixel) Units of data and exposure map should result in: number of flux counts = data * exposure_map
background_rms – root-mean-square value of Gaussian background noise
noise_map – int or array of size the data; joint noise sqrt(variance) of each individual pixel. Overwrites meaning of background_rms and exposure_time.
flux_scaling (float or int (default=1)) – scales the model amplitudes to match the imaging data units. This can be used, for example, when modeling multiple exposures that have different magnitude zero points (or flux normalizations) but demand the same model normalization
gradient_boost_factor – None or float, variance terms added in quadrature scaling with gradient^2 * gradient_boost_factor. NOTE: NOT supported in Jaxtronomy
- covariance_matrix(data, background_rms, exposure_map)[source]¶
Returns a diagonal matrix for the covariance estimation which describes the error.
Notes:
- the exposure map must be positive definite. Values that deviate too much from the mean exposure time will be
given a lower limit to not under-predict the Poisson component of the noise.
- the data must be positive semi-definite for the Poisson noise estimate.
Values < 0 (Possible after mean subtraction) will not have a Poisson component in their noise estimate.
- Parameters:
data – data array, eg in units of photons/second
background_rms – background noise rms, eg. in units (photons/second)^2
exposure_map – exposure time per pixel, e.g. in units of seconds
gradient_boost_factor – None or float, variance terms added in quadrature scaling with gradient^2 * gradient_boost_factor
- Returns:
len(d) x len(d) matrix that give the error of background and Poisson components; (photons/second)^2
jaxtronomy.Data.imaging_data module¶
- class ImageData(image_data, exposure_time=None, background_rms=None, noise_map=None, gradient_boost_factor=None, ra_at_xy_0=0, dec_at_xy_0=0, transform_pix2angle=None, ra_shift=0, dec_shift=0, phi_rot=0, log_likelihood_constant=0, antenna_primary_beam=None, likelihood_method='diagonal', flux_scaling=1)[source]¶
Bases:
PixelGrid,ImageNoiseClass to handle the data, coordinate system and masking, including convolution with various numerical precisions.
The Data() class is initialized with keyword arguments:
‘image_data’: 2d numpy array of the image data
‘transform_pix2angle’ 2x2 transformation matrix (linear) to transform a pixel shift into a coordinate shift (x, y) -> (ra, dec)
‘ra_at_xy_0’ RA coordinate of pixel (0,0)
‘dec_at_xy_0’ DEC coordinate of pixel (0,0)
optional keywords for shifts in the coordinate system:
‘ra_shift’: shifts the coordinate system with respect to ‘ra_at_xy_0’
‘dec_shift’: shifts the coordinate system with respect to ‘dec_at_xy_0’
optional keywords for noise properties:
‘background_rms’: rms value of the background noise
‘exp_time’: float, exposure time to compute the Poisson noise contribution
‘exposure_map’: 2d numpy array, effective exposure time for each pixel. If set, will replace ‘exp_time’
‘noise_map’: Gaussian noise (1-sigma) for each individual pixel.
If this keyword is set, the other noise properties will be ignored.
optional keywords for interferometric quantities:
‘likelihood_method’: need to be specified to ‘interferometry_natwt’ if one needs to use the interferometric likelihood function.
The default of ‘likelihood_method’ is ‘diagonal’, which is used for non-correlated noises (usually for the CCD images.)
‘log_likelihood_constant’: a constant that adds to logL.
‘antenna_primary_beam’: primary beam pattern of antennae (now treat each antenna dish with the same primary beam).
** notes ** the likelihood for the data given model P(data|model) is defined in the function below. Please make sure that your definitions and units of ‘exposure_map’, ‘background_rms’ and ‘image_data’ are in accordance with the likelihood function. In particular, make sure that the Poisson noise contribution is defined in the count rate.
- __init__(image_data, exposure_time=None, background_rms=None, noise_map=None, gradient_boost_factor=None, ra_at_xy_0=0, dec_at_xy_0=0, transform_pix2angle=None, ra_shift=0, dec_shift=0, phi_rot=0, log_likelihood_constant=0, antenna_primary_beam=None, likelihood_method='diagonal', flux_scaling=1)[source]¶
- Parameters:
image_data – 2d numpy array of the image data
exposure_time – int or array of size the data; exposure time (common for all pixels or individually for each individual pixel)
background_rms – root-mean-square value of Gaussian background noise in units counts per second
noise_map – int or array of size the data; joint noise sqrt(variance) of each individual pixel.
gradient_boost_factor – None or float, variance terms added in quadrature scaling with gradient^2 * gradient_boost_factor
transform_pix2angle – 2x2 matrix, mapping of pixel to coordinate
ra_at_xy_0 – ra coordinate at pixel (0,0)
dec_at_xy_0 – dec coordinate at pixel (0,0)
ra_shift – RA shift of pixel grid
dec_shift – DEC shift of pixel grid
phi_rot – rotation angle in regard to pixel coordinate transform_pix2angle
log_likelihood_constant – float, allows user to input a constant that will be added to the log likelihood. Note that, as for now, this variable is ONLY used for interferometric mode.
antenna_primary_beam – 2d numpy array with the same size of image_data; more descriptions of the primary beam can be found in the AngularSensitivity class
likelihood_method – string, type of method of log_likelihood computation: options are ‘diagonal’, ‘interferometry_natwt’. The default option ‘diagonal’ uses a diagonal covariance matrix, which is the case for CCD images. The ‘interferometry_natwt’ option uses our special interferometric likelihood function based on natural weighting images.
flux_scaling – scales the model amplitudes to match the imaging data units. This can be used, for example, when modeling multiple exposures that have different magnitude zero points (or flux normalizations) but demand the same model normalization
- update_data(image_data)[source]¶
Updates self.data with a new image data and recompiles the log likelihood functions. Note that if recompilation is not done, the log likelihood functions will use the previous value of self.data, since that value was cached during the previous compilation.
- Parameters:
image_data – 2D array representing the new image to be stored in self.data