PaNOSC-ViNYL / SimEx

Start-to-end photon experiment simulation platform
https://simex.readthedocs.io/
GNU General Public License v3.0
26 stars 25 forks source link

CrystFELPhotonDiffractor read .geom file error #221

Closed JunCEEE closed 3 years ago

JunCEEE commented 3 years ago

AGIPD.geom

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-11-e3cf24268593> in <module>()
----> 1 diffractor.backengine()
      2 diffractor.saveH5_geom()

/gpfs/exfel/data/user/juncheng/simex-branch/Sources/python/SimEx/Calculators/CrystFELPhotonDiffractor.py in backengine(self)
    196 
    197         # pattern_sim backengine does not support MPI.
--> 198         return self._run()
    199 
    200         # collect MPI arguments

/gpfs/exfel/data/user/juncheng/simex-branch/Sources/python/SimEx/Calculators/CrystFELPhotonDiffractor.py in _run(self)
    244                 geom_string = "\n".join(tmp_geom_file.readlines())
    245 
--> 246             self.parameters.detector_geometry = _detectorGeometryFromString( geom_string )
    247 
    248         geom_file = tempfile.NamedTemporaryFile(suffix=".geom", delete=True)

/gpfs/exfel/data/user/juncheng/simex-branch/Sources/python/SimEx/Parameters/DetectorGeometry.py in _detectorGeometryFromString(input_string)
    605     import pdb; pdb.set_trace()
    606 
--> 607     panels = [_detectorPanelFromString(block, common_block) for block in panel_blocks]
    608 
    609     # Return novel geometry instance.

/gpfs/exfel/data/user/juncheng/simex-branch/Sources/python/SimEx/Parameters/DetectorGeometry.py in <listcomp>(.0)
    605     import pdb; pdb.set_trace()
    606 
--> 607     panels = [_detectorPanelFromString(block, common_block) for block in panel_blocks]
    608 
    609     # Return novel geometry instance.

/gpfs/exfel/data/user/juncheng/simex-branch/Sources/python/SimEx/Parameters/DetectorGeometry.py in _detectorPanelFromString(input_string, common_block)
    434 
    435     # Loop over common dict and fill into panel dict if not present there.
--> 436     for key,val in common_dict.items():
    437         if panel_dict[key] is None:
    438             panel_dict[key] = val

KeyError: 'dim0'
JunCEEE commented 3 years ago

Multiple panel .geom file is too complicated to handle by the _detectorPanelFromString and parameters.detector_geometry.serialize functions.

JunCEEE commented 3 years ago

This problem is solved by importing https://cfelpyutils.readthedocs.io/en/latest/index.html in DetectorGeometry.py