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

Versioning problem within pylhe? #2

Open munozariasjm opened 2 years ago

munozariasjm commented 2 years ago

I am able to replicate this strange error, which seems to be related with the versions as discussed

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py in <cell line: 13>()
      [18](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=17)     df_signal = pd.DataFrame(file_manipulator.scan)
     [19](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=18)     return df_signal
---> [22](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=21) df_signal = scan_signal()

/home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py in scan_signal()
      [11](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=10) search_path = "../Datalake/Signal/*.lhe"
      [13](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=12) file_manipulator = nndm.FilesManipulator(
      [14](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=13)     search_path, var_of_interest=["e", "px", "py", "pz"]
      [15](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=14) )
----> [16](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=15) file_manipulator.fill_up_scan()
      [18](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=17) df_signal = pd.DataFrame(file_manipulator.scan)
     [19](file:///home/jose/MyDocs/PERSONAL/RESEARCH/EIA/conference_presentations/feature_eng/parametric.py?line=18) return df_signal

File ~/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py:473, in FilesManipulator.fill_up_scan(self)
    [471](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=470) # initialize scan dictionary as described above going over all the names
    [472](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=471) for i, name in enumerate(file_list):
--> [473](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=472)     read_file = ReadLhe(name, var_of_interest=self.var_of_interest, particle_ids=self.particle_ids, 
    [474](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=473)                         outgoing=self.outgoing, verbose=self.verbose)
    [475](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=474)     params = read_file.extract_params_from_path()
    [476](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=475)     if i == 0:            

File ~/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py:286, in ReadLhe.__init__(self, path, particle_ids, var_of_interest, outgoing, recursive, relabel_events, verbose)
    [282](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=281) self.relabel_events = relabel_events
    [284](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=283) self.data = self._init_data()
--> [286](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=285) ReadFileBase.__init__(self, path, ext=self.ext, recursive=self.recursive, relabel_events=self.relabel_events) 
    [287](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=286) self.data = pd.DataFrame.from_dict(self.data)

File ~/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py:89, in ReadFileBase.__init__(self, path, recursive, ext, relabel_events)
     [86](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=85) self.ext = ext
     [87](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=86) self.relabel_events = relabel_events
---> [89](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=88) self._read()

File ~/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py:234, in ReadFileBase._read(self)
    [230](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=229) """
    [231](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=230) General method to read independently from the initialization from the class.
    [232](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=231) """
    [233](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=232) self._fill_files_dir()
--> [234](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=233) self._read_single_file_safe()
    [235](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=234) self._read_recursive_files()

File ~/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py:165, in ReadFileBase._read_single_file_safe(self, path)
    [164](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=163) def _read_single_file_safe(self, path=''):
--> [165](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=164)     self._check_right_path_is_open(path)
    [167](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=166)     if os.path.isfile(self.file):
    [168](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=167)         _, ext = os.path.splitext(self.file)

File ~/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py:162, in ReadFileBase._check_right_path_is_open(self, path)
    [159](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=158) else:
    [160](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=159)     self.file = self.path
--> [162](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=161) self.read_object = self._read_func(self.file)

File ~/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py:321, in ReadLhe._read_func(self, path)
    [320](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=319) def _read_func(self, path):
--> [321](file:///home/jose/anaconda3/envs/envNNDMS_conferences/lib/python3.8/site-packages/nndm_library/utils/reading_utils.py?line=320)     return pylhe.readLHE(path)

AttributeError: module 'pylhe' has no attribute 'readLHE'
munozariasjm commented 2 years ago

Just to confirm, this issue only arises when the version of pylhe is 0.3.0 and does not occur when the version is 0.2.1