API#

pandisc.model#

Functions to compute the pandisc model. For the formulation please refer to the documentation.

pandisc.model.pandisc_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/𝜋,2/𝜋)

  • 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) – array, recording the axis to compute the model

Returns

array of the computed model

Return type

numpy.ndarray

pandisc.model.pandisc_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) – array, recording the axis to compute the model

Returns

array of the computed model

Return type

numpy.ndarray

pandisc.model.pandisc_model(para, v_arr)[source]#

compute the full pandisc model

Parameters
  • para (list or tuple or numpy.ndarray) – list or tuple or array, containing all seven parameters in the order of (v_r, k, v_sigma, r, v_g, f, v_c)

  • v_arr (numpy.ndarray) – array, recording the axis to compute the model

Returns

array of the computed model

Return type

numpy.ndarray

pandisc.model.pandisc_model_parts(para, v_arr)[source]#

return the disk and gaussian components separately, useful for plotting

Parameters
  • para (list or tuple or numpy.ndarray) – list or tuple or array, containing all seven parameters in the order of (v_r, k, v_sigma, r, v_g, f, v_c)

  • v_arr (numpy.ndarray) – array, recording the axis to compute the model

Returns

array of the computed model

Return type

numpy.ndarray

pandisc.fit#

Functions for MCMC fit formulation

pandisc.fit.pandisc_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) – array, recording the axis to compute the model

Returns

array of the computed model

Return type

numpy.ndarray

pandisc.fit.pandisc_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) – array, recording the axis to compute the model

Returns

array of the computed model

Return type

numpy.ndarray

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