```
In [1]:
```import localgroup
import triangle, pickle, matplotlib, numpy as np
matplotlib.rc('text', usetex=True)
%matplotlib inline

For this demo, we'll load in some pre-computed objects and use them to illustrate the inference we are trying to do.

We approximate the local group distance, radial velocity and proper motion likelihood function by sampling from the posterior distributions for these variables reported in the literature, and then transforming to kinematic variables in the M31-centric coordinate system.

```
In [2]:
```L = pickle.load(open("data/Likelihood_demo.p",'rb'))

```
In [3]:
```observation_significance = L.plot_samples(4, overlay=True)

```
```

```
In [5]:
```goodness_of_fit = L.model_gof(L.T.Nsamples)

```
```

```
In [6]:
```Model = pickle.load(open("data/Triplet_demo.p", 'rb'))

`Model`

is loaded from the file Triplet_demo.p. It contains 5000 triplets from Consuelo stored in the field `Model.sim_samples`

. The halo masses are stored as `Model.{MW, M33, M31}.Mvir`

. The `sim_samples`

have been preprocessed by the means and standard deviations of the Likelihood object, so that the likelihood of each one can be accurately evaluated by `L.evaluate(Model.sim_samples)`

.

```
In [7]:
```prior = Model.plot_kinematics()

```
```