aps-8id-dys / ipython-8idiuser

8-ID-I ipython configuration for bluesky (and other)
1 stars 1 forks source link

Lambda2M crashed at `dm_workflow.detectors.getDetectorByNumber()` #291

Closed qzhang234 closed 2 years ago

qzhang234 commented 2 years ago

@prjemian Please see the error defined. It looks like we are missing some kind of setup/configuration file in spec_support/detector_parameters.py?

Terminal_Output.txt

qzhang234 commented 2 years ago

@prjemian @sureshnaps Here's the difference when running the same function dm_workflow.detectors.getDetectorByNumber() with the Eiger's detector number and Lambda2M's detector number:

In [4]: 

In [4]: dm_workflow.detectors.getDetectorByNumber(30)
Out[4]: 
{'ccdHardwareColSize': 1030,
 'ccdHardwareRowSize': 514,
 'ccdxsense': 1,
 'ccdzsense': 1,
 'harmonic': 1,
 'dpix': 0.075,
 'saturation': 4095,
 'adupphot': 1.0,
 'efficiency': 1.0,
 'gain': 1,
 'blemish': 1,
 'flatfield': 1,
 'distortion': 0,
 'parasitic': 0,
 'lld': 0,
 'manufacturer': 'EIGER'}

In [5]: dm_workflow.detectors.getDetectorByNumber(27)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 dm_workflow.detectors.getDetectorByNumber(27)

File /home/beams10/8IDIUSER/.ipython-bluesky/profile_bluesky/startup/spec_support/detector_parameters.py:33, in PythonDict.getDetectorByNumber(self, detNum)
     32 def getDetectorByNumber(self, detNum):
---> 33     return self.masterDict[detNum]

KeyError: 27

In [6]: 
prjemian commented 2 years ago

As you concluded in the Teams discussion, the catalog of detectors available for use by SPEC and Bluesky is defined by a Matlab file (detectorinfo.m). This file is read into a Python dictionary: https://github.com/aps-8id-dys/ipython-8idiuser/blob/44c7e4f36042832bb7c93511cbdfb6d35ee847d5/profile_bluesky/startup/spec_support/detector_parameters.py#L44-L45

I believe the beam line's choice is to update this file from Matlab.

prjemian commented 2 years ago

So, when this code: https://github.com/aps-8id-dys/ipython-8idiuser/blob/44c7e4f36042832bb7c93511cbdfb6d35ee847d5/profile_bluesky/startup/instrument/plans/xpcs_acquire.py#L147

calls this code: https://github.com/aps-8id-dys/ipython-8idiuser/blob/44c7e4f36042832bb7c93511cbdfb6d35ee847d5/profile_bluesky/startup/spec_support/detector_parameters.py#L32-L33

it failed to find detector number 27.

qzhang234 commented 2 years ago

Suresh added definition for the detector. Issue fixed.