DL-DM-RESEARCH-EIA / nndm_library

Here we will hold the library created to solve standart problems in particle physics
3 stars 0 forks source link

Feature: Tell no paths were found in recursive call #1

Open munozariasjm opened 2 years ago

munozariasjm commented 2 years ago

After no files were found we should add this message:

Exception: No files were found within the provided path.

:1st_place_medal: @Andresfgomez970

Andresfgomez970 commented 2 years ago

Hey there! I just cheeked and it is working properly for me. When trying to read a file with no .root or .lhe files in recursive mode or not it shows the message:

"Please check the existense of .root files in the specified directory tests/data_tests/signal or use recursive=True. "

I just correct the grammar error in the message above and change it to:

"Exception: No files were found within the provided path. Please check the existence of .{ext} files in the specified directory {path_to_dir} or use recursive=True."

Please let me know if it is working now in order to close the issue.

munozariasjm commented 2 years ago

Great, it returns None, or raises an Exception?

munozariasjm commented 2 years ago

I was checking. The lack seems to be in the ReadRoot for example, in this case, we get:

File ~/anaconda3/envs/envNNDMS_conference/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py:127, in ReadFileBase.assign_process_weights(self, file_weights)
    [124](file:///home/josemm/anaconda3/envs/envNNDMS_conference/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=123) def assign_process_weights(self, file_weights):
    [125](file:///home/josemm/anaconda3/envs/envNNDMS_conference/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=124)     weights_dir = json.load(open(file_weights))
--> [127](file:///home/josemm/anaconda3/envs/envNNDMS_conference/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=126)     self.data['weight'] = 0
    [129](file:///home/josemm/anaconda3/envs/envNNDMS_conference/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=128)     # Go over files for which we know the weight and modify
    [130](file:///home/josemm/anaconda3/envs/envNNDMS_conference/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=129)     #   and assign correct values for weitgh in dataframe if
    [131](file:///home/josemm/anaconda3/envs/envNNDMS_conference/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=130)     #   they share such procedence
    [132](file:///home/josemm/anaconda3/envs/envNNDMS_conference/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=131)     total = np.array(list(weights_dir.values())).sum()

AttributeError: 'ReadRoot' object has no attribute 'data'

In the case there was no file found

Andresfgomez970 commented 2 years ago

I think that I know that is happening now, but just to be sure that the problem is completely solve, can you show me the code that you are trying to run.