SSPs & IFU cubes
Contents
SSPs & IFU cubes#
MILES SSPs#
- class popkinmocks.milesSSPs(lmd_min=4700, lmd_max=6500, age_lim=None, z_lim=None, thin_age=1, thin_z=1)#
MILES SSP models
MILES models (Vazdekis et al. 2010) with BaSTI isochrones for base alpha-content (Pietrinferni et al. 2004) and a Chabrier (2003) IMF.
- Parameters
lmd_min (float) – min wavelength (Angstrom)
lmd_min – max wavelength (Angstrom)
age_lim (tuple) – (min, max) ages to keep (Gyr)
z_lim (tuple) – (min, max) metallicities to keep [M/H]
thin_age (int) – only use every thin_age-th age in SSP grid
thin_z (int) – only use every thin_z-th metallicity in SSP grid
- get_light_weights()#
Calculate light weights L(t,z) = int_lmd S(lmd;t,z) d lmd
Sets the result to self.light_weights
- get_ssp(ssp_id, spacing='wavelength')#
Get a single SSP model indexed by ssp_id
- Parameters
ssp_id (int) – index of the SSP to be returned
spacing (string, optional) – either ‘wavelength’ or ‘log-wavelength’
- set_tick_positions(t_ticks=None, z_ticks=None)#
Set tick positions for use in plotting
These ticks positions are used when plotting SSPs variables (t,z) in discrete units when using cube.plot(…, spacing=’discrete’) or when using cube.imshow.
- Parameters
t_ticks (list) – ages where you would like a tick (Gyr)
z_ticks (list) – metallicities where you’d like a tick [M/H]
IFUCube#
- class popkinmocks.ifu_cube.IFUCube(ssps=None, nx1=300, nx2=299, nv=200, x1rng=(- 1, 1), x2rng=(- 1, 1), vrng=(- 1000, 1000))#
The integral field unit (IFU) datacube
- Parameters
ssps – SSP templates in a pkm.model_grids.milesSSPs object
nx1 (int) – number of pixels in x1
nx2 (int) – number of pixels in x2
nv (int) – number of velocity bins
x1rng (tuple) – start/end co-ordinates in x1 (arbitrary units)
x2rng (tuple) – start/end co-ordinates in x2 (arbitrary units)
vrng (tuple) – start/end velocities in km/s
- construct_volume_element(which_dist)#
Construct volume element for converting densities to probabilties
- Parameters
which_dist (string) – which distribution to evaluate volume element for e.g. ‘vz’ returns dv*dz, ‘t_x’ returns dt
- Returns
The volume element shaped compatibly with which_dist
- Return type
array
- get_axis_label(which_dist)#
Get axis labels for plotting
- Parameters
which_variable (string) – which variable, one of (t, v, x1, x2, z)
- Returns
to be used in ax.set_label
- Return type
string
- get_distribution_shape(which_dist)#
Get shape of a distribution given its string
- Parameters
which_dist (string) – a valid distribution string.
- Returns
the shape of an array representing this distribution
- Return type
array
- get_variable_edges(which_variable)#
Get discretization bin edges of the variable v, x1, x2, t or z.
- Parameters
which_variable (string) – one of (t, v, x1, x2, z)
- Returns
the discretisation bin edges used for this variable
- Return type
array
- get_variable_size(which_variable)#
Get size of variable array
- Parameters
which_variable (string) – one of (t, v, x1, x2, z)
- Returns
the numer of discretisation elements for this variable
- Return type
array
- get_variable_values(which_variable)#
Get values of the variable v, x1, x2, t or z.
- Parameters
which_variable (string) – one of (t, v, x1, x2, z)
- Returns
the discretisation values used for this variable
- Return type
array
- imshow(img, ax=None, label_ax=True, colorbar=True, colorbar_label='', view=['x1', 'x2'], **kwargs)#
Wrapper around plt.imshow to orient image and label axes
- Parameters
img (array) – 2D image to show
ax (matplotlib axis) – optional, axis to plot on
label_ax (bool) – whether to show tick marks and labels
colorbar (bool) – whether to show colorbar
colorbar_label (string) – colorbar label
view (list) – list of two strings amongst [‘t’,’v’,’x1’,’x2’,’z’] representing the variables on the x- and y- axes of the image
**kwargs – keyword arguments passed to plt.imshow (must not include extent)
- Returns
a matplotlib AxesImage object
- plot(which_var, arr, *args, ax=None, xspacing='physical', **kwargs)#
Wrapper around plt.plot to plot 1D plots and label axes
- Parameters
which_var (string) – x-axis variable, one of (t, v, x1, x2, z)
arr (array) – y-axis data to plot
*args – any extra args passed to plt.plot
ax (matplotlib axis) – optional, axis to plot on
xspacing (string, optional) – physical or discrete. If physical, x-axis is spaced in physical units, otherwise with equally spaced points per discretization point
**kwargs (dict) – any extra kwargs passed to plt.plot
- Returns
a matplotlib AxesImage object
- plot_spectrum(arr, *args, ax=None, **kwargs)#
Wrapper around plt.plot to plot spectra
Automatically selects if sampled in log-wavelength or wavelength and chooses x-axis values appropriately
- Parameters
arr (array) – y-axis data to plot
*args – any extra
ax (matplotlib axis) – optional, axis to plot on
**kwargs (dict) – extra keyword parameters passed to plt.plot
- Returns
a matplotlib AxesImage object