fluxcompensator.cube.SyntheticCube

class fluxcompensator.cube.SyntheticCube(input_array, unit_out='ergs/cm^2/s', name=None)

SyntheticCube is part the FluxCompensator. It converts input_arrays (e. g. HYPERION ModelOutput) to “realistic” synthetic observations (e.g. accounts for PSF, filters & noise). It contains attributes like ModelOutput (see Notes). If input_array is already a SyntheticCube object, the attributes are passed. If input_array is not a SyntheticCube object, SyntheticCube specific attributes are defined and then passed.

Parameters:

input_array : SyntheticCube, ModelOutput, optional

input_array also reads arrays with ModelOutput like properties.

unit_out : str, optional

The output units for SyntheticCube val. Valid options are:

  • 'ergs/cm^2/s'
  • 'ergs/cm^2/s/Hz'
  • 'Jy'
  • 'mJy'
  • 'MJy/sr'

The default is 'ergs/cm^2/s'.

name : str

The name of the FluxCompensator object until another input_array is called. The default is None.

Returns:

cube : SyntheticCube

3D val array with SyntheticCube properties.

image : SyntheticImage

2D val array with SyntheticImage properties.

sed : SyntheticSED

1D val array (collapsed rough SED) with SyntheticSED properties.

flux : SyntheticFlux

0D val array (scalar) with SyntheticFlux properties.

Notes

unit_in : str

Unit of val in input_array. Valid options are:

  • 'ergs/cm^2/s'
  • 'ergs/cm^2/s/Hz'
  • 'Jy'
  • 'mJy'
  • 'MJy/sr'
grid_unit : float

Physical unit of FOV axis in cm. Valid options are:

  • au in cm
  • pc in cm
  • kpc in cm
grid_unit_name

Astronomical unit of FOV axis. Valid options are:

  • 'au'
  • 'pc'
  • 'kpc'
FOV : tuple

Tuple FOV(x,y) of Field of View pixel entries.

  • pixel in x direction: FOV[0]
  • pixel in y direction: FOV[1]
name : str
The name of the FluxCompensator object until another input_array is called. The default is None.
stage : str
Gives current operation stage of SyntheticCube. E. g. 'SyntheticCube: convolve_filter'
log : list
List of strings of the previous and current stages.
filter : dict

Dictionary filter = {name, waf_0, waf_min, waf_max} of the applied filter.

  • name of filter: filter['name']
  • central wavelength: filter['waf_0']
  • minimal wavelength: filter['waf_min']
  • maximal wavelength: filter['waf_max']

Attributes

wav numpy.ndarray The wavelengths of val cube slices in microns.
val numpy.ndarray The 3D cube with shape (x, y, wav).
units str Current units of the val cube.
distance str Distance to the observed object in cm.
x_min float Physical offset from axis origin in FOV in cm.
x_max float Physical offset from axis origin in FOV in cm.
y_min float Physical offset from axis origin in FOV in cm.
y_max float Physical offset from axis origin in FOV in cm.
lon_min float Minimal longitudinal angle.
lon_max float Maximal longitudinal angle.
lat_min float Minimal latitudinal angle.
lat_max float Maximal latitudinal angle.
pix_area_sr float Pixel area per sr.

Methods

extinction(A_v[, input_opacities]) Accounts for reddening.
change_resolution(new_resolution[, grid_plot]) Changes the resolution of every slice of the val cube.
convolve_psf(psf) Convolves every slice of the val cube with a PSF of choice.
convolve_filter(filter_input[, plot_rebin, ...]) Convolves slice within filter limits into a 2D image.
add_noise(mu_noise, sigma_noise[, seed, ...]) Adds normal distributed noise to every slice in the val cube of SyntheticCube.
get_rough_sed() Collapses the current val cube into 1D array (SED).
get_total_val(wav_1, wav_2) Collapses the val of SyntheticCube within the boundaries wav_1 and wav_2 into a 0D value val.
plot_image(wav_interest[, prefix, name, ...]) Plots a certain slice close the wav_interest.

Methods (detail)

extinction(A_v, input_opacities=None)

Accounts for reddening.

Parameters:

