Improve error message for common typos in tags
Using the following code with a typo in the tag event_type
, which should be eventtype
import apd
datasets = apd.AnalysisData("RD", "lb2lll")
mc = datasets(
version="v0r0p4590941",
datatype=["2011", "2012", "2015", "2016", "2017", "2018"],
polarity=["magup", "magdown"],
data=False,
stream="leptonic",
event_type="15124102",
)
the output of apd
tells me no samples are found.
[legreeve@lxplus7112 Lb2LemuAna]$ lb-conda default python tuples/python/get_AP_paths.py
Traceback (most recent call last):
File "/afs/cern.ch/work/l/legreeve/private/Lb2LemuAna/tuples/python/get_AP_paths.py", line 6, in <module>
mc = datasets(
File "/cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-10-05_11-34/linux-64/lib/python3.9/site-packages/apd/analysis_data.py", line 289, in __call__
raise ValueError("Error loading data: " + error_txt)
ValueError: Error loading data: 12 problem(s) found
{'config': 'mc', 'datatype': '2011', 'polarity': 'magup', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2011', 'polarity': 'magdown', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2012', 'polarity': 'magup', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2012', 'polarity': 'magdown', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2015', 'polarity': 'magup', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2015', 'polarity': 'magdown', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2016', 'polarity': 'magup', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2016', 'polarity': 'magdown', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2017', 'polarity': 'magup', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2017', 'polarity': 'magdown', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2018', 'polarity': 'magup', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
{'config': 'mc', 'datatype': '2018', 'polarity': 'magdown', 'stream': 'leptonic', 'event_type': '15124102', 'version': 'v0r0p4590941'}: 0 samples
It would be helpful for the user if an error message was raised for common typos in the "default" tags, something like
No samples found with tag `event_type`
Did you mean `eventtype`?