esrf-bliss / Lima-camera-basler

Lima basler plugin
lima.blissgarden.org
GNU General Public License v3.0
4 stars 26 forks source link

Invalid command SetROI for Pilatus when startAcq #33

Closed qinwenming closed 2 years ago

qinwenming commented 2 years ago

When I run the startAcq command from jive of lima-camera-pilatus, it shows the following error: "Invalid command: SetROI". For Pilatus detector, it says "ROI readout is not supported for this detector!".
I found the PilatusCamera.cpp file and it says like this:

void Camera::_resync() { if(m_has_cmd_setenergy) send("setenergy"); else send("setthreshold"); if(m_has_cmd_roi) send("setroi 0"); send("exptime"); send("expperiod"); send("nimages 1"); std::stringstream cmd; cmd<<"imgpath "<<m_imgpath; send(cmd.str()); send("delay"); send("nexpframe"); send("setackint 0"); send("dbglvl 1"); send("version"); }

What should I do to avoid the SetROI command? Thanks a lot!

-Error: Exception(Error): Could not set roi to:roi_pattern=0, m_error_message= Invalid command: SetROI [thrown] [2022/04/11 17:29:46.199327] 2b1e3fd99700 CameraComPilatus::Camera::setRoi (/opt/conda/conda-bld/lima-camera-pilatus_1626157356241/work/src/PilatusCamera.cpp:1200)-Error: Exception(Error): Could not set roi to:roi_pattern=0, m_error_message= Invalid command: SetROI [thrown] [2022/04/11 17:29:50.828199] 2b1e3fd99700 ControlControl::Control::startAcq (/opt/conda/conda-bld/lima-core_1648541428893/work/control/src/CtControl.cpp:604)-Error: Exception(Error): Run prepare Acq before starting acquisition [thrown]

laurent-claustre commented 2 years ago

Dear Wenming,

Could you tell me which pilatus model you are running a Pilatus 2 or 3 and model X or model S?

Only pilatus 3 and model X is supporting Hardware ROI, but Lima cannot detect if it is a model X or S. According to you answer I will tell you how to update the camera.def file provided by Dectris to add model identifier for Lima.

I need to know if you are up to date with Lima too. For the fix you need to have the lima-camera-pilatus conda package version 1.9.3 or upper.

Best regards,

Laurent

qinwenming commented 2 years ago

Dear Laurent,

Thank you very much for your reply. The detector we are using is Pilatus 3-2M, model S.

And we installed the lima-camera-pilatus-tango using the conda command like this :" conda install -c conda-forge -c esrf-bcu -c tango-controls lima-camera-pilatus-tango". the version of the lima-camera-pilatus should be the latest, and the version is 1.9.5. Thanks a lot.

Best regards, Wenming

laurent-claustre commented 2 years ago

can you upload here your camera.def file? You should find the file under ~det/p2_det/config/cam_data/ or /opt/p2_det/config/cam_data/ Then I will send you a patched file.

qinwenming commented 2 years ago

Dear Laurent, Thanks a lot. Here is the camera.def file.

camera.def - a camera definition file for PILATUS detectors

These parameters are loaded during initialization.

Parameters are recognized by code in cam_tbl.c, which can be easily extended.

A different file may be loaded from the command line during operation

camera_name = "PILATUS3 S_2M, SN 24-0161"

camera_bpp = 32 camera_sensor = "Silicon sensor, thickness 0.000450" camera_pixel_xy = "Pixel_size 172e-6 m x 172e-6 m" camera_wide = 254 camera_high = 289

following should be in cam_data_path - configures signals for I2C

i2c_configuration_file pidet.def

following should be in cam_data_path - configures detector hardware map for Arosa-based systems

module_map module.map

following should be in cam_data_path - gives CPU assignment for Arosa-based systems

cpu_assignment cpu_assignment.txt

following should be in cam_data path

this file specifies settings as a function of energy and gain

detector_calibration_file calibrations.def

following should be 0 for a standard calibration (default), 1 for an additional uhighg calibration

detector_uhighg_calibration 0

following should be in cam_data path - default rate correction LUT (PILATUS3)

detector_rate_correction_directory ratecorrection

default rate correction LUT - subdirectory of rate correction directory (PILATUS3)

detector_rate_correction_lut ContinuousStandard_v1.1

Sampling delay train values

detector_train_values sampling_delay_train_values.dat

Normal data use lvl_1; inverted data use lvl_0; default is lvl_1.

