run_path

zdm.optical_numerics.run_path(name, P_U=0.1, usemodel=False, sort=False)[source]

Run the PATH algorithm on a single FRB and return host association results.

Loads the FRB object and its pre-generated PATH candidate table from the frb package, applies colour corrections to convert candidate magnitudes to r-band (using fixed offsets: I → R: +0.65, g → R: −0.65), sets up the FRB localisation ellipse and offset prior, and evaluates PATH posteriors.

The magnitude prior used for the candidates is:

  • usemodel=False: PATH’s built-in 'inverse' prior (uniform in log surface density).

  • usemodel=True: the 'user' prior, which must be set externally by pointing pathpriors.USR_raw_prior_Oi at a model_wrapper method before calling this function (typically done by wrapper.init_path_raw_prior_Oi).

The offset prior is always the 'exp' model from PATH’s 'adopted' standard priors, with scale 0.5 arcsec.

Parameters:
  • name (str) – TNS name of the FRB (e.g. 'FRB20180924B').

  • P_U (float, optional) – Prior probability that the true host galaxy is undetected. Defaults to 0.1.

  • usemodel (bool, optional) – If True, use the externally set user prior for candidate magnitudes. Defaults to False.

  • sort (bool, optional) – If True, sort the returned arrays by P(O|x) in ascending order. Defaults to False.

Returns:

  • P_O (np.ndarray) – Prior probability P(O_i) for each candidate host galaxy.

  • P_Ox (np.ndarray) – Posterior probability P(O_i|x) for each candidate.

  • P_Ux (float) – Posterior probability P(U|x) that the true host is undetected.

  • mags (np.ndarray) – R-band apparent magnitudes of the candidates (after colour correction).

  • ptbl (pd.DataFrame) – Full PATH candidate table loaded from the CSV file, with an additional 'frb' column set to name.