A_v : Value of the visible extinction.

input_opacities : None, str

If None standard extinction law is used. Otherwise a e. g. input_opacities.txt file can be passed as a str to read an opacity file with column #1 wav in microns and column #2 in cm^2/g. Default is None.

Returns:

cube : SyntheticCube

change_resolution(new_resolution, grid_plot=None)

Changes the resolution of every slice of the val cube.

Parameters:

new_resolution : Resolution which the val array should get in arcsec/pixel.

grid_plot : None, True

If True old and new resolution is visualized in a plot. Default is None.

Returns:

cube : SyntheticCube

convolve_psf(psf)

Convolves every slice of the val cube with a PSF of choice.

Parameters:

psf : GaussianPSF, FilePSF, database, FunctionPSF

  • GaussianPSF(self, diameter): Convolves val with Gaussian PSF.
  • FilePSF(self, psf_file, condensed): Reads PSF from input file.
  • database: PSF object defined in FluxCompensator database.
  • FunctionPSF(self, psf_function, width): Convolves val with calculated PSF.
Returns:

cube : SyntheticCube

convolve_filter(filter_input, plot_rebin=None, plot_rebin_dpi=None)

Convolves slice within filter limits into a 2D image.

Parameters:

filter_input : object

  • database : if filter name from FluxCompensator database is used.
  • Filter : if own filter is used.

plot_rebin : True, None

Switch to plot the rebined filter and the original filter in one plot.

plot_rebin_dpi : None, scalar > 0

The resolution in dots per inch. None is default and will use the value savefig.dpi in the matplotlibrc file.

Returns:

image : SyntheticImage

add_noise(mu_noise, sigma_noise, seed=None, diagnostics=None)

Adds normal distributed noise to every slice in the val cube of SyntheticCube.

Parameters:

mu_noise : float

Mean of the normal distribution. Good choice: mu_noise = 0.

sigma_noise : float

Standard deviation of the normal distribution. Good choice around:
  • 'ergs/cm^2/s' : sigma_noise = 10.**(-13)
  • 'ergs/cm^2/s/Hz' : sigma_noise = 10.**(-26)
  • 'Jy' : sigma_noise = 10.**(-3)
  • 'mJy' : sigma_noise = 10.**(-1)
  • 'MJy/sr' : sigma_noise = 10.**(-10)

seed : float, None

When float seed fixes the random numbers to a certain sequence in order to create reproducible results. Default is None.

diagnostics : truetype

When True noise array is stored in a fits file.

Returns:

cube : SyntheticCube

get_rough_sed()

Collapses the current val cube into 1D array (SED).

Returns:sed : SyntheticSED
get_total_val(wav_1, wav_2)

Collapses the val of SyntheticCube within the boundaries wav_1 and wav_2 into a 0D value val.

WARNING: This tool cannot replace convolve_filter!
But it can be used to produce rough estimates in-between the processes.
Parameters:

wav_1, wav_2 : float

Boundaries in microns.

Returns:

val : SyntheticFlux

plot_image(wav_interest, prefix=None, name=None, multi_cut=None, single_cut=None, set_cut=None, dpi=None)

Plots a certain slice close the wav_interest. The wavelength interval of the chosen slice labels the plot.

Parameters:

wav_interest : float, None

  • float : wavelength close to slice in microns.
  • None : Only if input_array is SyntheticImage like

prefix : str

Name of the image. Default naming chain is switched off.

name : str

Name of image within the default naming chain to distinguish the plot files. E. g. ‘PSF_gaussian’

mulit_cut : True, None

  • True : plots chosen image slice at cuts of [100, 99, 95, 90]%.
  • None : no mulit-plot is returned.

Default is None.

single_cut : float, None

  • float : cut level for single plot of image slice between 0 and 100.
  • None : no single plot is returned.

set_cut : tuple, None

  • tuple : set_cut(v_min, v_max)
    Minimal and maximal physical value of val in the colorbars.
  • None : no plot with minimal and maximal cut is returned.

Default is None.

dpi : None, scalar > 0

The resolution in dots per inch. None is default and will use the value valig.dpi in the matplotlibrc file.

Returns:

cube : SyntheticCube