def copy_obs(self, obs_id, outdir, hdu_class=None, verbose=False, overwrite=False):
    'Create a new `~gammapy.data.DataStore` containing a subset of observations.\n\n        Parameters\n        ----------\n        obs_id : array-like, `~gammapy.data.ObservationTable`\n            List of observations to copy\n        outdir : str, Path\n            Directory for the new store\n        hdu_class : list of str\n            see :attr:`gammapy.data.HDUIndexTable.VALID_HDU_CLASS`\n        verbose : bool\n            Print copied files\n        overwrite : bool\n            Overwrite\n        '
    outdir = make_path(outdir)
    if isinstance(obs_id, ObservationTable):
        obs_id = obs_id['OBS_ID'].data
    hdutable = self.hdu_table
    hdutable.add_index('OBS_ID')
    with hdutable.index_mode('discard_on_copy'):
        subhdutable = hdutable.loc[obs_id]
    if (hdu_class is not None):
        subhdutable.add_index('HDU_CLASS')
        with subhdutable.index_mode('discard_on_copy'):
            subhdutable = subhdutable.loc[hdu_class]
    subobstable = self.obs_table.select_obs_id(obs_id)
    for idx in range(len(subhdutable)):
        loc = subhdutable.location_info(idx)
        targetdir = (outdir / loc.file_dir)
        targetdir.mkdir(exist_ok=True, parents=True)
        cmd = (['cp', '-v'] if verbose else ['cp'])
        if (not overwrite):
            cmd += ['-n']
        cmd += [str(loc.path()), str(targetdir)]
        subprocess.call(cmd)
    filename = str((outdir / self.DEFAULT_HDU_TABLE))
    subhdutable.write(filename, format='fits', overwrite=overwrite)
    filename = str((outdir / self.DEFAULT_OBS_TABLE))
    subobstable.write(filename, format='fits', overwrite=overwrite)
Create a new `~gammapy.data.DataStore` containing a subset of observations.

Parameters
----------
obs_id : array-like, `~gammapy.data.ObservationTable`
    List of observations to copy
outdir : str, Path
    Directory for the new store
hdu_class : list of str
    see :attr:`gammapy.data.HDUIndexTable.VALID_HDU_CLASS`
verbose : bool
    Print copied files
overwrite : bool
    Overwrite
def copy_obs(self, obs_id, outdir, hdu_class=None, verbose=False, overwrite=False):
    'Create a new `~gammapy.data.DataStore` containing a subset of observations.\n\n        Parameters\n        ----------\n        obs_id : array-like, `~gammapy.data.ObservationTable`\n            List of observations to copy\n        outdir : str, Path\n            Directory for the new store\n        hdu_class : list of str\n            see :attr:`gammapy.data.HDUIndexTable.VALID_HDU_CLASS`\n        verbose : bool\n            Print copied files\n        overwrite : bool\n            Overwrite\n        '
    outdir = make_path(outdir)
    if isinstance(obs_id, ObservationTable):
        obs_id = obs_id['OBS_ID'].data
    hdutable = self.hdu_table
    hdutable.add_index('OBS_ID')
    with hdutable.index_mode('discard_on_copy'):
        subhdutable = hdutable.loc[obs_id]
    if (hdu_class is not None):
        subhdutable.add_index('HDU_CLASS')
        with subhdutable.index_mode('discard_on_copy'):
            subhdutable = subhdutable.loc[hdu_class]
    subobstable = self.obs_table.select_obs_id(obs_id)
    for idx in range(len(subhdutable)):
        loc = subhdutable.location_info(idx)
        targetdir = (outdir / loc.file_dir)
        targetdir.mkdir(exist_ok=True, parents=True)
        cmd = (['cp', '-v'] if verbose else ['cp'])
        if (not overwrite):
            cmd += ['-n']
        cmd += [str(loc.path()), str(targetdir)]
        subprocess.call(cmd)
    filename = str((outdir / self.DEFAULT_HDU_TABLE))
    subhdutable.write(filename, format='fits', overwrite=overwrite)
    filename = str((outdir / self.DEFAULT_OBS_TABLE))
    subobstable.write(filename, format='fits', overwrite=overwrite)