diff --git a/configuration/camera_config/SARES20-CAMS142-C1.json b/configuration/camera_config/SARES20-CAMS142-C1.json index b4e1a4c..bf43bd2 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": [ - 1412, - 1469, - 1513, - 1569 + 1266, + 1337, + 1367, + 1438 ], "reference_marker_width": 23.5, "reference_marker_height": 21.2, diff --git a/configuration/camera_config/SARES20-CAMS142-C2.json b/configuration/camera_config/SARES20-CAMS142-C2.json index 46fcea6..f4f42e9 100644 --- a/configuration/camera_config/SARES20-CAMS142-C2.json +++ b/configuration/camera_config/SARES20-CAMS142-C2.json @@ -1,13 +1,13 @@ { "camera_calibration": { "reference_marker": [ - 1076, - 851, - 1133, - 893 + 1029, + 842, + 1034, + 852 ], - "reference_marker_width": 73.0, - "reference_marker_height": 54.0, + "reference_marker_width": 50.0, + "reference_marker_height": 50.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, diff --git a/configuration/camera_config/SARES20-CAMS142-C3.json b/configuration/camera_config/SARES20-CAMS142-C3.json index 358c138..c3c145d 100644 --- a/configuration/camera_config/SARES20-CAMS142-C3.json +++ b/configuration/camera_config/SARES20-CAMS142-C3.json @@ -1,10 +1,10 @@ { "camera_calibration": { "reference_marker": [ - 945, - 565, - 954, - 573 + 880, + 585, + 980, + 686 ], "reference_marker_width": 9.0, "reference_marker_height": 16.0, diff --git a/configuration/camera_config/SATES30-CAMS182-GIGE1.json b/configuration/camera_config/SATES30-CAMS182-GIGE1.json index 42dbb8c..6c00754 100644 --- a/configuration/camera_config/SATES30-CAMS182-GIGE1.json +++ b/configuration/camera_config/SATES30-CAMS182-GIGE1.json @@ -1,12 +1,12 @@ { "camera_calibration": { "reference_marker": [ - 204, - 108, - 349, - 934 + 652, + 278, + 836, + 316 ], - "reference_marker_width": 5000.0, + "reference_marker_width": 50.0, "reference_marker_height": 2000.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 diff --git a/configuration/camera_config/SATES30-CAMS182-GIGE2.json b/configuration/camera_config/SATES30-CAMS182-GIGE2.json index 7439671..a7c3377 100644 --- a/configuration/camera_config/SATES30-CAMS182-GIGE2.json +++ b/configuration/camera_config/SATES30-CAMS182-GIGE2.json @@ -2,9 +2,9 @@ "camera_calibration": { "reference_marker": [ 265, - 72, - 1253, - 1066 + 166, + 1277, + 1116 ], "reference_marker_width": 5000.0, "reference_marker_height": 5000.0, diff --git a/configuration/camera_config/SATES30-CAMS182-GIGE3.json b/configuration/camera_config/SATES30-CAMS182-GIGE3.json index e29bad7..2ac6de4 100644 --- a/configuration/camera_config/SATES30-CAMS182-GIGE3.json +++ b/configuration/camera_config/SATES30-CAMS182-GIGE3.json @@ -1,13 +1,13 @@ { "camera_calibration": { "reference_marker": [ - 0, - 0, - 100, - 100 + 304, + 135, + 411, + 245 ], - "reference_marker_width": 100.0, - "reference_marker_height": 100.0, + "reference_marker_width": 5000.0, + "reference_marker_height": 5000.0, "angle_horizontal": 0.0, "angle_vertical": 0.0 }, diff --git a/configuration/camera_config/SLAAR21-LCAM-CS841.json b/configuration/camera_config/SLAAR21-LCAM-CS841.json index 3818a75..06444e8 100644 --- a/configuration/camera_config/SLAAR21-LCAM-CS841.json +++ b/configuration/camera_config/SLAAR21-LCAM-CS841.json @@ -3,6 +3,8 @@ "mirror_x": false, "mirror_y": true, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "bsread", "name": "SLAAR21-LCAM-CS841", "protocol": "tcp", diff --git a/configuration/camera_config/SLAAR21-LCAM-CS842.json b/configuration/camera_config/SLAAR21-LCAM-CS842.json index 9002365..3feeaf8 100644 --- a/configuration/camera_config/SLAAR21-LCAM-CS842.json +++ b/configuration/camera_config/SLAAR21-LCAM-CS842.json @@ -3,6 +3,8 @@ "mirror_x": false, "mirror_y": true, "rotate": 0, + "roi": null, + "image_background": null, "source_type": "bsread", "name": "SLAAR21-LCAM-CS842", "protocol": "tcp", diff --git a/configuration/pipeline_config/SAROP21-PBPS103_proc.json b/configuration/pipeline_config/SAROP21-PBPS103_proc.json index e5d0080..875c1a7 100644 --- a/configuration/pipeline_config/SAROP21-PBPS103_proc.json +++ b/configuration/pipeline_config/SAROP21-PBPS103_proc.json @@ -1,17 +1,17 @@ { - "down_calib": 0.05773750366645945, + "down_calib": 0.5591511338550219, "xpos_odd_w_pvname": "SAROP21-PBPS103:XPOS-ODD-HIST-W", "ypos_all_y_pvname": "SAROP21-PBPS103:YPOS-ALL-HIST-Y", "ypos_all_w_pvname": "SAROP21-PBPS103:YPOS-ALL-HIST-W", "name": "SAROP21-PBPS103_proc", - "vert_calib": -4.013266539044132, + "vert_calib": -3.9958078717518144, "bsread_address": "", "right": "SAROP21-CVME-PBPS1:Lnk9Ch2-DATA-SUM", "ypos_dif_w_pvname": "SAROP21-PBPS103:YPOS-DIF-HIST-W", "ypos_odd_x_pvname": "SAROP21-PBPS103:YPOS-ODD-HIST-X", "function": "pbps.py", "port": "9009", - "left_calib": 0.033940788499696006, + "left_calib": 0.36904567566640284, "down": "SAROP21-CVME-PBPS1:Lnk9Ch3-DATA-SUM", "ypos_odd_w_pvname": "SAROP21-PBPS103:YPOS-ODD-HIST-W", "xpos_odd_y_pvname": "SAROP21-PBPS103:XPOS-ODD-HIST-Y", @@ -23,7 +23,7 @@ "ypos_evn_x_pvname": "SAROP21-PBPS103:YPOS-EVN-HIST-X", "uJ_calib": 605.9512700123181, "xpos_evn_m_pvname": "SAROP21-PBPS103:XPOS-EVN-HIST-M", - "horiz_calib": 4.422571387563297, + "horiz_calib": 4.361157752097061, "ypos_all_m_pvname": "SAROP21-PBPS103:YPOS-ALL-HIST-M", "ypos_dif_m_pvname": "SAROP21-PBPS103:YPOS-DIF-HIST-M", "bsread_channels": [ @@ -37,7 +37,7 @@ "pipeline_type": "stream", "stream_timeout": 20, "ypos_all_x_pvname": "SAROP21-PBPS103:YPOS-ALL-HIST-X", - "right_calib": 0.030184745278420903, + "right_calib": 0.33414240272743095, "xpos_all_m_pvname": "SAROP21-PBPS103:XPOS-ALL-HIST-M", "xpos_odd_m_pvname": "SAROP21-PBPS103:XPOS-ODD-HIST-M", "left": "SAROP21-CVME-PBPS1:Lnk9Ch1-DATA-SUM", @@ -51,7 +51,7 @@ "ypos_evn_y_pvname": "SAROP21-PBPS103:YPOS-EVN-HIST-Y", "xpos_odd_x_pvname": "SAROP21-PBPS103:XPOS-ODD-HIST-X", "threshold": 0, - "up_calib": 0.05333779168125384, + "up_calib": 0.535888712120923, "ypos_odd_m_pvname": "SAROP21-PBPS103:YPOS-ODD-HIST-M", "xpos_all_x_pvname": "SAROP21-PBPS103:XPOS-ALL-HIST-X", "up": "SAROP21-CVME-PBPS1:Lnk9Ch4-DATA-SUM", @@ -62,9 +62,9 @@ 0.3 ], "calib_x_norm": [ - -0.06746482707403895, - 0.0004445333663804517, - 0.06820285297455421 + -0.06947260244733981, + -0.0005099883066721613, + 0.06810554402339729 ], "calib_y_range": [ -0.3, @@ -72,19 +72,19 @@ 0.3 ], "calib_y_norm": [ - 0.07421884402169887, - -9.213746650202566e-05, - -0.07528530531967688 + 0.07645446869263132, + 0.00011733719876510883, + -0.07370290104520648 ], "calib_x_norm_std": [ - 0.01260021920786719, - 0.013510267720896078, - 0.011985970517095955 + 0.3832642548643102, + 0.36376451461448284, + 0.3725425364709937 ], "calib_y_norm_std": [ - 0.015069277154299072, - 0.015346341477740713, - 0.015281728159302189 + 0.3869867302072751, + 0.3994940062239071, + 0.3769217744089247 ], - "calib_datetime": "2023-05-09 09:56:48" + "calib_datetime": "2023-06-07 06:54:21" } \ No newline at end of file diff --git a/configuration/pipeline_config/SATBD02-DSCR050_sp.json b/configuration/pipeline_config/SATBD02-DSCR050_sp.json index 04360b1..571b80b 100644 --- a/configuration/pipeline_config/SATBD02-DSCR050_sp.json +++ b/configuration/pipeline_config/SATBD02-DSCR050_sp.json @@ -3,10 +3,10 @@ "image_background": "SATBD02-DSCR050_20221013_123827_350915", "image_threshold": null, "image_region_of_interest": [ - 28, - 1092, - 6, - 1007 + 155, + 1216, + 52, + 1302 ], "image_good_region": null, "image_slices": null, diff --git a/configuration/pipeline_config/SATES21-CAMS-PATT1_spec_db.json b/configuration/pipeline_config/SATES21-CAMS-PATT1_spec_db.json index 833a322..7be9aa7 100644 --- a/configuration/pipeline_config/SATES21-CAMS-PATT1_spec_db.json +++ b/configuration/pipeline_config/SATES21-CAMS-PATT1_spec_db.json @@ -1,6 +1,6 @@ { "image_background_enable": "passive", - "image_background": "SATES21-CAMS-PATT1_20230531_133321_260634", + "image_background": "SATES21-CAMS-PATT1_20230607_073009_718877", "image_threshold": null, "image_region_of_interest": null, "image_good_region": null, @@ -17,17 +17,25 @@ "project_axis": 0, "no_client_timeout": 0, "port": "9003", - "threshold": 5, + "threshold": 20, "roi_background": [ - 103, - 1153, - 72, - 1147 + 0, + 1154, + 0, + 1280 ], "roi_signal": [ - 103, - 1153, - 72, - 1147 - ] + 0, + 1154, + 0, + 1280 + ], + "roi_radial": [ + 0, + 1154, + 0, + 1280 + ], + "radial_x0": "550", + "radial_y0": "550" } \ No newline at end of file diff --git a/configuration/pipeline_config/SATES21-CAMS154-M1_spec_db.json b/configuration/pipeline_config/SATES21-CAMS154-M1_spec_db.json index c85c24a..03cf984 100644 --- a/configuration/pipeline_config/SATES21-CAMS154-M1_spec_db.json +++ b/configuration/pipeline_config/SATES21-CAMS154-M1_spec_db.json @@ -1,6 +1,6 @@ { "image_background_enable": "passive", - "image_background": "SATES21-CAMS154-M1_20230530_152447_004964", + "image_background": "SATES21-CAMS154-M1_20230607_091358_573996", "image_threshold": null, "image_region_of_interest": null, "image_good_region": null, @@ -14,29 +14,16 @@ "thread_buffer_size": 30, "project_axis": 0, "roi_signal": [ - 7, - 895, + 251, + 470, 0, - 2523 + 2516 ], "threshold": 5, "roi_background": [ - "(", - "7", - ",", - " ", - "8", - "9", - "5", - ",", - " ", - "0", - ",", - " ", - "2", - "5", - "2", - "3", - ")" + 251, + 470, + 0, + 2516 ] } \ No newline at end of file diff --git a/configuration/pipeline_config/SATES24-CAMS161-M1_spec_db.json b/configuration/pipeline_config/SATES24-CAMS161-M1_spec_db.json index b7f2828..f6cc625 100644 --- a/configuration/pipeline_config/SATES24-CAMS161-M1_spec_db.json +++ b/configuration/pipeline_config/SATES24-CAMS161-M1_spec_db.json @@ -1,6 +1,6 @@ { "image_background_enable": "passive", - "image_background": "SATES24-CAMS161-M1_20230531_144316_923916", + "image_background": "SATES24-CAMS161-M1_20230607_091554_570079", "image_threshold": null, "image_region_of_interest": null, "image_good_region": null, @@ -11,9 +11,9 @@ "name": "SATES24-CAMS161-M1_spec_db", "mode": "PUSH", "roi_signal": [ - 11, - 782, - 15, + 0, + 798, + 0, 2540 ], "processing_threads": 4, @@ -21,9 +21,10 @@ "project_axis": 0, "threshold": 5, "roi_background": [ - 11, - 782, - 15, + 0, + 798, + 0, 2540 - ] + ], + "reload": true } \ No newline at end of file diff --git a/configuration/pipeline_config/SATES30-RIXS-CAM01_proc.json b/configuration/pipeline_config/SATES30-RIXS-CAM01_proc.json index 3078387..0038176 100644 --- a/configuration/pipeline_config/SATES30-RIXS-CAM01_proc.json +++ b/configuration/pipeline_config/SATES30-RIXS-CAM01_proc.json @@ -1,6 +1,6 @@ { "image_background_enable": true, - "image_background": "SATES30-RIXS-CAM01_20230601_093318_381947", + "image_background": "SATES30-RIXS-CAM01_20230602_115820_621889", "image_threshold": null, "image_region_of_interest": null, "image_good_region": null, @@ -13,5 +13,6 @@ "block": false, "threshold": 10.0, "_max_frame_rate": 5.1, + "libs": "threshold_2d_start600_800.txt", "reload": true } \ No newline at end of file diff --git a/configuration/pipeline_config/SATES31-CAMS187-RIXS1_sp.json b/configuration/pipeline_config/SATES31-CAMS187-RIXS1_sp.json index a1ba643..ae6500d 100644 --- a/configuration/pipeline_config/SATES31-CAMS187-RIXS1_sp.json +++ b/configuration/pipeline_config/SATES31-CAMS187-RIXS1_sp.json @@ -1,6 +1,5 @@ { "image_background_enable": false, - "image_background": null, "image_threshold": null, "image_region_of_interest": null, "image_good_region": null, diff --git a/configuration/pipeline_config/permanent_instances.json b/configuration/pipeline_config/permanent_instances.json index 6dc4b42..53f7932 100644 --- a/configuration/pipeline_config/permanent_instances.json +++ b/configuration/pipeline_config/permanent_instances.json @@ -9,10 +9,10 @@ "#SAROP21-PPRM102_proc": "SAROP21-PPRM102_proc", "#SAROP31-PPRM113_proc": "SAROP31-PPRM113_proc", "#SATES30-RIXS-CAM01_sp1": "SATES30-RIXS-CAM01_sp", - "#SATES31-CAMS187-RIXS1_sp1": "SATES31-CAMS187-RIXS1_sp", "#SATMA02_calib": "SATMA02_calib", "#SINBC02-DSRM310_profiles": "SINBC02-DSRM310_profiles", "#jungfrau_proc": "jungfrau_proc", + "#test_load_file": "test_load_file", "#test_merge": "test_merge", "#test_proc_with_bs": "test_proc_with_bs", "#test_str": "test_str", @@ -52,6 +52,7 @@ "SATES30-CAMS182-GIGE2_profiles": "SATES30-CAMS182-GIGE2_profiles", "SATES30-RIXS-CAM01_proc": "SATES30-RIXS-CAM01_proc", "SATES31-CAMS187-RIXS1_proc": "SATES31-CAMS187-RIXS1_proc", + "SATES31-CAMS187-RIXS1_sp1": "SATES31-CAMS187-RIXS1_sp", "SATOP21-PMOS127-2D_pmos": "SATOP21-PMOS127-2D_pmos", "SATOP31-PMOS132-2D_pmos": "SATOP31-PMOS132-2D_pmos", "SINDI02-DSCR075_profiles": "SINDI02-DSCR075_profiles", diff --git a/configuration/pipeline_config/servers.json b/configuration/pipeline_config/servers.json index 19a09c9..8db0b7f 100644 --- a/configuration/pipeline_config/servers.json +++ b/configuration/pipeline_config/servers.json @@ -253,6 +253,7 @@ "SATES31-CAMS187-RIXS1_ib:9001", "SATES30-RIXS-CAM01_sp", "SATES30-RIXS-CAM01_proc:9006", + "test_load_file", "SATES30-CAMS182-GIGE1_sp", "SATES30-CAMS182-GIGE2_sp", "SATES30-CAMS182-GIGE1_profiles:9002", diff --git a/configuration/user_scripts/SARES11-SPEC125-M1_2tt.py b/configuration/user_scripts/SARES11-SPEC125-M1_2tt.py index 755ac2d..1ededba 100644 --- a/configuration/user_scripts/SARES11-SPEC125-M1_2tt.py +++ b/configuration/user_scripts/SARES11-SPEC125-M1_2tt.py @@ -66,8 +66,8 @@ def edge(filter_name, backgrounds, signals, peakback): # interpolate to get evenly sampled in frequency space sig_interp = interpolate(nus, nus_new, sig_norm) # Fourier filter - #sig_filtered = fourier_filter(sig_interp, ffilter) - sig_filtered = sig_interp + sig_filtered = fourier_filter(sig_interp, ffilter) + #sig_filtered = sig_interp # interpolate to get unevenly sampled in frequency space (back to original wavelength space) sig_uninterp = interpolate(nus_new, nus, sig_filtered[..., 0:2048]) + 1 # peak via the derivative diff --git a/configuration/user_scripts/late_averaging.py b/configuration/user_scripts/late_averaging.py index 1996f85..6160bbb 100644 --- a/configuration/user_scripts/late_averaging.py +++ b/configuration/user_scripts/late_averaging.py @@ -14,7 +14,7 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata image_buffer.append(image) try: frames = numpy.array(image_buffer) - image = numpy.average(frames, 0) + image = numpy.average(frames, 0)*averaging #_logger.info("Averaged: %d" % len(image_buffer)) except: # Different shapes diff --git a/configuration/user_scripts/single_photon.c b/configuration/user_scripts/single_photon.c index 0bfce4d..57df203 100644 --- a/configuration/user_scripts/single_photon.c +++ b/configuration/user_scripts/single_photon.c @@ -25,6 +25,81 @@ void setArrayToValue(double array[], int size, double value) { } } + + +//Initialization: Threshold & background +initialized = 0; +//const char *THRESHOLD_FILE = "/configuration/user_scripts/lib/Thresh_2D_start600_size800.npy"; +const char *THRESHOLD_FILE = "/configuration/user_scripts/lib/threshold_2d_start600_800.txt"; +int threshold_num_elements=-1; +double *threshold= NULL; +double *background= NULL; +const int MAX_LINE_LENGTH = 50000; + + +int initialize(int size_x, int size_y, PyObject *pars){ + + //background (all matrices are indexed in 1d) + background = malloc(size_x*size_y*sizeof(double)); + for(int i=0; idata; + //Initialization + if (initialized==0){ + initialized = initialize(size_x, size_y, pars); + } + + int i,j,l; int i_dim=size_y; int j_dim=size_x; - PyObject* threshold_obj = PyDict_GetItemString(pars, "threshold"); - double threshold_val = 60000.0; - if (threshold_obj!=NULL){ - if (PyFloat_Check(threshold_obj)) { - threshold_val = PyFloat_AsDouble(threshold_obj); - } else if (PyLong_Check(threshold_obj)) { - threshold_val = PyLong_AsDouble(threshold_obj); - } - } - double *threshold = malloc(i_dim*j_dim*sizeof(double)); - for(i=0; i