API#
pandisc.model#
Functions to compute the pandisc model. For the formulation please refer to the documentation.
- pandisc.model.disk(v_r, k, v_sigma, f, v_c, v_arr)[source]#
compute the co-rotating disk part of the model, the integrated model flux is normalized to f
- Parameters:
v_r (float) – float, rotation velocity of the disk
k (float) – float, gradient of the angular distribution, defining the asymmetry of the line, should be in the range (-2/pi,2/pi)
v_sigma (float) – float, sigma of the disk velocity dispersion
f (float) – float, the integrated flux integrate(f_model dv) of the model
v_c (float) – float, velocity of the line center
v_arr (numpy.ndarray or float) – array, recording the axis to compute the model
- Returns:
array of the computed model, in the same shape as input v_arr
- Return type:
numpy.ndarray or float
- pandisc.model.gaussian(v_g, f, v_c, v_arr)[source]#
compute the gaussian component of the model, the integrated flux is normalized to f
- Parameters:
v_g (float) – float, sigma of the gaussian peak
f (float) – float, the integrated flux integrate(f_model dv) of the model
v_c (float) – float, velocity of the line center
v_arr (numpy.ndarray or float) – array, recording the axis to compute the model
- Returns:
array of the computed model, in the same shape as input v_arr
- Return type:
numpy.ndarray or float
- pandisc.model.model(v_r, k, v_sigma, r, v_g, f, v_c, v_arr)[source]#
compute the full pandisc model
- Parameters:
v_r (float) – float, rotation velocity of the disk
k (float) – float, gradient of the angular distribution, defining the asymmetry of the line, should be in the range (-2/pi,2/pi)
v_sigma (float) – float, sigma of the disk velocity dispersion
r (float) – float, fraction of the integrated flux in the disk component
v_g (float) – float, sigma of the gaussian peak
f (float) – float, the integrated flux integrate(f_model dv) of the model
v_c (float) – float, velocity of the line center
v_arr (numpy.ndarray or float) – array, recording the axis to compute the model
- Returns:
array of the computed model, in the same shape as input v_arr
- Return type:
numpy.ndarray or float
- pandisc.model.model_parts(v_r, k, v_sigma, r, v_g, f, v_c, v_arr)[source]#
return the disk and gaussian components separately, useful for plotting
- Parameters:
v_r (float) – float, rotation velocity of the disk
k (float) – float, gradient of the angular distribution, defining the asymmetry of the line, should be in the range (-2/pi,2/pi)
v_sigma (float) – float, sigma of the disk velocity dispersion
r (float) – float, fraction of the integrated flux in the disk component
v_g (float) – float, sigma of the gaussian peak
f (float) – float, the integrated flux integrate(f_model dv) of the model
v_c (float) – float, velocity of the line center
v_arr (numpy.ndarray or float) – array, recording the axis to compute the model
- Returns:
(disk, gaussian) parts of the model, each part is in the same shape as input v_arr
- Return type:
tuple[numpy.ndarray or float, numpy.ndarray or float]
- pandisc.model.disk_fwhm(v_r, v_sigma)[source]#
estimate the line full width half maximum of the disk component
- Parameters:
v_r (float) – float, rotation velocity of the disk
v_sigma (float) – float, sigma of the disk velocity dispersion
- Returns:
float, the estimated line width
- Return type:
float
- pandisc.model.disk_peak_width(v_r, v_sigma)[source]#
estimate the line width between the two peaks of the disk component
- Parameters:
v_r (float) – float, rotation velocity of the disk
v_sigma (float) – float, sigma of the disk velocity dispersion
- Returns:
float, the estimated line width between peaks
- Return type:
float
- pandisc.model.disk_peak_flux(v_r, v_sigma, f)[source]#
estimate the flux density of the peaks of the disk component
- Parameters:
v_r (float) – float, rotation velocity of the disk
v_sigma (float) – float, sigma of the disk velocity dispersion
f (float) – float, the integrated flux of the disk component
- Returns:
float, the estimated line width between peaks
- Return type:
float
- pandisc.model.w50m(v_r, v_sigma, r, v_g)[source]#
estimate the W50 of the line based on the line model
- Parameters:
v_r (float) – float, rotation velocity of the disk
v_sigma (float) – float, sigma of the disk velocity dispersion
r (float) – float, fraction of the integrated flux in the disk component
v_g (float) – float, sigma of the gaussian peak
- Returns:
float, W50 model
- Return type:
float
pandisc.fit#
Functions for MCMC fit formulation on H I spectra. If you are interested in applying the model on other spectral line, the accepted range of 25 km/s might be too small, so you may want to change pandisc.SIGMA_MAX to higher value
- pandisc.fit.model_mcmc(para_mcmc, v_arr)[source]#
helper function for MCMC fit, to generate line model from the parameters used in fitting
- Parameters:
para_mcmc (list or tuple or numpy.ndarray) – list or tuple or array, containing the seven parameters used for MCMC fit, in the oder of (lg_v_r, k, v_sigma, r, lg_v_g, f, v_c)
v_arr (numpy.ndarray or float) – array, recording the axis to compute the model
- Returns:
array of the computed model, in the same shape as input v_arr
- Return type:
numpy.ndarray or float
- pandisc.fit.model_mcmc_parts(para_mcmc, v_arr)[source]#
return the disk and gaussian components separately using the set of the parameters used in MCMC fit
- Parameters:
para_mcmc (list or tuple or numpy.ndarray) – list or tuple or array, containing the seven parameters used for MCMC fit, in the oder of (lg_v_r, k, v_sigma, r, lg_v_g, f, v_c)
v_arr (numpy.ndarray or float) – array, recording the axis to compute the model
- Returns:
(disk, gaussian) parts of the model, each part is in the same shape as input v_arr
- Return type:
tuple[numpy.ndarray or float, numpy.ndarray or float]
- pandisc.fit.ln_priori_flat(para_mcmc, v_arr)[source]#
a flat priori function defined in the paper, only checking the range of the input parameters
- Parameters:
para_mcmc (list or tuple or numpy.ndarray) – list or tuple or array, containing the seven parameters used for MCMC fit, in the oder of (lg_v_r, k, v_sigma, r, lg_v_g, f, v_c)
v_arr (numpy.ndarray) – array, recording the axis to compute the model
- Returns:
float, log e of the priori
- Return type:
float
- pandisc.fit.ln_priori(para_mcmc, v_arr)[source]#
the priori function defined in the paper
- Parameters:
para_mcmc (list or tuple or numpy.ndarray) – list or tuple or array, containing the seven parameters used for MCMC fit, in the oder of (lg_v_r, k, v_sigma, r, lg_v_g, f, v_c)
v_arr (numpy.ndarray) – array, recording the axis to compute the model
- Returns:
float, log e of the priori
- Return type:
float
- pandisc.fit.ln_like(para_mcmc, v_arr, spec, sigma=2.23)[source]#
compute the log likelihood for the model parameter given the input spectrum, using a per-channel rms
- Parameters:
para_mcmc (list or tuple or numpy.ndarray) – list or tuple or array, containing the seven parameters used for MCMC fit, in the oder of (lg_v_r, k, v_sigma, r, lg_v_g, f, v_c)
v_arr (numpy.ndarray) – array, recording the axis to compute the model
spec (numpy.ndarray) – array, input spectrum to evaluate likelihood for the parameters, must have the same shape as v_arr
sigma (float) – float, sigma per channel used for evaluating likelihood
- Returns:
float, log likelihood of the input parameters
- Return type:
float
- pandisc.fit.ln_prob(para_mcmc, v_arr, spec, sigma=2.23)[source]#
compute the posterior likelihood of the input parameter, by combining priori and likelihood
- Parameters:
para_mcmc (list or tuple or numpy.ndarray) – list or tuple or array, containing the seven parameters used for MCMC fit, in the oder of (lg_v_r, k, v_sigma, r, lg_v_g, f, v_c)
v_arr (numpy.ndarray) – array, recording the axis to compute the model
spec (numpy.ndarray) – array, input spectrum to evaluate likelihood for the parameters, must have the same shape as v_arr
sigma (float) – float, sigma per channel used for evaluating likelihood
- Returns:
float, log posterior likelihood of the input parameters
- Return type:
float