diff --git a/configuration/camera_config/SARCL01-DSCR170.json b/configuration/camera_config/SARCL01-DSCR170.json index 71ee4df..75102dc 100644 --- a/configuration/camera_config/SARCL01-DSCR170.json +++ b/configuration/camera_config/SARCL01-DSCR170.json @@ -2,9 +2,9 @@ "camera_calibration": { "reference_marker": [ 633, - 796, - 1465, - 1080 + 662, + 1456, + 939 ], "reference_marker_width": 6000.0, "reference_marker_height": 2000.0, diff --git a/configuration/camera_config/SARES11-SPEC125-M1.json b/configuration/camera_config/SARES11-SPEC125-M1.json index 885179a..842385b 100644 --- a/configuration/camera_config/SARES11-SPEC125-M1.json +++ b/configuration/camera_config/SARES11-SPEC125-M1.json @@ -22,6 +22,6 @@ "source": "SARES11-SPEC125-M1", "connections": 4, "buffer_size": 100, - "buffer_logs": true, + "buffer_logs": false, "protocol": "tcp" -} +} \ No newline at end of file diff --git a/configuration/camera_config/SARES11-SPEC125-M2.json b/configuration/camera_config/SARES11-SPEC125-M2.json index 14e4c93..91ef5fb 100644 --- a/configuration/camera_config/SARES11-SPEC125-M2.json +++ b/configuration/camera_config/SARES11-SPEC125-M2.json @@ -18,6 +18,7 @@ "name": "SARES11-SPEC125-M2", "prefix": "SARES11-SPEC125-M2", "source": "SARES11-SPEC125-M2", - "connections":4, - "buffer_size": 100 -} + "connections": 4, + "buffer_size": 100, + "protocol": "tcp" +} \ No newline at end of file diff --git a/configuration/camera_config/SARES20-CAMS142-C1.json b/configuration/camera_config/SARES20-CAMS142-C1.json index 71e8634..36e4033 100644 --- a/configuration/camera_config/SARES20-CAMS142-C1.json +++ b/configuration/camera_config/SARES20-CAMS142-C1.json @@ -1,10 +1,10 @@ { "camera_calibration": { "reference_marker": [ - 1347, - 1025, - 1501, - 1289 + 1120, + 876, + 1425, + 1103 ], "reference_marker_width": 102.9, "reference_marker_height": 176.0, @@ -20,9 +20,7 @@ "prefix": "SARES20-CAMS142-C1", "name": "SARES20-CAMS142-C1", "source": "SARES20-CAMS142-C1", - "alias": [ - "camera (SARES20-CAMS142-C1)" - ], + "alias": [], "group": [ "Photonics", "Bernina" diff --git a/configuration/camera_config/SARES20-CAMS142-C2.json b/configuration/camera_config/SARES20-CAMS142-C2.json index 8743e7f..680a858 100644 --- a/configuration/camera_config/SARES20-CAMS142-C2.json +++ b/configuration/camera_config/SARES20-CAMS142-C2.json @@ -1,10 +1,10 @@ { "camera_calibration": { "reference_marker": [ - 1000, - 684, - 1053, - 732 + 957, + 517, + 979, + 522 ], "reference_marker_width": 1.0, "reference_marker_height": 1.0, @@ -24,7 +24,5 @@ "Photonics", "Bernina" ], - "alias": [ - "samplecam_sideview (SARES20-CAMS142-C2)" - ] + "alias": [] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-CAMS142-C3.json b/configuration/camera_config/SARES20-CAMS142-C3.json index d867795..442214c 100644 --- a/configuration/camera_config/SARES20-CAMS142-C3.json +++ b/configuration/camera_config/SARES20-CAMS142-C3.json @@ -21,7 +21,7 @@ "name": "SARES20-CAMS142-C3", "source": "SARES20-CAMS142-C3", "alias": [ - "samplecam_xrd (SARES20-CAMS142-C3)" + "SAMPLECAM_XRD (SARES20-CAMS142-C3)" ], "group": [ "Photonics", diff --git a/configuration/camera_config/SARES20-CAMS142-M1.json b/configuration/camera_config/SARES20-CAMS142-M1.json index 516301c..7603ffb 100644 --- a/configuration/camera_config/SARES20-CAMS142-M1.json +++ b/configuration/camera_config/SARES20-CAMS142-M1.json @@ -1,17 +1,17 @@ { "camera_calibration": { "reference_marker": [ - 420, - 66, - 743, - 388 + 1457, + 673, + 1557, + 771 ], - "reference_marker_width": 200.0, - "reference_marker_height": 200.0, + "reference_marker_width": 1754.0, + "reference_marker_height": 1030.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, - "mirror_x": false, + "mirror_x": true, "mirror_y": false, "rotate": 0, "roi": null, @@ -25,6 +25,6 @@ "Bernina" ], "alias": [ - "samplecam_sideview (SARES20-CAMS142-M1)" + "CAM_SAMPLE_SIDEVIEW (SARES20-CAMS142-M1)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-CAMS142-M2.json b/configuration/camera_config/SARES20-CAMS142-M2.json index 74c03e0..be3fdd6 100644 --- a/configuration/camera_config/SARES20-CAMS142-M2.json +++ b/configuration/camera_config/SARES20-CAMS142-M2.json @@ -24,7 +24,5 @@ "Photonics", "Bernina" ], - "alias": [ - "samplecam_sideview(SARES20-CAMS142-M2)" - ] + "alias": [] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-CAMS142-M3.json b/configuration/camera_config/SARES20-CAMS142-M3.json index 189768a..3fdd911 100644 --- a/configuration/camera_config/SARES20-CAMS142-M3.json +++ b/configuration/camera_config/SARES20-CAMS142-M3.json @@ -1,18 +1,18 @@ { "camera_calibration": { "reference_marker": [ - 1084, - 962, - 1116, - 1027 + 1729, + 817, + 1829, + 917 ], - "reference_marker_width": 76.8, - "reference_marker_height": 144.1, + "reference_marker_width": 552.0, + "reference_marker_height": 586.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, "mirror_x": false, - "mirror_y": false, + "mirror_y": true, "rotate": 0, "roi": null, "image_background": null, @@ -25,6 +25,6 @@ "Bernina" ], "alias": [ - "inline_microscope" + "CAM_SAMPLE_INLINE (SARES20-CAMS142-M3)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-CAMS142-M4.json b/configuration/camera_config/SARES20-CAMS142-M4.json index a82bb9b..669a7fd 100644 --- a/configuration/camera_config/SARES20-CAMS142-M4.json +++ b/configuration/camera_config/SARES20-CAMS142-M4.json @@ -25,5 +25,6 @@ "group": [ "Photonics", "Bernina" - ] + ], + "alias": [] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-CAMS142-M5.json b/configuration/camera_config/SARES20-CAMS142-M5.json index 9d3ebea..118c797 100644 --- a/configuration/camera_config/SARES20-CAMS142-M5.json +++ b/configuration/camera_config/SARES20-CAMS142-M5.json @@ -27,13 +27,13 @@ "Bernina" ], "alias": [ - "camera_spectrometer(SARES20-CAMS142-M5)" + "TT_KB (SARES20-CAMS142-M5)" ], "roi_signal": [ 10, 2190, - 200, - 500 + 100, + 400 ], "roi_background": [ 10, diff --git a/configuration/camera_config/SARES20-DSDPPRM.json b/configuration/camera_config/SARES20-DSDPPRM.json index d084a5d..3b4ea8b 100644 --- a/configuration/camera_config/SARES20-DSDPPRM.json +++ b/configuration/camera_config/SARES20-DSDPPRM.json @@ -25,6 +25,6 @@ "Bernina" ], "alias": [ - "camera (SARES20-DSDPPRM)" + "PROF_DSD (SARES20-DSDPPRM)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-PROF141-M1.json b/configuration/camera_config/SARES20-PROF141-M1.json index ba4127a..e656053 100644 --- a/configuration/camera_config/SARES20-PROF141-M1.json +++ b/configuration/camera_config/SARES20-PROF141-M1.json @@ -1,10 +1,10 @@ { "camera_calibration": { "reference_marker": [ - 249, - 182, - 493, - 378 + 343, + 120, + 445, + 220 ], "reference_marker_width": 200.0, "reference_marker_height": 200.0, @@ -27,6 +27,6 @@ "Bernina" ], "alias": [ - "camera_microscope (SARES20-PROF141-M1)" + "TT_KB (SARES20-PROF141-M1)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-PROF142-M1.json b/configuration/camera_config/SARES20-PROF142-M1.json index bb75b70..7e424e8 100644 --- a/configuration/camera_config/SARES20-PROF142-M1.json +++ b/configuration/camera_config/SARES20-PROF142-M1.json @@ -25,6 +25,6 @@ "Bernina" ], "alias": [ - "camera (SARES20-PROF142-M1)" + "XEYE (SARES20-PROF142-M1)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SARFE10-PPRM064.json b/configuration/camera_config/SARFE10-PPRM064.json index 34b46b7..b8d1f48 100644 --- a/configuration/camera_config/SARFE10-PPRM064.json +++ b/configuration/camera_config/SARFE10-PPRM064.json @@ -26,6 +26,6 @@ "Beamline Aramis" ], "alias": [ - "camera (SARFE10-PPRM064)" + "PROF_FE (SARFE10-PPRM064)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SAROP11-PPRM066.json b/configuration/camera_config/SAROP11-PPRM066.json index 5e3d597..35e80a4 100644 --- a/configuration/camera_config/SAROP11-PPRM066.json +++ b/configuration/camera_config/SAROP11-PPRM066.json @@ -23,6 +23,6 @@ "Photonics" ], "alias": [ - "camera (SAROP11-PPRM066)" + "PROF_MIRR_ALV1 (SAROP11-PPRM066)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SAROP21-PPRM094.json b/configuration/camera_config/SAROP21-PPRM094.json index 0193485..501a0a9 100644 --- a/configuration/camera_config/SAROP21-PPRM094.json +++ b/configuration/camera_config/SAROP21-PPRM094.json @@ -25,6 +25,6 @@ "Beamline Aramis" ], "alias": [ - "camera (SAROP21-PPRM094)" + "PROF_MIRR1 (SAROP21-PPRM094)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SAROP21-PPRM102.json b/configuration/camera_config/SAROP21-PPRM102.json index 5c9c701..e618d65 100644 --- a/configuration/camera_config/SAROP21-PPRM102.json +++ b/configuration/camera_config/SAROP21-PPRM102.json @@ -25,6 +25,6 @@ "Beamline Aramis" ], "alias": [ - "camera (SAROP21-PPRM102)" + "PROF_MONO (SAROP21-PPRM102)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SAROP21-PPRM133.json b/configuration/camera_config/SAROP21-PPRM133.json index 9082aae..f3e367f 100644 --- a/configuration/camera_config/SAROP21-PPRM133.json +++ b/configuration/camera_config/SAROP21-PPRM133.json @@ -24,6 +24,6 @@ "Bernina" ], "alias": [ - "camera (SAROP21-PPRM133)" + "PROF_OPT (SAROP21-PPRM133)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SAROP21-PPRM138.json b/configuration/camera_config/SAROP21-PPRM138.json index 305c8ea..86276ad 100644 --- a/configuration/camera_config/SAROP21-PPRM138.json +++ b/configuration/camera_config/SAROP21-PPRM138.json @@ -1,10 +1,10 @@ { "camera_calibration": { "reference_marker": [ - 332, - 271, - 367, - 314 + 331, + 274, + 366, + 317 ], "reference_marker_width": 500.0, "reference_marker_height": 500.0, @@ -24,6 +24,6 @@ "Bernina" ], "alias": [ - "camera (SAROP21-PPRM138)" + "PROF_ATT (SAROP21-PPRM138)" ] } \ No newline at end of file diff --git a/configuration/camera_config/SATES21-CAMS154-GIGE4.json b/configuration/camera_config/SATES21-CAMS154-GIGE4.json index e268f7b..b217928 100644 --- a/configuration/camera_config/SATES21-CAMS154-GIGE4.json +++ b/configuration/camera_config/SATES21-CAMS154-GIGE4.json @@ -6,8 +6,8 @@ 100, 100 ], - "reference_marker_width": 1.0, - "reference_marker_height": 5.0, + "reference_marker_width": 100.0, + "reference_marker_height": 100.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, diff --git a/configuration/camera_config/SATES30-CAMS182-GIGE1.json b/configuration/camera_config/SATES30-CAMS182-GIGE1.json index bc21a79..650d208 100644 --- a/configuration/camera_config/SATES30-CAMS182-GIGE1.json +++ b/configuration/camera_config/SATES30-CAMS182-GIGE1.json @@ -18,5 +18,6 @@ "image_background": null, "source_type": "epics", "source": "SATES30-CAMS182-GIGE1", - "name": "SATES30-CAMS182-GIGE1" + "name": "SATES30-CAMS182-GIGE1", + "prefix": "SATES30-CAMS182-GIGE1" } \ No newline at end of file diff --git a/configuration/camera_config/SATOP31-PSRD175.json b/configuration/camera_config/SATOP31-PSRD175.json index d4fd3bc..ac1cc46 100644 --- a/configuration/camera_config/SATOP31-PSRD175.json +++ b/configuration/camera_config/SATOP31-PSRD175.json @@ -16,7 +16,7 @@ "rotate": 0, "roi": null, "image_background": null, - "source_type": "epics", + "source_type": "bsread", "group": [ "Photonics" ], diff --git a/configuration/camera_config/SLAAR21-LCAM-C511.json b/configuration/camera_config/SLAAR21-LCAM-C511.json index e112f46..b401be4 100644 --- a/configuration/camera_config/SLAAR21-LCAM-C511.json +++ b/configuration/camera_config/SLAAR21-LCAM-C511.json @@ -1,5 +1,16 @@ { - "camera_calibration": null, + "camera_calibration": { + "reference_marker": [ + 596, + 384, + 796, + 602 + ], + "reference_marker_width": 2.0, + "reference_marker_height": 2.0, + "angle_horizontal": 0.0, + "angle_vertical": 0.0 + }, "mirror_x": false, "mirror_y": false, "rotate": 0, @@ -9,10 +20,11 @@ "source": "SLAAR21-LCAM-C511", "name": "SLAAR21-LCAM-C511", "group": [ - "Laser" + "Laser", + "Bernina" ], "alias": [ - "IR_Beam_Monitor_I" + "CAM_NIR_ANGLE (SLAAR21-LCAM-C511)" ], "prefix": "SLAAR21-LCAM-C511" } \ No newline at end of file diff --git a/configuration/camera_config/SLAAR21-LCAM-C531.json b/configuration/camera_config/SLAAR21-LCAM-C531.json index 3455435..f6491b7 100644 --- a/configuration/camera_config/SLAAR21-LCAM-C531.json +++ b/configuration/camera_config/SLAAR21-LCAM-C531.json @@ -1,5 +1,16 @@ { - "camera_calibration": null, + "camera_calibration": { + "reference_marker": [ + 712, + 530, + 728, + 537 + ], + "reference_marker_width": 2.0, + "reference_marker_height": 2.0, + "angle_horizontal": 0.0, + "angle_vertical": 0.0 + }, "mirror_x": false, "mirror_y": false, "rotate": 0, @@ -9,10 +20,11 @@ "source": "SLAAR21-LCAM-C531", "name": "SLAAR21-LCAM-C531", "group": [ - "Laser" + "Laser", + "Bernina" ], "alias": [ - "IR_Beam_Monitor_II" + "CAM_NIR_POSITION (SLAAR21-LCAM-C531)" ], "prefix": "SLAAR21-LCAM-C531" } \ No newline at end of file diff --git a/configuration/camera_config/SLAAR21-LCAM-C532.json b/configuration/camera_config/SLAAR21-LCAM-C532.json index 06bb97b..b7d9071 100644 --- a/configuration/camera_config/SLAAR21-LCAM-C532.json +++ b/configuration/camera_config/SLAAR21-LCAM-C532.json @@ -11,8 +11,6 @@ "group": [ "Laser" ], - "alias": [ - "samplecam_inline" - ], + "alias": [], "prefix": "SLAAR21-LCAM-C532" } \ No newline at end of file diff --git a/configuration/camera_config/SLAAR21-LCAM-C561.json b/configuration/camera_config/SLAAR21-LCAM-C561.json index ed96e70..7000fc3 100644 --- a/configuration/camera_config/SLAAR21-LCAM-C561.json +++ b/configuration/camera_config/SLAAR21-LCAM-C561.json @@ -3,9 +3,13 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "source": "SLAAR21-LCAM-C561", "name": "SLAAR21-LCAM-C561", - "group": ["Laser"], + "group": [ + "Laser" + ], "alias": [] -} +} \ No newline at end of file diff --git a/configuration/camera_config/SLAAR21-PSEN119_Spec.json b/configuration/camera_config/SLAAR21-PSEN119_Spec.json index 4e657ec..bdbedb1 100644 --- a/configuration/camera_config/SLAAR21-PSEN119_Spec.json +++ b/configuration/camera_config/SLAAR21-PSEN119_Spec.json @@ -14,7 +14,10 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "name": "SLAAR21-PSEN119_Spec", - "source": "SLAAR11-LCAM-C422" + "source": "SLAAR11-LCAM-C422", + "alias": [] } \ No newline at end of file diff --git a/configuration/camera_config/SLAAR21-PSEN119_Spec_ROI.json b/configuration/camera_config/SLAAR21-PSEN119_Spec_ROI.json index 7484c22..53c663f 100644 --- a/configuration/camera_config/SLAAR21-PSEN119_Spec_ROI.json +++ b/configuration/camera_config/SLAAR21-PSEN119_Spec_ROI.json @@ -14,6 +14,8 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "image_region_of_interest": [ 0, @@ -22,5 +24,6 @@ 120 ], "name": "SLAAR21-PSEN119_Spec_ROI", - "source": "SLAAR11-LCAM-C422" + "source": "SLAAR11-LCAM-C422", + "alias": [] } \ No newline at end of file diff --git a/configuration/camera_config/SLAAR21-PSEN119_V1.json b/configuration/camera_config/SLAAR21-PSEN119_V1.json index 9b9c293..dff13a0 100644 --- a/configuration/camera_config/SLAAR21-PSEN119_V1.json +++ b/configuration/camera_config/SLAAR21-PSEN119_V1.json @@ -14,7 +14,10 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "name": "SLAAR21-PSEN119_V1", - "source": "SLAAR11-LCAM-C421" + "source": "SLAAR11-LCAM-C421", + "alias": [] } \ No newline at end of file diff --git a/configuration/camera_config/SLAAR21-PSEN135.json b/configuration/camera_config/SLAAR21-PSEN135.json index bba3aa8..bcfad81 100644 --- a/configuration/camera_config/SLAAR21-PSEN135.json +++ b/configuration/camera_config/SLAAR21-PSEN135.json @@ -14,7 +14,10 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "source": "SLAAR21-LCAM-C561", - "name": "SLAAR21-PSEN135" + "name": "SLAAR21-PSEN135", + "alias": [] } \ No newline at end of file diff --git a/configuration/camera_config/permanent_instances.json b/configuration/camera_config/permanent_instances.json index 9e26dfe..2c82bcf 100644 --- a/configuration/camera_config/permanent_instances.json +++ b/configuration/camera_config/permanent_instances.json @@ -1 +1,4 @@ -{} \ No newline at end of file +{ + "#SARES11-SPEC125-M1": "SARES11-SPEC125-M1", + "#SARES11-SPEC125-M2": "SARES11-SPEC125-M2" +} \ No newline at end of file diff --git a/configuration/camera_config/servers.json b/configuration/camera_config/servers.json index 849f8aa..640911f 100644 --- a/configuration/camera_config/servers.json +++ b/configuration/camera_config/servers.json @@ -30,14 +30,18 @@ "instances": [ "SATES21-CAMS154-M1", "SATES24-CAMS161-M1", - "SATES21-PATT-M1" + "SATES21-CAMS-PATT1" ] }, "http://sf-daqsync-05.psi.ch:8880": { "expanding": true, "instances": [ "SARES11-SPEC125-M1", - "SARES11-SPEC125-M2" + "SARES11-SPEC125-M2", + "SARES11-XMI125-C4P1", + "SARES11-XPR125-C4P2", + "SLAAR11-LCAM-C452", + "SLAAR11-LCAM-C421" ] }, "http://sf-daqsync-06.psi.ch:8880": { @@ -49,6 +53,11 @@ "SARES20-CAMS142-M5" ] }, + "http://sf-daqsync-08.psi.ch:8880": { + "enabled": true, + "expanding": true, + "instances": [] + }, "http://sf-daqsync-09.psi.ch:8880": { "enabled": true, "expanding": true, @@ -58,4 +67,4 @@ "expanding": true, "instances": [] } -} \ No newline at end of file +} diff --git a/configuration/camera_config/simulation.json b/configuration/camera_config/simulation.json index b8b2b87..85d5fac 100644 --- a/configuration/camera_config/simulation.json +++ b/configuration/camera_config/simulation.json @@ -17,6 +17,9 @@ "source_type": "simulation", "name": "simulation", "source": "", - - "frame_rate":5 + "_dtype": "uint16", + "_size_x": 2560, + "_size_y": 2160, + "image_background": null, + "frame_rate": 5 } \ No newline at end of file diff --git a/configuration/pipeline_config/SARES11-SPEC125-M1_psen_db.json b/configuration/pipeline_config/SARES11-SPEC125-M1_psen_db.json index f767a2a..1fc30a3 100644 --- a/configuration/pipeline_config/SARES11-SPEC125-M1_psen_db.json +++ b/configuration/pipeline_config/SARES11-SPEC125-M1_psen_db.json @@ -1,25 +1,25 @@ { - "image_background_enable": "passive", - "image_background": "SARES11-SPEC125-M1_20210926_143300_102984", + "image_background_enable": false, + "image_background": null, "image_threshold": null, "image_region_of_interest": null, "image_good_region": null, "image_slices": null, "pipeline_type": "processing", - "function": "maloja_spectrometers.py", + "function": "psen_min_processing.py", "camera_name": "SARES11-SPEC125-M1", "name": "SARES11-SPEC125-M1_psen_db", "mode": "PUSH", "roi_signal": [ 0, - 2047, - 0, - 400 + 2048, + 260, + 100 ], "roi_background": [ - 760, - 100, - 1900, + 0, + 2048, + 1150, 100 ], "processing_threads": 6, diff --git a/configuration/pipeline_config/SARES11-SPEC125-M2_psen_db.json b/configuration/pipeline_config/SARES11-SPEC125-M2_psen_db.json index 6270bef..8a9d80f 100644 --- a/configuration/pipeline_config/SARES11-SPEC125-M2_psen_db.json +++ b/configuration/pipeline_config/SARES11-SPEC125-M2_psen_db.json @@ -6,7 +6,7 @@ "image_good_region": null, "image_slices": null, "pipeline_type": "processing", - "function": "psen_min_processing", + "function": "psen_bkg_processing.py", "camera_name": "SARES11-SPEC125-M2", "name": "SARES11-SPEC125-M2_psen_db", "mode": "PUSH", @@ -21,5 +21,9 @@ 2047, 550, 300 - ] + ], + "no_client_timeout": 0, + "pixel_bkg": 0, + "port": "9011", + "reload": true } \ No newline at end of file diff --git a/configuration/pipeline_config/SARES20-CAMS142-M5_psen_db.json b/configuration/pipeline_config/SARES20-CAMS142-M5_psen_db.json index ad63c76..c4e4f51 100644 --- a/configuration/pipeline_config/SARES20-CAMS142-M5_psen_db.json +++ b/configuration/pipeline_config/SARES20-CAMS142-M5_psen_db.json @@ -13,8 +13,8 @@ "roi_signal": [ 300, 2040, - 500, - 100 + 50, + 500 ], "roi_background": [ 300, diff --git a/configuration/pipeline_config/SARFE10-PBPS053_proc.json b/configuration/pipeline_config/SARFE10-PBPS053_proc.json index bb3a807..e5d7227 100644 --- a/configuration/pipeline_config/SARFE10-PBPS053_proc.json +++ b/configuration/pipeline_config/SARFE10-PBPS053_proc.json @@ -17,13 +17,13 @@ "down": "SARFE10-CVME-PHO6212:Lnk9Ch13-DATA-SUM", "right": "SARFE10-CVME-PHO6212:Lnk9Ch14-DATA-SUM", "left": "SARFE10-CVME-PHO6212:Lnk9Ch15-DATA-SUM", - "up_calib": 0.12141717065655942, - "down_calib": 0.11333970757135983, - "left_calib": 0.32278186898577477, - "right_calib": 0.2083195172927878, - "horiz_calib": -4.333267670316629, - "vert_calib": -7.819575351015781, - "uJ_calib": 464.59651093235357, + "up_calib": 0.0396114649477661, + "down_calib": 0.04443745869759186, + "left_calib": 0.1251130741103867, + "right_calib": 0.06045661775892209, + "horiz_calib": -3.145932044592976, + "vert_calib": -8.645746475053746, + "uJ_calib": 605.9512700123181, "threshold": 0, "queue_length": 1000, "xpos_all_x_pvname": "SARFE10-PBPS053:XPOS-ALL-HIST-X", diff --git a/configuration/pipeline_config/SARFE10-PSSS059_psss.json b/configuration/pipeline_config/SARFE10-PSSS059_psss.json index 8e637f8..01b26f4 100644 --- a/configuration/pipeline_config/SARFE10-PSSS059_psss.json +++ b/configuration/pipeline_config/SARFE10-PSSS059_psss.json @@ -1,6 +1,6 @@ { "image_background_enable": true, - "image_background": "SARFE10-PSSS059:FPICTURE_12044327802_100", + "image_background": "SARFE10-PSSS059_20211216_185801_521432", "image_threshold": null, "image_region_of_interest": null, "image_good_region": null, @@ -15,5 +15,6 @@ "reload": true, "processing_threads": 6, "thread_buffer_size": 30, - "abort_on_error": false + "abort_on_error": false, + "pixel_bkg": 1 } \ No newline at end of file diff --git a/configuration/pipeline_config/SAROP21-ATT01_proc.json b/configuration/pipeline_config/SAROP21-ATT01_proc.json index 255bc28..82b15bd 100644 --- a/configuration/pipeline_config/SAROP21-ATT01_proc.json +++ b/configuration/pipeline_config/SAROP21-ATT01_proc.json @@ -1,19 +1,27 @@ { - "image_background_enable": true, - "image_background": "SARFE10-PSSS059:FPICTURE_12044327802_100", - "image_threshold": null, - "image_region_of_interest": null, - "image_good_region": null, - "image_slices": null, - "pipeline_type": "processing", - "camera_name": "SARFE10-PSSS059", + "bsread_address": "", + "bsread_channels": [ + "SARES20-CAMS142-M5.processing_parameters", + "SARES20-CAMS142-M5.roi_signal_x_profile", + "SAR-CVME-TIFALL5:EvtSet" + ], + "prof_sig": "SARES20-CAMS142-M5.roi_signal_x_profile", + "events": "SAR-CVME-TIFALL5:EvtSet", + "function": "SAROP21-ATT01_proc.py", + "device": "SAROP21-ATT01", + "mode": "PUB", "name": "SAROP21-ATT01_proc", - "function": "psss_test.py", - "mode": "PUSH", "no_client_timeout": 0, - "port": "8889", + "pipeline_type": "stream", "reload": true, - "processing_threads": 6, - "thread_buffer_size": 30, - "abort_on_error": false + "calib": 1, + "step_length": 150, + "edge_type": "rising", + "refinement": 1, + "buffer_length": 5, + "dark_event": 25, + "fel_on_event": 13, + "use_dark": true, + "filter_window": 201, + "filter": true } \ No newline at end of file diff --git a/configuration/pipeline_config/SATES21-CAMS154-M1_psen_db.json b/configuration/pipeline_config/SATES21-CAMS154-M1_psen_db.json deleted file mode 100644 index 64c41d4..0000000 --- a/configuration/pipeline_config/SATES21-CAMS154-M1_psen_db.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "image_background_enable": "passive", - "image_background": "SATES21-CAMS154-M1_20210930_111716_937207", - "image_threshold": null, - "image_region_of_interest": null, - "image_good_region": null, - "image_slices": null, - "pipeline_type": "processing", - "function": "spectrometer.py", - "camera_name": "SATES21-CAMS154-M1", - "name": "SATES21-CAMS154-M1_psen_db", - "mode": "PUSH", - "roi_background": [ - 1000, - 1001, - 1000, - 1001 - ], - "roi_signal": [ - 103, - 997, - 370, - 1540 - ], - "processing_threads": 4, - "thread_buffer_size": 30, - "reload": true, - "project_axis": 0, - "threshold": 10 -} \ No newline at end of file diff --git a/configuration/pipeline_config/SATES21-CAMS154-M1_psen_ib.json b/configuration/pipeline_config/SATES21-CAMS154-M1_psen_ib.json deleted file mode 100644 index 2b598bc..0000000 --- a/configuration/pipeline_config/SATES21-CAMS154-M1_psen_ib.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "image_background_enable": false, - "image_background": null, - "image_threshold": null, - "image_region_of_interest": null, - "image_good_region": null, - "image_slices": null, - "pipeline_type": "store", - "camera_name": "SATES21-CAMS154-M1", - "name": "SATES21-CAMS154-M1_psen_ib", - "stream_port": 0, - "port": "9011", - "module":0 -} diff --git a/configuration/pipeline_config/SATES24-CAMS161-M1_psen_db.json b/configuration/pipeline_config/SATES24-CAMS161-M1_psen_db.json deleted file mode 100644 index dc131b9..0000000 --- a/configuration/pipeline_config/SATES24-CAMS161-M1_psen_db.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "image_background_enable": false, - "image_background": null, - "image_threshold": null, - "image_region_of_interest": null, - "image_good_region": null, - "image_slices": null, - "pipeline_type": "processing", - "function": "spectrometer.py", - "camera_name": "SATES24-CAMS161-M1", - "name": "SATES24-CAMS161-M1_psen_db", - "mode": "PUSH", - "roi_background": [ - 1000, - 1001, - 1000, - 1001 - ], - "roi_signal": [ - 103, - 997, - 370, - 1540 - ], - "reload": true, - "processing_threads": 4, - "thread_buffer_size": 30, - "project_axis": 0, - "threshold": 1 -} \ No newline at end of file diff --git a/configuration/pipeline_config/SATES24-CAMS161-M1_psen_ib.json b/configuration/pipeline_config/SATES24-CAMS161-M1_psen_ib.json deleted file mode 100644 index 6155d6f..0000000 --- a/configuration/pipeline_config/SATES24-CAMS161-M1_psen_ib.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "image_background_enable": false, - "image_background": null, - "image_threshold": null, - "image_region_of_interest": null, - "image_good_region": null, - "image_slices": null, - "pipeline_type": "store", - "camera_name": "SATES24-CAMS161-M1", - "name": "SATES24-CAMS161-M1_psen_ib", - "stream_port": 0 -} diff --git a/configuration/pipeline_config/permanent_instances.json b/configuration/pipeline_config/permanent_instances.json index 1214e98..63ec2ed 100644 --- a/configuration/pipeline_config/permanent_instances.json +++ b/configuration/pipeline_config/permanent_instances.json @@ -1,10 +1,14 @@ { - "#SAROP21-ATT01_proc": "SAROP21-ATT01_proc", + "#SLAAR11-LCAM-C421_sp": "SLAAR11-LCAM-C421_sp", + "#SLAAR11-LCAM-C452_sp": "SLAAR11-LCAM-C452_sp", "#test_stream": "test_stream", + "#testdb_ib": "testdb_ib", "SARES11-SPEC125-M1_psen_db": "SARES11-SPEC125-M1_psen_db1", "SARES11-SPEC125-M1_psen_ib": "SARES11-SPEC125-M1_psen_ib1", "SARES11-SPEC125-M2_psen_db": "SARES11-SPEC125-M2_psen_db1", "SARES11-SPEC125-M2_psen_ib": "SARES11-SPEC125-M2_psen_ib1", + "SARES11-XMI125-C4P1_sp": "SARES11-XMI125-C4P1_sp", + "SARES11-XMI125-C4P2_sp": "SARES11-XMI125-C4P2_sp", "SARES20-CAMS142-M1_psen_db": "SARES20-CAMS142-M1_psen_db1", "SARES20-CAMS142-M1_psen_ib": "SARES20-CAMS142-M1_psen_ib1", "SARES20-CAMS142-M5_psen_db": "SARES20-CAMS142-M5_psen_db1", @@ -17,18 +21,23 @@ "SARES20-PROF146-M1_proc": "SARES20-PROF146-M_proc1", "SARFE10-PBPS053_proc": "SARFE10-PBPS053_proc", "SARFE10-PSSS059_psss": "SARFE10-PSSS059_psss1", + "SARFE10-PSSS059_psss_avg": "SARFE10-PSSS059_psss_avg", "SARFE10-PSSS059_store": "SARFE10-PSSS059_store1", + "SAROP11-ATT01_proc": "SAROP11-ATT01_proc", "SAROP11-PBPS117_proc": "SAROP11-PBPS117_proc", "SAROP11-PBPS122_proc": "SAROP11-PBPS122_proc", + "SAROP21-ATT01_proc": "SAROP21-ATT01_proc", "SAROP21-PBPS133_proc": "SAROP21-PBPS133_proc", "SAROP21-PBPS138_proc": "SAROP21-PBPS138_proc", + "SAROP21-PPRM102_proc": "SAROP21-PPRM102_proc", "SAROP21-PPRM138_proc": "SAROP21-PPRM138_proc", - "SATES21-CAMS154-M1_psen_db": "SATES21-CAMS154-M1_psen_db1", - "SATES21-CAMS154-M1_psen_ib": "SATES21-CAMS154-M1_psen_ib1", - "SATES21-PATT-M1_psen_db": "SATES21-PATT-M1_psen_db", - "SATES21-PATT-M1_psen_ib": "SATES21-PATT-M1_psen_ib", - "SATES24-CAMS161-M1_psen_db": "SATES24-CAMS161-M1_psen_db1", - "SATES24-CAMS161-M1_psen_ib": "SATES24-CAMS161-M1_psen_ib1", - "jungfrau_proc": "jungfrau_proc", - "testdb_ib": "testdb_ib" + "SATES21-CAMS-PATT1_spec_db": "SATES21-CAMS-PATT1_spec_db", + "SATES21-CAMS-PATT1_spec_ib": "SATES21-CAMS-PATT1_spec_ib", + "SATES21-CAMS154-M1_spec_db": "SATES21-CAMS154-M1_spec_db", + "SATES21-CAMS154-M1_spec_ib": "SATES21-CAMS154-M1_spec_ib", + "SATES24-CAMS161-M1_spec_db": "SATES24-CAMS161-M1_spec_db", + "SATES24-CAMS161-M1_spec_ib": "SATES24-CAMS161-M1_spec_ib", + "SATOP31-PMOS132-2D_pmos": "SATOP31-PMOS132-2D_pmos", + "SATOP31-PMOS132-2D_store": "SATOP31-PMOS132-2D_store", + "jungfrau_proc": "jungfrau_proc" } \ No newline at end of file diff --git a/configuration/pipeline_config/servers.json b/configuration/pipeline_config/servers.json index fa1b044..f077eb1 100644 --- a/configuration/pipeline_config/servers.json +++ b/configuration/pipeline_config/servers.json @@ -17,57 +17,64 @@ "cameras": [], "enabled": true, "expanding": true, - "instances": [] + "instances": [ + "SATES30-CAMS182-GIGE1_sp", + "SLAAT21-LCAM-C703_sp" + ] }, "http://sf-daqsync-02.psi.ch:8881": { "cameras": [ "SARFE10-PSSS059" ], + "enabled": true, "expanding": false, "instances": [ "SARFE10-PSSS059_psss:8889", - "SARFE10-PSSS059_store:8890" + "SARFE10-PSSS059_store:8890", + "SARFE10-PSSS059_psss_avg:9005" ] }, "http://sf-daqsync-03.psi.ch:8881": { "cameras": [ "testdb", - "simulation_2", - "simulation" + "SATOP31-PMOS132-2D" ], "enabled": true, "expanding": false, "instances": [ "testdb_ib:9005", - "simulation_2_sp", "SARFE10-PBPS053_proc:9004", "SAROP21-ATT01_proc:9003", "test_stream:9006", "SAROP21-PBPS138_proc:9009", "SAROP11-PBPS117_proc:9007", "SAROP11-PBPS122_proc:9010", - "SAROP21-PBPS133_proc:9008" + "SAROP21-PBPS133_proc:9008", + "SAROP21-PPRM102_proc:9016", + "SATOP31-PMOS132-2D_sp", + "SATOP31-PMOS132-2D_pmos:9001", + "SATOP31-PMOS132-2D_store:9002" ] }, "http://sf-daqsync-04.psi.ch:8881": { "cameras": [ "SATES21-CAMS154-M1", "SATES24-CAMS161-M1", - "SATES21-PATT-M1" + "SATES21-CAMS-PATT1" ], "expanding": false, "instances": [ "bs_timing_test_perm:9000", "SATES21-CAMS154-M1_sp", - "SATES21-CAMS154-M1_psen_ib:9000", - "SATES21-CAMS154-M1_psen_db:9001", + "SATES21-CAMS154-M1_spec_ib:9000", + "SATES21-CAMS154-M1_spec_db:9001", "SATES24-CAMS161-M1_sp", - "SATES24-CAMS161-M1_psen_ib:9010", - "SATES24-CAMS161-M1_psen_db:9011", + "SATES24-CAMS161-M1_spec_ib:9010", + "SATES24-CAMS161-M1_spec_db:9011", "SATES21-CAMS154-GIGE7_sp", - "SATES21-PATT-M1_psen_db:9003", - "SATES21-PATT-M1_psen_ib:9002", - "SATES21-PATT-M1_sp" + "SATES21-CAMS-PATT1_spec_db:9003", + "SATES21-CAMS-PATT1_spec_ib:9002", + "SATES21-CAMS-PATT1_sp" ] }, "http://sf-daqsync-05.psi.ch:8881": { @@ -125,15 +132,30 @@ "test_arrival" ] }, + "http://sf-daqsync-08.psi.ch:8881": { + "cameras": [ + "simulation_2", + "simulation" + ], + "enabled": true, + "expanding": false, + "instances": [ + "simulation_2_sp", + "simulation2_sp" + ] + }, "http://sf-daqsync-09.psi.ch:8881": { "cameras": [], "enabled": true, - "expanding": true, + "expanding": false, "instances": [] }, "http://sf-daqsync-10.psi.ch:8881": { "cameras": [], + "enabled": true, "expanding": true, - "instances": [] + "instances": [ + "SAROP11-ATT01_proc:9001" + ] } } \ No newline at end of file diff --git a/configuration/user_scripts/SAROP21-ATT01_proc.py b/configuration/user_scripts/SAROP21-ATT01_proc.py index 03ebe4d..c475e92 100644 --- a/configuration/user_scripts/SAROP21-ATT01_proc.py +++ b/configuration/user_scripts/SAROP21-ATT01_proc.py @@ -9,7 +9,7 @@ initialized = False def initialize(params): - global initialized, buffer, device, step_length, edge_type, refinement, dark_event, fel_on_event, use_dark, calib, use_filter, filter_window + global initialized, buffer_savgol, device, step_length, edge_type, refinement, dark_event, fel_on_event, use_dark, calib, use_filter, filter_window, buffer device = params["device"] step_length = params["step_length"] @@ -17,11 +17,12 @@ def initialize(params): refinement = params["refinement"] dark_event = params["dark_event"] fel_on_event = params["fel_on_event"] - buffer = deque(maxlen=params["buffer_length"]) + buffer_savgol = deque(maxlen=params["buffer_length"]) use_dark = params["use_dark"] calib = params["calib"] filter_window = params["filter_window"] - use_filter = params['filter'] + # use_filter = params['filter'] + buffer = deque(maxlen=params["buffer_length"]) initialized = True @@ -66,25 +67,28 @@ def find_edge(data, step_length=50, edge_type="falling", refinement=1): def process(data, pulse_id, timestamp, params): if not initialized: initialize(params) + output = {} # Read stream inputs prof_sig = data[params["prof_sig"]] - if use_filter: - prof_sig = savgol_filter(prof_sig,filter_window,3) + prof_sig_savgol = savgol_filter(prof_sig, filter_window, 3) events = data[params["events"]] - if prof_sig.ndim == 1: - prof_sig = prof_sig[np.newaxis, :] - if events[dark_event] and use_dark: buffer.append(prof_sig) + + if prof_sig_savgol.ndim == 1: + prof_sig_savgol = prof_sig_savgol[np.newaxis, :] + + if events[dark_event] and use_dark: + buffer_savgol.append(prof_sig_savgol) edge_results = {"edge_pos": np.nan, "xcorr": np.nan, "xcorr_ampl": np.nan, "signal":np.nan} else: - if events[fel_on_event] and buffer: - prof_sig = prof_sig / np.mean(buffer, axis=0) - edge_results = find_edge(prof_sig, step_length, edge_type, refinement) + if events[fel_on_event] and buffer_savgol: + prof_sig_norm = prof_sig_savgol / np.mean(buffer_savgol, axis=0) + edge_results = find_edge(prof_sig_norm, step_length, edge_type, refinement) elif events[fel_on_event] and not use_dark: - edge_results = find_edge(prof_sig, step_length, edge_type, refinement) + edge_results = find_edge(prof_sig_savgol, step_length, edge_type, refinement) else: edge_results = {"edge_pos": np.nan, "xcorr": np.nan, "xcorr_ampl": np.nan, "signal":np.nan} @@ -92,9 +96,27 @@ def process(data, pulse_id, timestamp, params): edge_results["arrival_time"] = edge_results["edge_pos"] * calib # Set bs outputs - output = {} for key, value in edge_results.items(): output[f"{device}:{key}"] = value - return output + output[f"{device}:raw_wf"] = prof_sig + output[f"{device}:raw_wf_savgol"] = prof_sig_savgol + if events[dark_event]: + output[f"{device}:dark_wf"] = prof_sig + output[f"{device}:dark_wf_savgol"] = prof_sig_savgol + else: + output[f"{device}:dark_wf"] = np.nan + output[f"{device}:dark_wf_savgol"] = np.nan + + if buffer: + output[f"{device}:avg_dark_wf"] = np.mean(buffer, axis=0) + else: + output[f"{device}:avg_dark_wf"] = np.nan + + if buffer_savgol: + output[f"{device}:avg_dark_wf_savgol"] = np.mean(buffer_savgol, axis=0) + else: + output[f"{device}:avg_dark_wf_savgol"] = np.nan + + return output diff --git a/configuration/user_scripts/bernina.py b/configuration/user_scripts/bernina.py index 814aca9..d3b35b2 100644 --- a/configuration/user_scripts/bernina.py +++ b/configuration/user_scripts/bernina.py @@ -8,6 +8,5 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata channels = ["intensity","x_center_of_mass","x_fwhm","x_rms","x_fit_amplitude", "x_fit_mean","x_fit_offset","x_fit_standard_deviation","x_profile"] prefix = parameters["camera_name"] for c in channels: - ret[prefix+":"+c] = r[c] + ret[prefix+":"+c] = r[c] return ret - diff --git a/configuration/user_scripts/psss.py b/configuration/user_scripts/psss.py index 5fcd95a..2694c18 100644 --- a/configuration/user_scripts/psss.py +++ b/configuration/user_scripts/psss.py @@ -6,7 +6,7 @@ from cam_server.utils import create_thread_pvs, epics_lock import json -import numpy +import numpy as np import scipy.signal import scipy.optimize import numba @@ -20,50 +20,47 @@ output_pv, center_pv, fwhm_pv, ymin_pv, ymax_pv, axis_pv = None, None, None, Non roi = [0, 0] initialized = False sent_pid = -1 +nrows = 1 +axis = None - -@numba.njit(parallel=True) +@numba.njit(parallel=False) def get_spectrum(image, background): y = image.shape[0] x = image.shape[1] - profile = numpy.zeros(x, dtype=numpy.uint32) + profile = np.zeros(x, dtype=np.float64) for i in numba.prange(y): for j in range(x): - v = image[i, j] - b = background[i, j] - if v > b: - v -= b - else: - v = 0 - profile[j] += v + profile[j] += image[i, j] - background[i, j] return profile -def initialize(parameters): +def initialize(params): global ymin_pv, ymax_pv, axis_pv, output_pv, center_pv, fwhm_pv - global channel_names - epics_pv_name_prefix = parameters["camera_name"] - output_pv_name = epics_pv_name_prefix + ":SPECTRUM_Y" - center_pv_name = epics_pv_name_prefix + ":SPECTRUM_CENTER" - fwhm_pv_name = epics_pv_name_prefix + ":SPECTRUM_FWHM" - ymin_pv_name = epics_pv_name_prefix + ":SPC_ROI_YMIN" - ymax_pv_name = epics_pv_name_prefix + ":SPC_ROI_YMAX" - axis_pv_name = epics_pv_name_prefix + ":SPECTRUM_X" - channel_names = [output_pv_name, center_pv_name, fwhm_pv_name, ymin_pv_name, ymax_pv_name, axis_pv_name] + global channel_names, spectra_buffer + camera_name = params["camera_name"] + output_pv_name = camera_name + ":SPECTRUM_Y" + center_pv_name = camera_name + ":SPECTRUM_CENTER" + fwhm_pv_name = camera_name + ":SPECTRUM_FWHM" + ymin_pv_name = camera_name + ":SPC_ROI_YMIN" + ymax_pv_name = camera_name + ":SPC_ROI_YMAX" + axis_pv_name = camera_name + ":SPECTRUM_X" + com_pv_name = camera_name + ":SPECTRUM_COM" + std_pv_name = camera_name + ":SPECTRUM_STD" + channel_names = [output_pv_name, center_pv_name, fwhm_pv_name, ymin_pv_name, ymax_pv_name, axis_pv_name, com_pv_name, std_pv_name] def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata=None, background=None): - global roi, initialized, sent_pid + global roi, initialized, sent_pid, nrows, axis global channel_names - + if not initialized: initialize(parameters) initialized = True - [output_pv, center_pv, fwhm_pv, ymin_pv, ymax_pv, axis_pv] = create_thread_pvs(channel_names) + [output_pv, center_pv, fwhm_pv, ymin_pv, ymax_pv, axis_pv, com_pv, std_pv] = create_thread_pvs(channel_names) processed_data = dict() - epics_pv_name_prefix = parameters["camera_name"] + camera_name = parameters["camera_name"] if ymin_pv and ymin_pv.connected: roi[0] = ymin_pv.value @@ -85,12 +82,13 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata # match the energy axis to image width axis = axis[:image.shape[1]] - processing_image = image + processing_image = image.astype(np.float32) - np.float32(parameters["pixel_bkg"]) nrows, ncols = processing_image.shape # validate background data if passive mode (background subtraction handled here) background_image = parameters.pop('background_data', None) - if isinstance(background_image, numpy.ndarray): + if isinstance(background_image, np.ndarray): + background_image = background_image.astype(np.float32) if background_image.shape != processing_image.shape: _logger.info("Invalid background shape: %s instead of %s" % ( str(background_image.shape), str(processing_image.shape))) @@ -98,7 +96,7 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata else: background_image = None - processed_data[epics_pv_name_prefix + ":processing_parameters"] = json.dumps( + processed_data[camera_name + ":processing_parameters"] = json.dumps( {"roi": roi, "background": None if (background_image is None) else parameters.get('image_background')}) # crop the image in y direction @@ -113,7 +111,7 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata if background_image is not None: spectrum = get_spectrum(processing_image, background_image) else: - spectrum = processing_image.sum(0, 'uint32') + spectrum = np.sum(processing_image, axis=0) # smooth the spectrum with savgol filter with 51 window size and 3rd order polynomial smoothed_spectrum = scipy.signal.savgol_filter(spectrum, 51, 3) @@ -129,26 +127,38 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata offset, amplitude, center, sigma = functions.gauss_fit_psss(smoothed_spectrum[::2], axis[::2], offset=minimum, amplitude=amplitude, skip=skip, maxfev=20) + smoothed_spectrum_normed = smoothed_spectrum / np.sum(smoothed_spectrum) + spectrum_com = np.sum(axis * smoothed_spectrum_normed) + spectrum_std = np.sqrt(np.sum((axis - spectrum_com) ** 2 * smoothed_spectrum_normed)) + # outputs - processed_data[epics_pv_name_prefix + ":SPECTRUM_Y"] = spectrum - processed_data[epics_pv_name_prefix + ":SPECTRUM_X"] = axis - processed_data[epics_pv_name_prefix + ":SPECTRUM_CENTER"] = numpy.float64(center) - processed_data[epics_pv_name_prefix + ":SPECTRUM_FWHM"] = numpy.float64(2.355 * sigma) + processed_data[camera_name + ":SPECTRUM_Y"] = spectrum + processed_data[camera_name + ":SPECTRUM_X"] = axis + processed_data[camera_name + ":SPECTRUM_CENTER"] = np.float64(center) + processed_data[camera_name + ":SPECTRUM_FWHM"] = np.float64(2.355 * sigma) + processed_data[camera_name + ":SPECTRUM_COM"] = spectrum_com + processed_data[camera_name + ":SPECTRUM_STD"] = spectrum_std + + if epics_lock.acquire(False): - try: - if pulse_id > sent_pid: - sent_pid = pulse_id - if output_pv and output_pv.connected: - output_pv.put(processed_data[epics_pv_name_prefix + ":SPECTRUM_Y"]) - #_logger.debug("caput on %s for pulse_id %s", output_pv, pulse_id) + try: + if pulse_id > sent_pid: + sent_pid = pulse_id + if output_pv and output_pv.connected: + output_pv.put(processed_data[camera_name + ":SPECTRUM_Y"]) - if center_pv and center_pv.connected: - center_pv.put(processed_data[epics_pv_name_prefix + ":SPECTRUM_CENTER"]) + if center_pv and center_pv.connected: + center_pv.put(processed_data[camera_name + ":SPECTRUM_CENTER"]) - if fwhm_pv and fwhm_pv.connected: - fwhm_pv.put(processed_data[epics_pv_name_prefix + ":SPECTRUM_FWHM"]) - finally: - epics_lock.release() + if fwhm_pv and fwhm_pv.connected: + fwhm_pv.put(processed_data[camera_name + ":SPECTRUM_FWHM"]) + + if com_pv and com_pv.connected: + com_pv.put(processed_data[camera_name + ":SPECTRUM_COM"]) + + if std_pv and std_pv.connected: + std_pv.put(processed_data[camera_name + ":SPECTRUM_STD"]) + finally: + epics_lock.release() return processed_data -