piXedfit_bin

piXedfit.piXedfit_bin.get_bins_SED_binmap(binmap_fits)

Function to extract SEDs of the spatial bins from the binned flux maps.

Parameters:

binmap_fits – Input FITS file of binned flux maps.

Returns bin_photo_flux:

Photometric fluxes of the spatial bins: (nbins,nbands)

Returns bin_photo_flux_err:

Photometric flux uncertainties of the spatial bins: (nbins,nbands)

Returns bin_spec_flux:

Spectroscopic fluxes of the spatial bins: (nbins,nwaves)

Returns bin_spec_flux_err:

Spectroscopic flux uncertainties of the spatial bins: (nbins,nwaves)

Returns bin_flag_specphoto:

A flag stating whether a spatial bin has a spectroscopy (value=1) or not (value=0).

Returns filters:

The set of filters.

Returns photo_wave:

The central wavelength of the filters.

Returns spec_wave:

The wavelength grids of the spectra.

piXedfit.piXedfit_bin.open_binmap_fits(binmap_fits)

Function to get the data from binned flux maps.

Parameters:

binmap_fits – Input FITS file containing binned flux maps.

Returns flag_specphoto:

A flag stating whether the data contains spectra (value=1) or not (value=0).

Returns nbins_photo:

Number of spatial bins with photometric data, which is also the total number of spatial bins.

Returns nbins_spec:

Number of spatial bins that have spectra.

Returns filters:

Set of the photometric filters.

Returns unit_flux:

The flux unit.

Returns binmap_photo:

The binning map of the photometric data.

Returns spec_region:

The spatial region that have spectroscopy.

Returns binmap_spec:

Number of spatial bins that have spectroscopy.

Returns map_photo_flux:

The data cube of the photometric fluxes: (nbands,ny,nx)

Returns map_photo_flux_err:

The data cube of the photometric flux uncertainties: (nbands,ny,nx)

Returns spec_wave:

Spectroscopic wavelength grids.

Returns map_spec_flux:

The data cube of the spectroscopic fluxes: (nwaves,ny,nx)

Returns map_spec_flux_err:

The data cube of the spectroscopic flux uncertainties: (nwaves,ny,nx)

piXedfit.piXedfit_bin.pixel_binning(fits_fluxmap, ref_band=None, Dmin_bin=4.0, SNR=None, redc_chi2_limit=4.0, del_r=2.0, name_out_fits=None)

Function for pixel binning, a proses of combining neighboring pixels to optimize the signal-to-noise ratios of the spatially resolved SEDs. Input of this function is a data cube obtained from the image processing or spectrophotometric processing.

Parameters:
  • fits_fluxmap – Input FITS file containing the photometric or spectrophotometric data cube. The photometric data cube is obtained from the image processing with the images_processing() function, while the spectrophotmetric data cube is the output of function match_imgifs_spectral().

  • ref_band – Index of the reference band (filter) for sorting pixels based on the brightness. The central pixel of a bin is the brightest pixel in this reference band. If ref_band=None, the ref_band is chosen to be around the middle of the wavelength covered by the observed SEDs.

  • Dmin_bin – Minimum diameter of a bin in unit of pixel.

  • SNR – S/N thresholds in all bands. The length of this array should be the same as the number of bands in the fits_fluxmap. S/N threshold can vary across the filters. If SNR is None, the S/N is set as 5.0 to all the filters.

  • redc_chi2_limit – A maximum reduced chi-square value for a pair of two SEDs to be considered as having a similar shape.

  • del_r – Increment of circular radius (in unit of pixel) adopted in the pixel binning process.

  • name_out_fits – Desired name for the output FITS file. If None, a default name is adopted.

piXedfit.piXedfit_bin.pixel_binning_images(images, var_images, ref_band=None, Dmin_bin=2.0, SNR=None, redc_chi2_limit=4.0, del_r=2.0, name_out_fits=None)

Function for pixel binning on multiband image.

Parameters:
  • images – Input science images. This input should be in a list format, such as images=[‘image1.fits’, ‘image2.fits’, ‘image3.fits’]

  • var_images – Variance images in a list format. The number of variance images should be the same as that of the input science images.

  • ref_band – Index of the reference band (filter) for sorting pixels based on the brightness. The central pixel of a bin is the brightest pixel in this reference band. If ref_band=None, the ref_band is chosen to be around the middle of the wavelength covered by the observed SEDs.

  • Dmin_bin – Minimum diameter of a bin in unit of pixel.

  • SNR – S/N thresholds in all bands. The length of this array should be the same as the number of bands in the fits_fluxmap. S/N threshold can vary across the filters. If SNR is None, the S/N is set as 5.0 to all the filters.

  • redc_chi2_limit – A maximum reduced chi-square value for a pair of two SEDs to be considered as having a similar shape.

  • del_r – Increment of circular radius (in unit of pixel) adopted in the pixel binning process.

  • name_out_fits – Desired name for the output FITS file. If None, a default name is adopted.

piXedfit.piXedfit_bin.plot_binmap(binmap_fits, plot_binmap_spec=True, savefig=True, name_plot_binmap_photo=None, name_plot_binmap_spec=None)

Function for plotting the binning map.

Parameters:
  • binmap_fits – Input FITS file of the binned flux maps.

  • plot_binmap_spec – Decide to plot the binning map of pixels that have spectra. This input is only relevant if the data cube has both photometry and spectroscopy.

  • savefig – Decide whether to save the plot of not.

  • name_plot_binmap_photo – Name of the binning map of photometry.

  • name_plot_binmap_spec – Name of the binning map of spectroscopy.

piXedfit.piXedfit_bin.plot_bins_SED(binmap_fits, bin_ids=None, logscale_y=True, logscale_x=True, wunit='angstrom', yrange=None, xrange=None, savefig=True, name_plot=None)

Function for plotting SEDs of pixels.

Parameters:
  • binmap_fits – Input FITS file.

  • bin_ids – Indexes of spatial bins which SEDs will be plotted. This index start from 0.

  • logscale_y – (optional) Option to set the y axis in logarithmic scale.

  • logscale_x – (optional) Option to set the x axis in logarithmic scale.

  • wunit – (optional) Wavelength unit. Options are ‘angstrom’ and ‘micron’.

  • yrange – (optional) Range in y axis.

  • xrange – (optional) Range in x axis.

  • savefig – (optional) Option to save the plot.

  • name_plot – (optional) Name for the output plot.

piXedfit.piXedfit_bin.plot_bins_SNR_radial_profile(binmap_fits, xrange=None, yrange=None, savefig=True, name_plot=None)

Function for plotting the S/N ratios of spatial bins.

Parameters:
  • binmap_fits – FITS file of binned flux maps produced by the pixel_binning function.

  • xrange – Range in x-axis.

  • yrange – Range in y-axis.

  • savefig – Decide whether to save the plot or not.

  • name_plot – Name of the output plot.