asserted_level_of_DATA lvl_1

the fifo records 16-bit wide data (actually 32), corresponding to images

from 16 chips. Here we select the active bit for each chip's image.

all 0's ends the list.

The selector bits can be in any order, but the images (0, 1, ...)

must be in order and contiguous because the first zero ends the array.

Bit order 16 -2- 1 16 -1- 1

data_selector_image_0 0000 0000 0000 0000 0000 0000 0000 0001 # chip data_selector_image_1 0000 0000 0000 0000 0000 0000 0000 0010 data_selector_image_2 0000 0000 0000 0000 0000 0000 0000 0100 data_selector_image_3 0000 0000 0000 0000 0000 0000 0000 1000 data_selector_image_4 0000 0000 0000 0000 0000 0000 0001 0000 data_selector_image_5 0000 0000 0000 0000 0000 0000 0010 0000 data_selector_image_6 0000 0000 0000 0000 0000 0000 0100 0000 data_selector_image_7 0000 0000 0000 0000 0000 0000 1000 0000 data_selector_image_8 0000 0000 0000 0000 0000 0001 0000 0000 data_selector_image_9 0000 0000 0000 0000 0000 0010 0000 0000 data_selector_image_10 0000 0000 0000 0000 0000 0100 0000 0000 data_selector_image_11 0000 0000 0000 0000 0000 1000 0000 0000 data_selector_image_12 0000 0000 0000 0000 0001 0000 0000 0000 data_selector_image_13 0000 0000 0000 0000 0010 0000 0000 0000 data_selector_image_14 0000 0000 0000 0000 0100 0000 0000 0000 data_selector_image_15 0000 0000 0000 0000 1000 0000 0000 0000 data_selector_image_16 0000 0000 0000 0000 0000 0000 0000 0000 # 0's to end

detector_enable_single_node_configuration 1


best regards,

Wenming

laurent-claustre commented 2 years ago

ok, edit this file and add the following line (as a new line), just after the line camera_name = "PILATUS3 S_2M, SN 24-0161": camera_s_serie

Then restart the LimaCCDs device server, it should fix the issue.

Your file will then contain:

..... camera_name = "PILATUS3 S_2M, SN 24-0161" camera_s_serie

camera_bpp = 32 camera_sensor = "Silicon sensor, thickness 0.000450" camera_pixel_xy = "Pixel_size 172e-6 m x 172e-6 m" camera_wide = 254 camera_high = 289 .....

qinwenming commented 2 years ago

Dear Laurent,

Thanks a lot. It looks like the ROI issue is solved, but we got a new issue. When I sent prepareAcq command from mxcube, it shown an exception error that "Directory can't be created[thrown] as following, even if I reinstalled the conda with root and start "limaCCDs 1" instance with root. Would you please have a look for us.

[root@localhost bin]# ./LimaCCDs 1 [2022/04/14 18:01:49.822630] 2b2ba96fe880 ApplicationLima.Server.LimaCCDs::LimaCCDs::apply_config-Always: Applied config : /root/lima_1.cfg : default [2022/04/14 18:09:45.216863] 2b2c25c23700 ControlCtSaving::Stream::checkWriteAccess (/opt/conda/conda-bld/lima-core_1648541428893/work/control/src/CtSaving.cpp:2867)-Error: Exception(Error): Directory : can't be created [thrown] [2022/04/14 18:09:45.229420] 2b2c25c23700 ControlControl::Control::startAcq (/opt/conda/conda-bld/lima-core_1648541428893/work/control/src/CtControl.cpp:604)-Error: Exception(Error): Run prepareAcq before starting acquisition [thrown] ^[a[2022/04/14 18:18:16.353386] 2b2c27e24700 ControlCtSaving::Stream::checkWriteAccess (/opt/conda/conda-bld/lima-core_1648541428893/work/control/src/CtSaving.cpp:2867)-Error: Exception(Error): Directory : can't be created [thrown]

Best regards, Wenming

laurent-claustre commented 2 years ago

Dear Wenming, the exception message isn't clear enough? you tried to save the image in a directory ("", an empty one) where the device server does not have permission to create directories and files, see exception at [2022/04/14 18:09:45.216863] . Check why mxcube did set the "saving_directory" attribute of the LimaCCDs device to "".

qinwenming commented 2 years ago

Dear Laurent,

Thank you very much. The issue is solved by setting the saving_directory attribute.

Best regards, Wenming