shapelet_coords

class shapelet_coords.ShapeletCoords(fits_data=False)[source]

Takes a shamfi.read_FITS_image class, and uses it to generate a cartesian coord system to fit shapelets in. Include attributes to flux centre the coord system, and to mask the data as required. See the attribute docs below for details.

Parameters:fits_data – a shamfi.read_FITS_image.FITSInformation class that has already been initialised
Variables:fits_data – The supplied shamfi.read_FITS_image.FITSInformation class parameter
find_good_pixels(fit_box=False, exclude_box=False, ignore_negative=False)[source]

Generates a mask to ignore pixels when fitting the shapelets based on the given arguments

Parameters:
  • fit_box (str) – only use the pixels as bounded by fit_box = “low_x,high_x,low_y,high_y” (pixel coords)
  • exclude_box (list) – exclude pixels bounded by the boxes defined in exclude_box, e.g. exclude_box=[“low_x,high_x,low_y,high_y”, “low_x,high_x,low_y,high_y”]
  • ignore_negative (bool) – mask all pixels with negative values in self.fits_data.flat_data
Variables:
  • pixel_inds_to_use (array) – array of pixel indexes to use
  • negative_pix_mask (array) – index of positive data pixels
fit_gauss_and_centre_coords(b1_max=False, b2_max=False)[source]

Try and fit a Gaussian to the image, using the flux weighted central pixel location, and maximum b1 and b2 values, as an initial parameter estimate

Parameters:
  • b1_max (float) – maximum beta scaling for major axis direction
  • b2_max (float) – maximum beta scaling for minor axis direction
Variables:
  • ra_cent (float) – RA value of the flux weighted central pixel
  • dec_cent (float) – Dec value of the flux weighted central pixel
  • ras (array) – all RA values, zeroed on the fluxed weighted pixel (deg)
  • decs (array) – all Dec values, zeroed on the fluxed weighted pixel (deg)
radec2xy(b1, b2, crop=False)[source]

Transforms the RA/DEC coords system into the shapelet x/y system for given b1,b2 parameters, and the self.pa rotation angle. Also optinally applies the self.pixel_inds_to_use cut to only return the pixels to be used in the shapelet fit

Parameters:
  • b1 (float) – beta parameter to scale the x-axis (radians)
  • b2 (float) – beta parameter to scale the y-axis (radians)
  • crop (bool) – If True, apply self.pixel_inds_to_use to the transformation
Return xrot,yrot:
 

The x,y coords in 1D numpy arrays

Return type:

arrays

shapelet_coords.twoD_Gaussian(xy, amplitude, xo, yo, sigma_x, sigma_y, theta)[source]

Creates a model for a 2D Gaussian, by taking two 2D coordinate arrays in x,y. Returns a flattened array of the model to make fitting more straight forward

Parameters:
  • xy (list) – list containing two 2D numpy arrays A list containing the x and y coordinates to calculate the gaussian at. x and y are separated into individual 2D arrays. xy = [x(2D), y(2D)]
  • amplitude (float) – float Amplitude to scale the Gaussian by
  • xo (float) – float Value of the central x pixel
  • yo (float) – float Value of the central y pixel
  • sigma_x (float) – float Sigma value for the x dimension
  • sigma_y (float) – float Sigma value for the y dimension
  • theta (float) – float Rotation angle (radians)
Return gaussian.flatten():
 

A 2D gaussian model, flattened into a 1D numpy array

Return type:

array