Closed steob92 closed 7 months ago
Now provides an error to inform the user that the files don't exist in the data store:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File /opt/conda/lib/python3.10/site-packages/gammapy_tools/make_background/prepare_data.py:55, in prepare_dataset(config)
54 try:
---> 55 data_store.copy_obs(obs_in_db, in_dir)
56 except Exception as e:
File /opt/conda/lib/python3.10/site-packages/gammapy/data/data_store.py:436, in DataStore.copy_obs(self, obs_id, outdir, hdu_class, verbose, overwrite)
435 with hdutable.index_mode("discard_on_copy"):
--> 436 subhdutable = hdutable.loc[obs_id]
437 if hdu_class is not None:
File /opt/conda/lib/python3.10/site-packages/astropy/table/index.py:882, in TableLoc.__getitem__(self, item)
881 if len(rows) == 0: # no matches found
--> 882 raise KeyError(f"No matches found for key {item}")
883 elif len(rows) == 1: # single row
KeyError: 'No matches found for key []'
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 config = prepare_dataset(config)
File /opt/conda/lib/python3.10/site-packages/gammapy_tools/make_background/prepare_data.py:58, in prepare_dataset(config)
56 except Exception as e:
57 if len(obs_in_db) == 0:
---> 58 raise RuntimeError(
59 f"Observations cannot be found in {db_dir}, do these files exist?"
60 ) from e
61 else:
62 raise RuntimeError("Error copying files") from e
RuntimeError: Observations cannot be found in /local_data/VERITAS/DL3/v490/dl3_fullenclosure_moderate2tel, do these files exist?
If no runs are found. Need to check length of
obs_in_db