Remove use of simulate_dataset from mcmc tutorial
" GaussianSpatialModel,\n",
" SkyModel,\n",
")\n",
- "from gammapy.cube.simulate import simulate_dataset\n",
+ "from gammapy.cube import MapDataset, MapDatasetMaker\n",
+ "from gammapy.data import Observation\n",
"from gammapy.modeling.sampling import (\n",
" run_mcmc,\n",
" par_to_model,\n",
"source": [
"irfs = load_cta_irfs(\n",
" \"$GAMMAPY_DATA/cta-1dc/caldb/data/cta/1dc/bcf/South_z20_50h/irf_file.fits\"\n",
+ ")\n",
+ "\n",
+ "observation = Observation.create(\n",
+ " pointing=SkyCoord(0 * u.deg, 0 * u.deg, frame=\"galactic\"),\n",
+ " livetime=20 * u.h,\n",
+ " irfs=irfs\n",
")"
]
},
" skydir=(0, 0), binsz=0.05, width=(2, 2), frame=\"galactic\", axes=[axis]\n",
")\n",
"\n",
- "# Define some observation parameters\n",
- "pointing = SkyCoord(0 * u.deg, 0 * u.deg, frame=\"galactic\")\n",
- "\n",
- "\n",
- "dataset = simulate_dataset(\n",
- " sky_model_simu, geom, pointing, irfs, livetime=20 * u.h, random_state=42\n",
- ")"
+ "empty_dataset = MapDataset.create(geom=geom)\n",
+ "maker = MapDatasetMaker(selection=[\"background\", \"edisp\", \"psf\", \"exposure\"])\n",
+ "dataset = maker.run(empty_dataset, observation)\n",
+ "dataset.models = sky_model_simu\n",
+ "dataset.fake()"
]
},
{
