diff --git a/configuration/camera_config/Bernina_DSD_screen.json b/configuration/camera_config/Bernina_DSD_screen.json deleted file mode 100644 index 754259b..0000000 --- a/configuration/camera_config/Bernina_DSD_screen.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "camera_calibration": { - "reference_marker": [ - 662, - 592, - 664, - 594 - ], - "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": 3, - "roi": null, - "image_background": null, - "source_type": "epics", - "name": "Bernina_DSD_screen", - "source": "SARES20-DSDPPRM", - "type": "Bernina" -} \ No newline at end of file diff --git a/configuration/camera_config/Bernina_samplecam_inline.json b/configuration/camera_config/Bernina_samplecam_inline.json deleted file mode 100644 index 67401b7..0000000 --- a/configuration/camera_config/Bernina_samplecam_inline.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "camera_calibration": { - "reference_marker": [ - 1133, - 530, - 1237, - 630 - ], - "reference_marker_width": 43.0, - "reference_marker_height": 41.0, - "angle_horizontal": 0.0, - "angle_vertical": 0.0 - }, - "mirror_x": false, - "mirror_y": false, - "rotate": 0, - "roi": null, - "image_background": null, - "source_type": "epics", - "prefix": "SLAAR21-LCAM-C532", - "name": "Bernina_samplecam_inline", - "source": "SLAAR21-LCAM-C532" -} \ No newline at end of file diff --git a/configuration/camera_config/Bernina_samplecam_sideview.json b/configuration/camera_config/Bernina_samplecam_sideview.json deleted file mode 100644 index 2c575ec..0000000 --- a/configuration/camera_config/Bernina_samplecam_sideview.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "camera_calibration": { - "reference_marker": [ - 1670, - 1002, - 1679, - 1012 - ], - "reference_marker_width": 1.0, - "reference_marker_height": 1.0, - "angle_horizontal": 0.0, - "angle_vertical": 0.0 - }, - "mirror_x": false, - "mirror_y": false, - "rotate": 0, - "roi": null, - "image_background": null, - "source_type": "epics", - "prefix": "SARES20-CAMS142-C1", - "name": "Bernina_samplecam_sideview", - "source": "SARES20-CAMS142-C1" -} \ No newline at end of file diff --git a/configuration/camera_config/Bernina_samplecam_xrd.json b/configuration/camera_config/Bernina_samplecam_xrd.json deleted file mode 100644 index 4c96a40..0000000 --- a/configuration/camera_config/Bernina_samplecam_xrd.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "camera_calibration": null, - "mirror_x": false, - "mirror_y": false, - "rotate": 0, - "roi": null, - "image_background": null, - "source_type": "epics", - "prefix": "SARES20-CAMS142-C3", - "name": "Bernina_samplecam_xrd", - "source": "SARES20-CAMS142-C3" -} \ No newline at end of file diff --git a/configuration/camera_config/Bernina_spectral_encoding.json b/configuration/camera_config/Bernina_spectral_encoding.json deleted file mode 100644 index 4793482..0000000 --- a/configuration/camera_config/Bernina_spectral_encoding.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "camera_calibration": { - "reference_marker": [ - 0, - 0, - 2049, - 1251 - ], - "reference_marker_width": 100.0, - "reference_marker_height": 100.0, - "angle_horizontal": 0.0, - "angle_vertical": 0.0 - }, - "mirror_x": false, - "mirror_y": false, - "rotate": 0, - "source_type": "epics", - "name": "Bernina_spectral_encoding", - "source": "SARES20-CAMS142-M5" -} \ No newline at end of file diff --git a/configuration/camera_config/Bernina_xeye.json b/configuration/camera_config/Bernina_xeye.json deleted file mode 100644 index 0a6255b..0000000 --- a/configuration/camera_config/Bernina_xeye.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "camera_calibration": { - "reference_marker": [ - 416, - 275, - 438, - 286 - ], - "reference_marker_width": 16.0, - "reference_marker_height": 8.0, - "angle_horizontal": 0.0, - "angle_vertical": 0.0 - }, - "mirror_x": false, - "mirror_y": false, - "rotate": 0, - "roi": null, - "image_background": null, - "source_type": "epics", - "name": "Bernina_xeye", - "prefix": "SARES20-PROF142-M1", - "source": "SARES20-PROF142-M1" -} \ No newline at end of file diff --git a/configuration/camera_config/SARES11-SPEC125-M1.json b/configuration/camera_config/SARES11-SPEC125-M1.json index 695f72a..885179a 100644 --- a/configuration/camera_config/SARES11-SPEC125-M1.json +++ b/configuration/camera_config/SARES11-SPEC125-M1.json @@ -14,10 +14,14 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "bsread", "name": "SARES11-SPEC125-M1", "prefix": "SARES11-SPEC125-M1", "source": "SARES11-SPEC125-M1", "connections": 4, - "buffer_size": 100 + "buffer_size": 100, + "buffer_logs": true, + "protocol": "tcp" } diff --git a/configuration/camera_config/SARES11-XPR125-C4P2.json b/configuration/camera_config/SARES11-XPR125-C4P2.json index 3e4ab75..5c30649 100644 --- a/configuration/camera_config/SARES11-XPR125-C4P2.json +++ b/configuration/camera_config/SARES11-XPR125-C4P2.json @@ -6,4 +6,4 @@ "source_type": "epics", "source": "SARES11-XPR125-C4P2", "name": "SARES11-XPR125-C4P2" -} \ 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 8b6591d..8337694 100644 --- a/configuration/camera_config/SARES20-CAMS142-C1.json +++ b/configuration/camera_config/SARES20-CAMS142-C1.json @@ -19,5 +19,12 @@ "source_type": "epics", "prefix": "SARES20-CAMS142-C1", "name": "SARES20-CAMS142-C1", - "source": "SARES20-CAMS142-C1" + "source": "SARES20-CAMS142-C1", + "alias": [ + "samplecam_sideview" + ], + "group": [ + "Photonics", + "Bernina" + ] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-CAMS142-C2.json b/configuration/camera_config/SARES20-CAMS142-C2.json index 00094c5..29a0b13 100644 --- a/configuration/camera_config/SARES20-CAMS142-C2.json +++ b/configuration/camera_config/SARES20-CAMS142-C2.json @@ -1,17 +1,17 @@ { "camera_calibration": { "reference_marker": [ - 951, - 1077, - 972, - 1093 + 507, + 842, + 529, + 853 ], - "reference_marker_width": 100.0, - "reference_marker_height": 100.0, + "reference_marker_width": 188.0, + "reference_marker_height": 94.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, - "mirror_x": true, + "mirror_x": false, "mirror_y": false, "rotate": 1, "roi": null, @@ -19,5 +19,12 @@ "source_type": "epics", "prefix": "SARES20-CAMS142-C2", "name": "SARES20-CAMS142-C2", - "source": "SARES20-CAMS142-C2" + "source": "SARES20-CAMS142-C2", + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "samplecam_sideview (SARES20-CAMS142-C2)" + ] } \ 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 820f198..d867795 100644 --- a/configuration/camera_config/SARES20-CAMS142-C3.json +++ b/configuration/camera_config/SARES20-CAMS142-C3.json @@ -1,5 +1,16 @@ { - "camera_calibration": null, + "camera_calibration": { + "reference_marker": [ + 910, + 548, + 1011, + 648 + ], + "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, @@ -8,5 +19,12 @@ "source_type": "epics", "prefix": "SARES20-CAMS142-C3", "name": "SARES20-CAMS142-C3", - "source": "SARES20-CAMS142-C3" + "source": "SARES20-CAMS142-C3", + "alias": [ + "samplecam_xrd (SARES20-CAMS142-C3)" + ], + "group": [ + "Photonics", + "Bernina" + ] } \ No newline at end of file diff --git a/configuration/camera_config/SARES20-CAMS142-M1.json b/configuration/camera_config/SARES20-CAMS142-M1.json index c24b743..bb7e854 100644 --- a/configuration/camera_config/SARES20-CAMS142-M1.json +++ b/configuration/camera_config/SARES20-CAMS142-M1.json @@ -1,13 +1,13 @@ { "camera_calibration": { "reference_marker": [ - 836, - 1137, - 954, - 1309 + 1084, + 659, + 1086, + 661 ], - "reference_marker_width": 500.0, - "reference_marker_height": 500.0, + "reference_marker_width": 2, + "reference_marker_height": 2, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, @@ -16,8 +16,15 @@ "rotate": 0, "roi": null, "image_background": null, - "source_type": "epics", + "source_type": "bsread", "prefix": "SARES20-CAMS142-M1", "name": "SARES20-CAMS142-M1", - "source": "SARES20-CAMS142-M1" + "source": "SARES20-CAMS142-M1", + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "samplecam_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 418f516..74c03e0 100644 --- a/configuration/camera_config/SARES20-CAMS142-M2.json +++ b/configuration/camera_config/SARES20-CAMS142-M2.json @@ -1,13 +1,13 @@ { "camera_calibration": { "reference_marker": [ - 1251, - 983, - 1352, - 1083 + 1607, + 1015, + 1609, + 1017 ], - "reference_marker_width": 103.0, - "reference_marker_height": 75.0, + "reference_marker_width": 2.0, + "reference_marker_height": 2.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, @@ -19,5 +19,12 @@ "source_type": "epics", "prefix": "SARES20-CAMS142-M2", "name": "SARES20-CAMS142-M2", - "source": "SARES20-CAMS142-M2" + "source": "SARES20-CAMS142-M2", + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "samplecam_sideview(SARES20-CAMS142-M2)" + ] } \ 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 cd9e9cc..0350fa8 100644 --- a/configuration/camera_config/SARES20-CAMS142-M3.json +++ b/configuration/camera_config/SARES20-CAMS142-M3.json @@ -2,22 +2,29 @@ "camera_calibration": { "reference_marker": [ 460, - 539, - 487, - 546 + 468, + 2087, + 1869 ], - "reference_marker_width": 3000.0, - "reference_marker_height": 3000.0, + "reference_marker_width": 2000.0, + "reference_marker_height": 2000.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, "mirror_x": false, - "mirror_y": true, + "mirror_y": false, "rotate": 0, "roi": null, "image_background": null, "source_type": "epics", "prefix": "SARES20-CAMS142-M3", "name": "SARES20-CAMS142-M3", - "source": "SARES20-CAMS142-M3" + "source": "SARES20-CAMS142-M3", + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "inline_microscope" + ] } \ 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 606ca32..a82bb9b 100644 --- a/configuration/camera_config/SARES20-CAMS142-M4.json +++ b/configuration/camera_config/SARES20-CAMS142-M4.json @@ -14,10 +14,16 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "bsread", "prefix": "SARES20-CAMS142-M4", "name": "SARES20-CAMS142-M4", "source": "SARES20-CAMS142-M4", "connections": 4, - "buffer_size": 100 -} + "buffer_size": 100, + "group": [ + "Photonics", + "Bernina" + ] +} \ 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 638a6a7..89300ae 100644 --- a/configuration/camera_config/SARES20-CAMS142-M5.json +++ b/configuration/camera_config/SARES20-CAMS142-M5.json @@ -14,10 +14,19 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "bsread", "prefix": "SARES20-CAMS142-M5", "name": "SARES20-CAMS142-M5", "source": "SARES20-CAMS142-M5", "connections": 4, - "buffer_size": 100 -} + "buffer_size": 100, + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "camera_spectrometer(SARES20-CAMS142-M5)" + ] +} \ 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 9c065fe..fe2ff2d 100644 --- a/configuration/camera_config/SARES20-PROF141-M1.json +++ b/configuration/camera_config/SARES20-PROF141-M1.json @@ -1,12 +1,32 @@ { - "camera_calibration": null, + "camera_calibration": { + "reference_marker": [ + 362, + 223, + 369, + 237 + ], + "reference_marker_width": 200.0, + "reference_marker_height": 200.0, + "angle_horizontal": 0.0, + "angle_vertical": 0.0 + }, "mirror_x": false, "mirror_y": false, "rotate": 0, - "source_type": "epics", + "roi": null, + "image_background": null, + "source_type": "bsread", "prefix": "SARES20-PROF141-M1", "name": "SARES20-PROF141-M1", "source": "SARES20-PROF141-M1", - "group": ["Photonics"], - "alias": [] -} + "connections": 1, + "buffer_size": 100, + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "camera_microscope (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 0409560..344d9ce 100644 --- a/configuration/camera_config/SARES20-PROF142-M1.json +++ b/configuration/camera_config/SARES20-PROF142-M1.json @@ -1,25 +1,30 @@ { "camera_calibration": { "reference_marker": [ - 416, - 275, - 438, - 286 + 423, + 218, + 433, + 346 ], - "reference_marker_width": 16.0, - "reference_marker_height": 8.0, + "reference_marker_width": 7.8, + "reference_marker_height": 100.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, "mirror_x": false, "mirror_y": false, - "rotate": 0, + "rotate": 1, "roi": null, "image_background": null, "source_type": "bsread", "name": "SARES20-PROF142-M1", "prefix": "SARES20-PROF142-M1", "source": "SARES20-PROF142-M1", - "group": ["Photonics"], - "alias": [] -} + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "Bernina_Xeye" + ] +} \ No newline at end of file diff --git a/configuration/camera_config/SARES20-PROF146-M1.json b/configuration/camera_config/SARES20-PROF146-M1.json index c314b42..349e003 100644 --- a/configuration/camera_config/SARES20-PROF146-M1.json +++ b/configuration/camera_config/SARES20-PROF146-M1.json @@ -3,10 +3,15 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "prefix": "SARES20-PROF146-M1", "name": "SARES20-PROF146-M1", "source": "SARES20-PROF146-M1", - "group": ["Photonics"], + "group": [ + "Photonics", + "Bernina" + ], "alias": [] -} +} \ No newline at end of file diff --git a/configuration/camera_config/SARFE10-PPRM053.json b/configuration/camera_config/SARFE10-PPRM053.json index ce2df55..17e007e 100644 --- a/configuration/camera_config/SARFE10-PPRM053.json +++ b/configuration/camera_config/SARFE10-PPRM053.json @@ -14,9 +14,14 @@ "mirror_x": true, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "name": "SARFE10-PPRM053", "source": "SARFE10-PPRM053", - "group": ["Photonics"], + "group": [ + "Photonics", + "Bernina" + ], "alias": [] -} +} \ No newline at end of file diff --git a/configuration/camera_config/SARFE10-PPRM064.json b/configuration/camera_config/SARFE10-PPRM064.json index d302c0c..62f394e 100644 --- a/configuration/camera_config/SARFE10-PPRM064.json +++ b/configuration/camera_config/SARFE10-PPRM064.json @@ -14,9 +14,16 @@ "mirror_x": true, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "name": "SARFE10-PPRM064", "source": "SARFE10-PPRM064", - "group": ["Photonics"], - "alias": [] -} + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "camera (SARFE10-PPRM064)" + ] +} \ No newline at end of file diff --git a/configuration/camera_config/SARFE10-PSSS059.json b/configuration/camera_config/SARFE10-PSSS059.json index ca1dee3..dd5d734 100644 --- a/configuration/camera_config/SARFE10-PSSS059.json +++ b/configuration/camera_config/SARFE10-PSSS059.json @@ -22,6 +22,10 @@ "name": "SARFE10-PSSS059", "connections": 4, "buffer_size": 100, - "group": ["Photonics"], - "alias": [] + "group": [ + "Photonics", + "Bernina" + ], + "alias": [], + "protocol": "tcp" } diff --git a/configuration/camera_config/SAROP11-PPRM066.json b/configuration/camera_config/SAROP11-PPRM066.json index bec5b74..5e3d597 100644 --- a/configuration/camera_config/SAROP11-PPRM066.json +++ b/configuration/camera_config/SAROP11-PPRM066.json @@ -14,9 +14,15 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "name": "SAROP11-PPRM066", "source": "SAROP11-PPRM066", - "group": ["Photonics"], - "alias": [] -} + "group": [ + "Photonics" + ], + "alias": [ + "camera (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 b124578..3b8c8ee 100644 --- a/configuration/camera_config/SAROP21-PPRM094.json +++ b/configuration/camera_config/SAROP21-PPRM094.json @@ -14,9 +14,16 @@ "mirror_x": true, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "name": "SAROP21-PPRM094", "source": "SAROP21-PPRM094", - "group": ["Photonics"], - "alias": [] -} + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "camera (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 0826f51..6af968c 100644 --- a/configuration/camera_config/SAROP21-PPRM102.json +++ b/configuration/camera_config/SAROP21-PPRM102.json @@ -14,9 +14,16 @@ "mirror_x": true, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "name": "SAROP21-PPRM102", "source": "SAROP21-PPRM102", - "group": ["Photonics"], - "alias": [] -} + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "camera (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 bc6a6e2..9082aae 100644 --- a/configuration/camera_config/SAROP21-PPRM133.json +++ b/configuration/camera_config/SAROP21-PPRM133.json @@ -14,9 +14,16 @@ "mirror_x": true, "mirror_y": false, "rotate": 0, - "source_type": "epics", + "roi": null, + "image_background": null, + "source_type": "bsread", "name": "SAROP21-PPRM133", "source": "SAROP21-PPRM133", - "group": ["Photonics"], - "alias": [] -} + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "camera (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 0d0a7d3..4836568 100644 --- a/configuration/camera_config/SAROP21-PPRM138.json +++ b/configuration/camera_config/SAROP21-PPRM138.json @@ -19,6 +19,11 @@ "source_type": "epics", "name": "SAROP21-PPRM138", "source": "SAROP21-PPRM138", - "group": ["Photonics"], - "alias": [] -} + "group": [ + "Photonics", + "Bernina" + ], + "alias": [ + "camera (SAROP21-PPRM138)" + ] +} \ No newline at end of file diff --git a/configuration/camera_config/SAROP21-PPRM146.json b/configuration/camera_config/SAROP21-PPRM146.json index 2e83342..f255e2e 100644 --- a/configuration/camera_config/SAROP21-PPRM146.json +++ b/configuration/camera_config/SAROP21-PPRM146.json @@ -1,21 +1,27 @@ { - "camera_calibration": { - "angle_vertical": 0.0, - "angle_horizontal": 0.0, - "reference_marker_height": 100.0, - "reference_marker": [ - 0, - 0, - 100, - 100 - ], - "reference_marker_width": 100.0 - }, - "name": "SAROP21-PPRM146", - "source": "SAROP21-PPRM146", - "rotate": 0, - "mirror_y": false, - "mirror_x": false, - "group": ["Photonics"], - "alias": [] -} + "camera_calibration": { + "reference_marker": [ + 0, + 0, + 100, + 100 + ], + "reference_marker_width": 100.0, + "reference_marker_height": 100.0, + "angle_horizontal": 0.0, + "angle_vertical": 0.0 + }, + "mirror_x": false, + "mirror_y": false, + "rotate": 0, + "roi": null, + "image_background": null, + "source_type": "epics", + "name": "SAROP21-PPRM146", + "source": "SAROP21-PPRM146", + "group": [ + "Photonics", + "Bernina" + ], + "alias": [] +} \ No newline at end of file diff --git a/configuration/camera_config/SAROP21-PSCR097.json b/configuration/camera_config/SAROP21-PSCR097.json index 4e67bb1..f8dca1f 100644 --- a/configuration/camera_config/SAROP21-PSCR097.json +++ b/configuration/camera_config/SAROP21-PSCR097.json @@ -1,21 +1,27 @@ { - "camera_calibration": { - "angle_vertical": 0.0, - "angle_horizontal": 0.0, - "reference_marker_height": 100.0, - "reference_marker": [ - 0, - 0, - 100, - 100 - ], - "reference_marker_width": 100.0 - }, - "name": "SAROP21-PSCR097", - "source": "SAROP21-PSCR097", - "rotate": 0, - "mirror_y": false, - "mirror_x": false, - "group": ["Photonics"], - "alias": [] -} + "camera_calibration": { + "reference_marker": [ + 0, + 0, + 100, + 100 + ], + "reference_marker_width": 100.0, + "reference_marker_height": 100.0, + "angle_horizontal": 0.0, + "angle_vertical": 0.0 + }, + "mirror_x": false, + "mirror_y": false, + "rotate": 0, + "roi": null, + "image_background": null, + "source_type": "epics", + "name": "SAROP21-PSCR097", + "source": "SAROP21-PSCR097", + "group": [ + "Photonics", + "Bernina" + ], + "alias": [] +} \ No newline at end of file diff --git a/configuration/camera_config/SAROP21-PSRD103.json b/configuration/camera_config/SAROP21-PSRD103.json index 3dcfb3d..2a68823 100644 --- a/configuration/camera_config/SAROP21-PSRD103.json +++ b/configuration/camera_config/SAROP21-PSRD103.json @@ -14,8 +14,14 @@ "mirror_x": true, "mirror_y": false, "rotate": 0, + "roi": null, + "image_background": null, + "source_type": "epics", "name": "SAROP21-PSRD103", "source": "SAROP21-PSRD103", - "group": ["Photonics"], + "group": [ + "Photonics", + "Bernina" + ], "alias": [] -} +} \ No newline at end of file diff --git a/configuration/camera_config/SATES21-CAMS154-M1.json b/configuration/camera_config/SATES21-CAMS154-M1.json index 9fbc2c4..f45d5cf 100644 --- a/configuration/camera_config/SATES21-CAMS154-M1.json +++ b/configuration/camera_config/SATES21-CAMS154-M1.json @@ -19,5 +19,7 @@ "prefix": "SATES21-CAMS154-M1", "source": "SATES21-CAMS154-M1", "connections": 4, - "buffer_size": 100 + "buffer_size": 100, + "buffer_logs":true, + "protocol": "tcp" } diff --git a/configuration/camera_config/SATES24-CAMS161-M1.json b/configuration/camera_config/SATES24-CAMS161-M1.json index d7beee4..02288ce 100644 --- a/configuration/camera_config/SATES24-CAMS161-M1.json +++ b/configuration/camera_config/SATES24-CAMS161-M1.json @@ -14,10 +14,18 @@ "mirror_x": false, "mirror_y": false, "rotate": 0, - "name": "SATES24-CAMS161-M1", - "prefix": "SATES24-CAMS161-M1", - "source": "SATES24-CAMS161-M1", + "roi": null, + "image_background": null, "source_type": "bsread", + "source": "SATES24-CAMS161-M1", + "name": "SATES24-CAMS161-M1", "connections": 4, - "buffer_size": 100 + "buffer_size": 100, + "prefix": "SATES24-CAMS161-M1", + "group": [ + "Photonics", + "Maloja" + ], + "alias": [ + ] } diff --git a/configuration/camera_config/SATMA01-DSCR030.json b/configuration/camera_config/SATMA01-DSCR030.json index 1a4b8be..a2d02d3 100644 --- a/configuration/camera_config/SATMA01-DSCR030.json +++ b/configuration/camera_config/SATMA01-DSCR030.json @@ -2,9 +2,9 @@ "camera_calibration": { "reference_marker": [ 628, - 465, - 1107, - 631 + 442, + 1103, + 604 ], "reference_marker_width": 6000.0, "reference_marker_height": 2000.0, @@ -14,10 +14,14 @@ "mirror_x": true, "mirror_y": true, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "epics", "prefix": "SATMA01-DSCR030", "name": "SATMA01-DSCR030", "source": "SATMA01-DSCR030", - "group": ["Electrons"], + "group": [ + "Electrons" + ], "alias": [] -} +} \ No newline at end of file diff --git a/configuration/camera_config/SINLH02-DSCR220.json b/configuration/camera_config/SINLH02-DSCR220.json index 6e60725..48a23a2 100644 --- a/configuration/camera_config/SINLH02-DSCR220.json +++ b/configuration/camera_config/SINLH02-DSCR220.json @@ -1,21 +1,26 @@ { - "name": "SINLH02-DSCR220", - "camera_calibration": { - "angle_horizontal": 15.8, - "angle_vertical": 0.0, - "reference_marker_height": 16000.0, - "reference_marker": [ - 35, - 8, - 564, - 612 - ], - "reference_marker_width": 16000.0 - }, - "source": "SINLH02-DSCR220", - "mirror_y": true, - "rotate": 0, - "mirror_x": true, - "group": ["Electrons"], - "alias": [] -} + "camera_calibration": { + "reference_marker": [ + 35, + 8, + 564, + 612 + ], + "reference_marker_width": 16000.0, + "reference_marker_height": 16000.0, + "angle_horizontal": 15.8, + "angle_vertical": 0.0 + }, + "mirror_x": true, + "mirror_y": true, + "rotate": 0, + "roi": null, + "image_background": null, + "source_type": "epics", + "name": "SINLH02-DSCR220", + "source": "SINLH02-DSCR220", + "group": [ + "Electrons" + ], + "alias": [] +} \ No newline at end of file diff --git a/configuration/camera_config/SINSB03-DSCR110.json b/configuration/camera_config/SINSB03-DSCR110.json index e21e0b9..5abd442 100644 --- a/configuration/camera_config/SINSB03-DSCR110.json +++ b/configuration/camera_config/SINSB03-DSCR110.json @@ -1,21 +1,26 @@ { - "name": "SINSB03-DSCR110", - "camera_calibration": { - "angle_horizontal": 8.0, - "angle_vertical": 0.0, - "reference_marker_height": 16000.0, - "reference_marker": [ - 585, - 61, - 1354, - 2111 - ], - "reference_marker_width": 6000.0 - }, - "source": "SINSB03-DSCR110", - "mirror_y": true, - "rotate": 0, - "mirror_x": true, - "group": ["Electrons"], - "alias": [] -} + "camera_calibration": { + "reference_marker": [ + 587, + 61, + 1353, + 2111 + ], + "reference_marker_width": 6000.0, + "reference_marker_height": 16000.0, + "angle_horizontal": 8.0, + "angle_vertical": 0.0 + }, + "mirror_x": true, + "mirror_y": true, + "rotate": 0, + "roi": null, + "image_background": null, + "source_type": "epics", + "name": "SINSB03-DSCR110", + "source": "SINSB03-DSCR110", + "group": [ + "Electrons" + ], + "alias": [] +} \ No newline at end of file diff --git a/configuration/camera_config/servers.back b/configuration/camera_config/servers.back index 9cb6e57..b053595 100644 --- a/configuration/camera_config/servers.back +++ b/configuration/camera_config/servers.back @@ -11,7 +11,7 @@ ] }, "http://sf-daqsync-03.psi.ch:8880": { - "expanding": true, + "expanding": false, "instances": [ ] }, diff --git a/configuration/camera_config/servers.json b/configuration/camera_config/servers.json index b053595..11c928c 100644 --- a/configuration/camera_config/servers.json +++ b/configuration/camera_config/servers.json @@ -4,6 +4,16 @@ "instances": [ ] }, + "http://sf-daqsync-09.psi.ch:8880": { + "expanding": true, + "instances": [ + ] + }, + "http://sf-daqsync-10.psi.ch:8880": { + "expanding": true, + "instances": [ + ] + }, "http://sf-daqsync-02.psi.ch:8880": { "expanding": false, "instances": [ @@ -32,6 +42,7 @@ "http://sf-daqsync-06.psi.ch:8880": { "expanding": true, "instances": [ + "SARES20-CAMS142-M1", "SARES20-CAMS142-M4", "SARES20-CAMS142-M5" ] diff --git a/configuration/camera_config/servers.test b/configuration/camera_config/servers.test index 0800f89..01d6da6 100644 --- a/configuration/camera_config/servers.test +++ b/configuration/camera_config/servers.test @@ -10,17 +10,22 @@ "SARFE10-PSSS059" ] }, + "http://sf-daqsync-03.psi.ch:8880": { + "expanding": false, + "instances": [ + "SATES21-CAMS154-M1", + "SARES11-SPEC125-M1" + ] + }, "http://sf-daqsync-04.psi.ch:8880": { "expanding": false, "instances": [ - "SATES21-CAMS154-M1", "SATES24-CAMS161-M1" ] }, "http://sf-daqsync-05.psi.ch:8880": { "expanding": true, "instances": [ - "SARES11-SPEC125-M1", "SARES11-SPEC125-M2" ] }, diff --git a/configuration/pipeline_config/SARES11-SPEC125-M1_psen_db.json b/configuration/pipeline_config/SARES11-SPEC125-M1_psen_db.json index 9a6e229..7a6db65 100644 --- a/configuration/pipeline_config/SARES11-SPEC125-M1_psen_db.json +++ b/configuration/pipeline_config/SARES11-SPEC125-M1_psen_db.json @@ -1,5 +1,5 @@ { - "image_background_enable": false, + "image_background_enable": true, "image_background": null, "image_threshold": null, "image_region_of_interest": null, @@ -21,5 +21,9 @@ 100, 1900, 100 - ] + ], + "processing_threads": 6, + "thread_buffer_size": 30, + "abort_on_error": false, + "no_client_timeout": 0 } \ No newline at end of file diff --git a/configuration/pipeline_config/SARES11-SPEC125-M1_psen_ib.json b/configuration/pipeline_config/SARES11-SPEC125-M1_psen_ib.json index 4561339..9f3b8b1 100644 --- a/configuration/pipeline_config/SARES11-SPEC125-M1_psen_ib.json +++ b/configuration/pipeline_config/SARES11-SPEC125-M1_psen_ib.json @@ -8,5 +8,7 @@ "pipeline_type": "store", "camera_name": "SARES11-SPEC125-M1", "name": "SARES11-SPEC125-M1_psen_ib", - "stream_port": 0 + "stream_port": 0, + "port": "9013", + "module":0 } diff --git a/configuration/pipeline_config/SARES20-CAMS142-M5_psen_db.json b/configuration/pipeline_config/SARES20-CAMS142-M5_psen_db.json index 5953eb2..cebc007 100644 --- a/configuration/pipeline_config/SARES20-CAMS142-M5_psen_db.json +++ b/configuration/pipeline_config/SARES20-CAMS142-M5_psen_db.json @@ -11,15 +11,15 @@ "name": "SARES20-CAMS142-M5_psen_db", "mode": "PUSH", "roi_signal": [ - 0, - 2049, - 350, - 500 + 10, + 2190, + 400, + 200 ], "roi_background": [ - 0, - 2049, - 0, + 10, + 2190, + 600, 200 ], "no_client_timeout": 0, diff --git a/configuration/pipeline_config/SARFE10-PBPS053_proc.json b/configuration/pipeline_config/SARFE10-PBPS053_proc.json new file mode 100644 index 0000000..6066bcb --- /dev/null +++ b/configuration/pipeline_config/SARFE10-PBPS053_proc.json @@ -0,0 +1,14 @@ +{ + "pipeline_type": "stream", + "name": "SARFE10-PBPS053_proc", + "bsread_address": "", + "bsread_channels": [ + "SARFE10-CVME-PHO6212:Lnk9Ch12-DATA-SUM", + "SARFE10-CVME-PHO6212:Lnk9Ch13-DATA-SUM", + "SARFE10-CVME-PHO6212:Lnk9Ch14-DATA-SUM", + "SARFE10-CVME-PHO6212:Lnk9Ch15-DATA-SUM" + ], + "mode": "PUB", + "function": "SARFE10-PBPS053_proc.py", + "reload": true +} \ No newline at end of file diff --git a/configuration/pipeline_config/SARFE10-PSSS059_psss.json b/configuration/pipeline_config/SARFE10-PSSS059_psss.json index 72bfdfd..a2e5f01 100644 --- a/configuration/pipeline_config/SARFE10-PSSS059_psss.json +++ b/configuration/pipeline_config/SARFE10-PSSS059_psss.json @@ -1,6 +1,6 @@ { - "image_background_enable": "passive", - "image_background": "SARFE10-PSSS059:FPICTURE_13075009136_100", + "image_background_enable": true, + "image_background": "SARFE10-PSSS059:FPICTURE_11147675390_10", "image_threshold": null, "image_region_of_interest": null, "image_good_region": null, @@ -12,5 +12,8 @@ "mode": "PUSH", "no_client_timeout": 0, "port": "8889", - "reload": false + "reload": true, + "processing_threads": 6, + "thread_buffer_size": 30, + "abort_on_error": false } \ 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 index dd3483d..8bc3dd8 100644 --- a/configuration/pipeline_config/SATES21-CAMS154-M1_psen_db.json +++ b/configuration/pipeline_config/SATES21-CAMS154-M1_psen_db.json @@ -1,5 +1,5 @@ { - "image_background_enable": false, + "image_background_enable": true, "image_background": null, "image_threshold": null, "image_region_of_interest": null, @@ -12,16 +12,18 @@ "mode": "PUSH", "roi_background": [ 300, - 2048, + 1548, 600, 400 ], "roi_signal": [ 300, - 2048, + 1548, 1150, 400 ], "no_client_timeout": 0, - "port": "9001" -} + "processing_threads": 6, + "thread_buffer_size": 30, + "abort_on_error": false +} \ 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 index 5763655..2b598bc 100644 --- a/configuration/pipeline_config/SATES21-CAMS154-M1_psen_ib.json +++ b/configuration/pipeline_config/SATES21-CAMS154-M1_psen_ib.json @@ -8,5 +8,7 @@ "pipeline_type": "store", "camera_name": "SATES21-CAMS154-M1", "name": "SATES21-CAMS154-M1_psen_ib", - "stream_port": 0 + "stream_port": 0, + "port": "9011", + "module":0 } diff --git a/configuration/pipeline_config/permanent_instances.json b/configuration/pipeline_config/permanent_instances.json index ea7b4c9..5d98491 100644 --- a/configuration/pipeline_config/permanent_instances.json +++ b/configuration/pipeline_config/permanent_instances.json @@ -3,15 +3,21 @@ "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", - "SARES20-CAMS142-M4_psen_db": "SARES20-CAMS142-M4_psen_db1", - "SARES20-CAMS142-M4_psen_ib": "SARES20-CAMS142-M4_psen_ib1", + "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", "SARES20-CAMS142-M5_psen_ib": "SARES20-CAMS142-M5_psen_ib1", + "SARES20-PROF141-M1_proc": "SARES20-PROF141-M1_proc1", "SARES20-PROF142-M1_ib": "SARES20-PROF142-M1_ib1", + "SARES20-PROF142-M1_proc": "SARES20-PROF142-M1_proc1", + "SARES20-PROF146-M1_proc": "SARES20-PROF146-M_proc1", + "SARFE10-PBPS053_proc": "SARFE10-PBPS053_proc1", "SARFE10-PSSS059_psss": "SARFE10-PSSS059_psss1", "SARFE10-PSSS059_store": "SARFE10-PSSS059_store1", + "SAROP21-PPRM138_proc": "SAROP21-PPRM138_proc1", "SATES21-CAMS154-M1_psen_db": "SATES21-CAMS154-M1_psen_db1", "SATES21-CAMS154-M1_psen_ib": "SATES21-CAMS154-M1_psen_ib1", "SATES24-CAMS161-M1_psen_db": "SATES24-CAMS161-M1_psen_db1", - "SATES24-CAMS161-M1_psen_ib": "SATES24-CAMS161-M1_psen_ib1" + "SATES24-CAMS161-M1_psen_ib": "SATES24-CAMS161-M1_psen_ib1", + "testdb_ib": "testdb_ib1" } \ No newline at end of file diff --git a/configuration/pipeline_config/servers.json b/configuration/pipeline_config/servers.json index 3d81da9..7fae9b3 100644 --- a/configuration/pipeline_config/servers.json +++ b/configuration/pipeline_config/servers.json @@ -4,6 +4,16 @@ "expanding": true, "instances": [] }, + "http://sf-daqsync-09.psi.ch:8881": { + "cameras": [], + "expanding": true, + "instances": [] + }, + "http://sf-daqsync-10.psi.ch:8881": { + "cameras": [], + "expanding": true, + "instances": [] + }, "http://sf-daqsync-02.psi.ch:8881": { "cameras": [ "SARFE10-PSSS059" @@ -15,9 +25,9 @@ ] }, "http://sf-daqsync-03.psi.ch:8881": { - "cameras": [], + "cameras": ["testdb","simulation_2"], "expanding": false, - "instances": [] + "instances": ["testdb_ib:9005", "simulation_2_sp", "SARFE10-PBPS053_proc:9004"] }, "http://sf-daqsync-04.psi.ch:8881": { "cameras": ["SATES21-CAMS154-M1", "SATES24-CAMS161-M1"], @@ -46,15 +56,24 @@ ] }, "http://sf-daqsync-06.psi.ch:8881": { - "cameras": ["SARES20-CAMS142-M4", "SARES20-CAMS142-M5", "Bernina_spectral_encoding", "Bernina_spatial_encoding", "SARES20-PROF142-M1"], + "cameras": ["SARES20-CAMS142-M4", "SARES20-CAMS142-M5", "Bernina_spectral_encoding", "Bernina_spatial_encoding", "SARES20-PROF142-M1", "SARES20-PROF141-M1", "SARES20-PROF146-M1" ,"SAROP21-PPRM138"], "expanding": false, "instances": [ + "SARES20-CAMS142-M1_psen_ib:9002", + "SARES20-CAMS142-M1_psen_db:9003", "SARES20-CAMS142-M4_psen_ib:9000", "SARES20-CAMS142-M4_psen_db:9001", "SARES20-CAMS142-M5_psen_ib:9010", "SARES20-CAMS142-M5_psen_db:9011", "SARES20-PROF142-M1_sp", "SARES20-PROF142-M1_ib:9005", + "SARES20-PROF142-M1_proc:9017", + "SAROP21-PPRM138_proc:9015", + "SAROP21-PPRM138_sp", + "SARES20-PROF141-M1_sp", + "SARES20-PROF141-M1_proc:9016", + "SARES20-PROF146-M1_sp", + "SARES20-PROF146-M1_proc:9018", "arrival_time_proc:9008", "test_arrival" ] diff --git a/configuration/user_scripts/SARFE10-PBPS053_proc.py b/configuration/user_scripts/SARFE10-PBPS053_proc.py new file mode 100644 index 0000000..11322c0 --- /dev/null +++ b/configuration/user_scripts/SARFE10-PBPS053_proc.py @@ -0,0 +1,101 @@ + +from logging import getLogger +import epics +from threading import Thread, RLock, Event +from collections import deque +import time +from cam_server.pipeline.data_processing import functions +from cam_server.utils import create_thread_pvs + +import numpy as np + +_logger = getLogger(__name__) + +OUTPUT_CHANNEL_NAME = "SLAAR11-GEN:LAS-XRAY" +PROC_CHANNEL_NAME = "SLAAR11-GEN:LAS-EVR" +SIZE_BUFFER = 5 + +output_pv = None +buffer = None +buffer_lock = None +initialized = False +processing_thread = None + +def initialize(parameters): + global output_pv, buffer, buffer_lock, initialized, processing_thread + epics.ca.clear_cache() + [output_pv] = create_thread_pvs([OUTPUT_CHANNEL_NAME]) + output_pv.wait_for_connection() + #If raising this exception then the pipeline won't start + if not output_pv.connected: + raise ("Cannot connect to " + OUTPUT_CHANNEL_NAME) + buffer = deque(maxlen=SIZE_BUFFER) + buffer_lock = RLock() + processing_thread = Thread(target=process_thread_task, args=(buffer, buffer_lock)) + processing_thread.start() + initialized = True + + +#Processing the buffer every second and setting result to EPICS channel +def process_thread_task(buffer, buffer_lock): + _logger.info("Start buffer processing thread") + try: + [proc_pv] = create_thread_pvs([PROC_CHANNEL_NAME]) + proc_pv.wait_for_connection() + if not proc_pv.connected: + raise ("Cannot connect to " + PROC_CHANNEL_NAME) + while True: + if proc_pv.connected: + b = None + with buffer_lock: + if (len(buffer) >= SIZE_BUFFER): + b= buffer.copy() + if b is not None: + calc = sum(b)/len(b) + proc_pv.put(calc) + time.sleep(1.0) + + except Exception as e: + _logger.error("Error on buffer processing thread %s" % (str(e))) + finally: + _logger.info("Exit buffer processing thread") + + +def process(data, pulse_id, timestamp, parameters): + global output_pv, buffer, buffer_lock, initialized, processing_thread + + #Initialize on first run + if not initialized: + initialize(parameters) + + #Read stream inputs + ch12 = data["SARFE10-CVME-PHO6212:Lnk9Ch12-DATA-SUM"] + ch13 = data["SARFE10-CVME-PHO6212:Lnk9Ch13-DATA-SUM"] + ch14 = data["SARFE10-CVME-PHO6212:Lnk9Ch14-DATA-SUM"] + ch15 = data["SARFE10-CVME-PHO6212:Lnk9Ch15-DATA-SUM"] + + #Calculations + try: + sum = ch12 + ch13 + ch14 + ch15 + except: + sum = float("nan") + + #Handle thread buffer + with buffer_lock: + buffer.append(sum) + + #Update EPICS channels + if output_pv and output_pv.connected: + last = float(output_pv.value) + output_pv.put(sum) + else: + last = float('nan') + + #Set outputs + data["sum"] = sum + data["last"] = last + data["alive"] = 1 if processing_thread.is_alive() else 0 + + return data + + diff --git a/configuration/user_scripts/bernina.py b/configuration/user_scripts/bernina.py new file mode 100644 index 0000000..814aca9 --- /dev/null +++ b/configuration/user_scripts/bernina.py @@ -0,0 +1,13 @@ +from collections import OrderedDict +from cam_server.pipeline.data_processing import functions, processor + + +def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata): + r = processor.process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata) + ret = OrderedDict() + 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] + return ret + diff --git a/configuration/user_scripts/psen_min_processing.py b/configuration/user_scripts/psen_min_processing.py index 7a344e6..bd6661d 100644 --- a/configuration/user_scripts/psen_min_processing.py +++ b/configuration/user_scripts/psen_min_processing.py @@ -16,9 +16,18 @@ def get_roi_x_profile(image, roi): return roi_image.sum(0) - +#_logger.warning("----- START ---- ") +#pid = None +#sent=None def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, image_background_array=None): - + #global pid, sent + #if pid is not None: + # if pid != sent: + # _logger.warning("ERROR sending %s PID: %d" % (parameters["camera_name"], pid,)) + # if (pid+1) != pulse_id: + # _logger.warning("ERROR %s PID: waiting %d - received %d" % (parameters["camera_name"], pid+1,pulse_id)) + #pid = pulse_id + processed_data = dict() image_property_name = parameters["camera_name"] @@ -34,6 +43,6 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, image_ if roi_background: processed_data[image_property_name + ".roi_background_x_profile"] = get_roi_x_profile(image, roi_background) - + #sent = pid return processed_data diff --git a/configuration/user_scripts/psss.py b/configuration/user_scripts/psss.py index 796b7c5..5fcd95a 100644 --- a/configuration/user_scripts/psss.py +++ b/configuration/user_scripts/psss.py @@ -1,7 +1,8 @@ from logging import getLogger from cam_server.pipeline.data_processing import functions -from cam_server.pipeline.data_processing.functions import chunk_copy +from cam_server.utils import create_thread_pvs, epics_lock + import json @@ -9,28 +10,29 @@ import numpy import scipy.signal import scipy.optimize import numba -numba.set_num_threads(4) -import epics +numba.set_num_threads(4) _logger = getLogger(__name__) -output_pv, center_pv, fwhm_pv, ymin_pv, ymax_pv, axis_pv = None, None, None, None, None, None +channel_names = None +output_pv, center_pv, fwhm_pv, ymin_pv, ymax_pv, axis_pv = None, None, None, None, None, None roi = [0, 0] initialized = False +sent_pid = -1 @numba.njit(parallel=True) -def get_spectrum (image, background): +def get_spectrum(image, background): y = image.shape[0] x = image.shape[1] profile = numpy.zeros(x, dtype=numpy.uint32) - b = 0 + for i in numba.prange(y): for j in range(x): - v = image[i,j] - b = background[i,j] + v = image[i, j] + b = background[i, j] if v > b: v -= b else: @@ -41,9 +43,7 @@ def get_spectrum (image, background): def initialize(parameters): 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" @@ -51,30 +51,18 @@ def initialize(parameters): 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" - epics.ca.clear_cache() - - output_pv = epics.PV(output_pv_name) - center_pv = epics.PV(center_pv_name) - fwhm_pv = epics.PV(fwhm_pv_name) - - ymin_pv = epics.PV(ymin_pv_name) - ymax_pv = epics.PV(ymax_pv_name) - axis_pv = epics.PV(axis_pv_name) - ymin_pv.wait_for_connection() - ymax_pv.wait_for_connection() - axis_pv.wait_for_connection() + channel_names = [output_pv_name, center_pv_name, fwhm_pv_name, ymin_pv_name, ymax_pv_name, axis_pv_name] def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata=None, background=None): - global roi, initialized - global ymin_pv, ymax_pv, axis_pv, output_pv, center_pv, fwhm_pv - + global roi, initialized, sent_pid + 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) processed_data = dict() - epics_pv_name_prefix = parameters["camera_name"] if ymin_pv and ymin_pv.connected: @@ -100,13 +88,12 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata processing_image = image nrows, ncols = processing_image.shape - # validate background data + # validate background data if passive mode (background subtraction handled here) background_image = parameters.pop('background_data', None) - if isinstance(background_image, numpy.ndarray): - #background_image = chunk_copy(background_image) if background_image.shape != processing_image.shape: - _logger.info("Invalid background shape: %s instead of %s" % (str(background_image.shape), str(processing_image.shape))) + _logger.info("Invalid background shape: %s instead of %s" % ( + str(background_image.shape), str(processing_image.shape))) background_image = None else: background_image = None @@ -126,7 +113,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 = processing_image.sum(0, 'uint32') # smooth the spectrum with savgol filter with 51 window size and 3rd order polynomial smoothed_spectrum = scipy.signal.savgol_filter(spectrum, 51, 3) @@ -140,23 +127,28 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata skip = False # gaussian fitting offset, amplitude, center, sigma = functions.gauss_fit_psss(smoothed_spectrum[::2], axis[::2], - offset=minimum, amplitude=amplitude, skip=skip) + offset=minimum, amplitude=amplitude, skip=skip, maxfev=20) # 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"] = center - processed_data[epics_pv_name_prefix + ":SPECTRUM_FWHM"] = 2.355 * sigma + processed_data[epics_pv_name_prefix + ":SPECTRUM_CENTER"] = numpy.float64(center) + processed_data[epics_pv_name_prefix + ":SPECTRUM_FWHM"] = numpy.float64(2.355 * sigma) + 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) - 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) + 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[epics_pv_name_prefix + ":SPECTRUM_CENTER"]) - - if fwhm_pv and fwhm_pv.connected: - fwhm_pv.put(processed_data[epics_pv_name_prefix + ":SPECTRUM_FWHM"]) + if fwhm_pv and fwhm_pv.connected: + fwhm_pv.put(processed_data[epics_pv_name_prefix + ":SPECTRUM_FWHM"]) + finally: + epics_lock.release() return processed_data