Analysis¶
Classes related to results analysis.
API¶
Classes:
Analysis
(config[, model, kin_set])Class to hold results' analysis methods.
Decomposition
([config, model, kin_set])Class for decomposition.
- class analysis.Analysis(config, model=None, kin_set=0)¶
Class to hold results’ analysis methods.
This class contains methods that help analyzing DYANMITE results and can be called, e.g. by plotting routines.
- Parameters:
- configa
dyn.config_reader.Configuration
object- modela
dyn.model.Model
object, optional, default: best model so far- kin_setint, optional, default: 0
Methods:
get_gh_model_kinematic_maps
([model, ...])Generates an astropy table in the model directory that holds the model's data for creating Gauss-Hermite kinematic maps: v, sigma, h3 .
- get_gh_model_kinematic_maps(model=None, kin_set=None, v_sigma_option='fit', kinematics_as='table', weights=None)¶
Generates an astropy table in the model directory that holds the model’s data for creating Gauss-Hermite kinematic maps: v, sigma, h3 … h<number_GH>. v and sigma are either directly calculated from the model’s losvd histograms or from fitting a Gaussian in each aperture.
- Parameters:
- modela
dyn.model.Model
object, optionalThe default is the Analysis object’s model.
- kin_setint, optional
Which kinematics set to use. The default is the Analysis object’s kin_set.
- v_sigma_optionstr, optional
If ‘fit’, v_mean and v_sigma are calculated based on fitting Gaussians, if ‘moments’, v_mean and v_sigma are calculated directly from the model’s losvd histograms. The default is ‘fit’.
- kinematics_asstr, optional
If ‘table’, return
gh_table
, the model’s kinematics as an astropy table, if ‘file’, write the table to disk in ascii.ecsv format and return its full pathf_name
, if ‘both’, write the table to disk and return a tuple(gh_table, f_name)
. The default is ‘table’.- weights
numpy.array
like, optionalOrbital weights to use. The default is
None
and will determine the weights viamodel.get_weights(orblib)
.- Returns:
- gh_tableastropy table (if kinematics_as=’table’)
The astropy table holding the model’s gh kinematics.
- f_namestr (if kinematics_as=’file’)
The file name (full path) of the astropy table holding the model’s gh kinematics.
- (gh_table, f_name)tuple (if kinematics_as=’both’)
- Raises:
- ValueError
if v_sigma_option or kinematics_as are invalid.
- class analysis.Decomposition(config=None, model=None, kin_set=0)¶
Class for decomposition.
Upon instatiating, the orbits are decomposed by the method
decompose_orbits
and the results stored in astropy tableself.decomp
. The components’ flux and moments (currently mean velocity and velocity dispersion only) are plotted by callingself.plot_decomp
which also writes the plotted data into the model directory.The methodology in this class has been contributed by Giulia Santucci. Please cite Santucci+22, ApJ 930, 2, 153 if used.
- Parameters:
- configa
dyn.config_reader.Configuration
object, mandatory- modela
dyn.model.Model
object, optionalDetermines which model is used. If model = None, the model corresponding to the minimum chisquare (so far) is used; the setting in the configuration file’s parameter settings is used to determine which chisquare to consider. The default is None.
- kin_setint, optional
Determines which kinematic set to use. The value of this parameter is the index of the data set (e.g. kin_set=0, kin_set=1). The default is 0.
- Raises:
- ValueError
if no config object is given or the kin_set does not exist.
Methods:
comps_aphist
([v_sigma_option])Calculate components' flux, mean velocity, and velocity dispersion.
decompose_orbits
([ocut])Decompose orbits based on lambda_z.
plot_comps
(xlim, ylim, comp_kinem_moments[, ...])Generate decomposition plots.
plot_decomp
(xlim, ylim[, v_sigma_option])Generate decomposition plots.
- comps_aphist(v_sigma_option='fit')¶
Calculate components’ flux, mean velocity, and velocity dispersion.
- Parameters:
- v_sigma_optionstr, optional
If ‘fit’, v_mean and v_sigma are calculated based on fitting Gaussians, if ‘moments’, v_mean and v_sigma are calculated directly from the model’s losvd histograms. The default is ‘fit’.
- Returns:
- comp_flux_v_sigmaastropy table
The table columns are: aperture index (starting with 0), followed by three columns per component holding the flux, mean velocity, and velocity dispersion. The chosen v_sigma_option is in the table meta data.
- Raises:
- ValueError
if v_sigma_option is neither ‘moments’ nor ‘fit’.
- decompose_orbits(ocut=None)¶
Decompose orbits based on lambda_z.
- Parameters:
- ocutlist of floats, optional
The cuts in lambda_z. The default is None, which translates to ocut=[0.8, 0.25, -0.25], the selection in lambda_z following Santucci+22.
- Returns:
- decompastropy table
The table has two columns,
id
andcomponent
. The former is the orbit id (starting with 0),component
is a string describing the component(s) an orbit belongs to. Note that an orbit can belong to multiple components. In that case, the component strings are concatenated. For easier parsing later, the component descriptors are surrounded by pipe symbols|
. The table’s meta datacomps
holds a list of all components.
- plot_comps(xlim, ylim, comp_kinem_moments, figtype='.png')¶
Generate decomposition plots.
- Parameters:
- xlimfloat
restricts plot x-coordinates to abs(x) <= xlim.
- ylimfloat
restricts plot y-coordinates to abs(y) <= ylim.
- comp_kinem_momentsastropy table
The table columns are: aperture index (starting with 0), followed by three columns per component holding the flux, mean velocity, and velocity dispersion. The chosen v_sigma_option is in the table meta data.
- figtypestr, optional
Determines the file format and extension to use when saving the figure. The default is ‘.png’.
- Returns:
- None.
- plot_decomp(xlim, ylim, v_sigma_option='fit')¶
Generate decomposition plots.
- Parameters:
- xlimfloat
restricts plot x-coordinates to abs(x) <= xlim.
- ylimfloat
restricts plot y-coordinates to abs(y) <= ylim.
- v_sigma_optionstr, optional
If ‘fit’, v_mean and v_sigma are calculated based on fitting Gaussians, if ‘moments’, v_mean and v_sigma are calculated directly from the model’s losvd histograms. The default is ‘fit’.
- Returns:
- None.