diff --git a/configuration/camera_config/SARES11-SPEC125-M2.json b/configuration/camera_config/SARES11-SPEC125-M2.json index 0b8219b..ffa452e 100644 --- a/configuration/camera_config/SARES11-SPEC125-M2.json +++ b/configuration/camera_config/SARES11-SPEC125-M2.json @@ -21,5 +21,6 @@ "connections": 2, "buffer_size": 0, "forwarder_port": 9010, + "debug": true, "protocol": "tcp" } \ No newline at end of file diff --git a/configuration/camera_config/SARES11-XMI125-C4P1.json b/configuration/camera_config/SARES11-XMI125-C4P1.json index 358ad8b..93e1d97 100644 --- a/configuration/camera_config/SARES11-XMI125-C4P1.json +++ b/configuration/camera_config/SARES11-XMI125-C4P1.json @@ -7,5 +7,6 @@ "name": "SARES11-XMI125-C4P1", "protocol": "tcp", "source": "SARES11-XMI125-C4P1", - "_forwarder_port": 9005 + "_forwarder_port": 9005, + "debug": true } \ 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 9151551..d99c3b4 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": [ - 1176, - 863, - 1275, - 964 + 1102, + 855, + 1202, + 955 ], "reference_marker_width": 1233.0, "reference_marker_height": 1245.0, diff --git a/configuration/camera_config/SARES20-CAMS142-M2.json b/configuration/camera_config/SARES20-CAMS142-M2.json index 3356c57..caa0e46 100644 --- a/configuration/camera_config/SARES20-CAMS142-M2.json +++ b/configuration/camera_config/SARES20-CAMS142-M2.json @@ -16,7 +16,7 @@ "rotate": 0, "roi": null, "image_background": null, - "source_type": "epics", + "source_type": "bsread", "prefix": "SARES20-CAMS142-M2", "name": "SARES20-CAMS142-M2", "source": "SARES20-CAMS142-M2", diff --git a/configuration/camera_config/SARES20-CAMS142-M3.json b/configuration/camera_config/SARES20-CAMS142-M3.json index 7d931bc..8a725d8 100644 --- a/configuration/camera_config/SARES20-CAMS142-M3.json +++ b/configuration/camera_config/SARES20-CAMS142-M3.json @@ -1,10 +1,10 @@ { "camera_calibration": { "reference_marker": [ - 388, - 669, - 600, - 884 + 297, + 453, + 403, + 555 ], "reference_marker_width": 413.0, "reference_marker_height": 419.0, @@ -25,6 +25,6 @@ "Bernina" ], "alias": [ - "CAMERA_BSSS (SARES20-CAMS142-M3)" + "SAMPLECAM_INLINE (SARES20-CAMS142-M3)" ] } \ 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 ceded4b..44eeb96 100644 --- a/configuration/camera_config/SARES20-PROF142-M1.json +++ b/configuration/camera_config/SARES20-PROF142-M1.json @@ -16,7 +16,7 @@ "rotate": 0, "roi": null, "image_background": null, - "source_type": "epics", + "source_type": "bsread", "name": "SARES20-PROF142-M1", "prefix": "SARES20-PROF142-M1", "source": "SARES20-PROF142-M1", diff --git a/configuration/camera_config/SARES20-PROF146-M1.json b/configuration/camera_config/SARES20-PROF146-M1.json index 349e003..77bade3 100644 --- a/configuration/camera_config/SARES20-PROF146-M1.json +++ b/configuration/camera_config/SARES20-PROF146-M1.json @@ -5,7 +5,7 @@ "rotate": 0, "roi": null, "image_background": null, - "source_type": "epics", + "source_type": "bsread", "prefix": "SARES20-PROF146-M1", "name": "SARES20-PROF146-M1", "source": "SARES20-PROF146-M1", diff --git a/configuration/camera_config/SARFE10-PSSS059.json b/configuration/camera_config/SARFE10-PSSS059.json index e659304..a33727c 100644 --- a/configuration/camera_config/SARFE10-PSSS059.json +++ b/configuration/camera_config/SARFE10-PSSS059.json @@ -24,6 +24,7 @@ "buffer_size": 0, "buffer_threshold": 0.5, "debug": true, + "check_timestamp": true, "group": [ "Photonics", "Alvra", diff --git a/configuration/camera_config/SATES30-CAMS182-GIGE1.json b/configuration/camera_config/SATES30-CAMS182-GIGE1.json index a964b8e..592fbf6 100644 --- a/configuration/camera_config/SATES30-CAMS182-GIGE1.json +++ b/configuration/camera_config/SATES30-CAMS182-GIGE1.json @@ -24,5 +24,7 @@ "group": [ "Photonics", "Furka" - ] + ], + "check_timestamp": true, + "debug": true } \ No newline at end of file diff --git a/configuration/camera_config/SINBC02-DSRM310.json b/configuration/camera_config/SINBC02-DSRM310.json index 91de77f..b74cca5 100644 --- a/configuration/camera_config/SINBC02-DSRM310.json +++ b/configuration/camera_config/SINBC02-DSRM310.json @@ -18,12 +18,13 @@ "image_background": null, "source_type": "bsread", "connections": 2, + "forwarder_port": 9011, + "threaded": false, "source": "SINBC02-DSRM310", "name": "SINBC02-DSRM310", "group": [ "Electrons", "2Pulses" ], - "alias": [], - "forwarder_port": 9011 + "alias": [] } \ No newline at end of file diff --git a/configuration/camera_config/servers.json b/configuration/camera_config/servers.json index 90d6fdb..2f78209 100644 --- a/configuration/camera_config/servers.json +++ b/configuration/camera_config/servers.json @@ -36,6 +36,7 @@ "S10BC02-DSRM310", "SINDI02-DSCR075", "SINBC02-DSRM310", + "SATBD01-DSCR120", "S10BD01-DSCR030", "SATBD02-DSCR050", "SARCL01-DSCR170" diff --git a/configuration/camera_config/simulation.json b/configuration/camera_config/simulation.json index 6274a6e..a2040e1 100644 --- a/configuration/camera_config/simulation.json +++ b/configuration/camera_config/simulation.json @@ -17,9 +17,9 @@ "source_type": "simulation", "name": "simulation", "source": "", - "_dtype": "uint16", + "dtype": "uint16", "_size_x": 2560, "_size_y": 2160, "image_background": null, - "frame_rate": 20 + "frame_rate": 10 } \ No newline at end of file diff --git a/configuration/camera_config/simulation_2.json b/configuration/camera_config/simulation_2.json index 279bb21..79de2c9 100644 --- a/configuration/camera_config/simulation_2.json +++ b/configuration/camera_config/simulation_2.json @@ -21,5 +21,6 @@ "size_x": 20, "size_y": 20, "simulate_pulse_id": true, + "dtype": "uint16", "image_type": "static_raw" } \ No newline at end of file diff --git a/configuration/camera_config/simulation_3.json b/configuration/camera_config/simulation_3.json index 40e241f..ece991f 100644 --- a/configuration/camera_config/simulation_3.json +++ b/configuration/camera_config/simulation_3.json @@ -17,7 +17,7 @@ "source_type": "simulation", "name": "simulation_3", "source": "", - - "frame_rate":2, + "dtype": "uint16", + "frame_rate": 2, "protocol": "tcp" -} +} \ No newline at end of file diff --git a/configuration/pipeline_config/SARFE10-PBPS053_proc.json b/configuration/pipeline_config/SARFE10-PBPS053_proc.json index 0823b25..d1f4dfd 100644 --- a/configuration/pipeline_config/SARFE10-PBPS053_proc.json +++ b/configuration/pipeline_config/SARFE10-PBPS053_proc.json @@ -17,12 +17,12 @@ "down": "SARFE10-CVME-PHO6212:Lnk9Ch13-DATA-SUM", "right": "SARFE10-CVME-PHO6212:Lnk9Ch14-DATA-SUM", "left": "SARFE10-CVME-PHO6212:Lnk9Ch15-DATA-SUM", - "up_calib": 0.17996411084406255, - "down_calib": 0.1936446951452057, - "left_calib": 0.5083500282429361, - "right_calib": 0.31702738375787964, - "horiz_calib": -3.831090498851583, - "vert_calib": -6.900401171223998, + "up_calib": 33.38277538730609, + "down_calib": 38.98320000065795, + "left_calib": 133.26269065370963, + "right_calib": 35.96174311387501, + "horiz_calib": -8.942189744736796, + "vert_calib": -15.059623048000972, "uJ_calib": 834.5191797495979, "threshold": 0, "queue_length": 5000, @@ -60,9 +60,9 @@ 0.3 ], "calib_x_norm": [ - 0.07869690920714241, - 0.00015605696048788658, - -0.07791646241116247 + -0.044276707967410095, + 0.2216799592001407, + -0.11137436716807164 ], "calib_y_range": [ -0.3, @@ -70,20 +70,20 @@ 0.3 ], "calib_y_norm": [ - 0.04328456031957706, - -0.0008658919986261164, - -0.043666905995470746 + 0.016053576105342932, + -0.03239810243257117, + -0.02378805858149902 ], "calib_time": "2022-11-28 16:19:37", - "calib_datetime": "2023-02-24 09:37:40", + "calib_datetime": "2023-03-09 11:37:14", "calib_x_norm_std": [ - 0.04947026742477487, - 0.04896469167647291, - 0.04682238235649768 + 6.569011858433683, + 4.163696679190494, + 5.902739707642632 ], "calib_y_norm_std": [ - 0.03927572572711935, - 0.04266742337619606, - 0.04007922538741771 + 1.8525151129719428, + 1.8281777825463978, + 1.7905656431049954 ] } \ 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 13b6219..59c694a 100644 --- a/configuration/pipeline_config/SARFE10-PSSS059_psss.json +++ b/configuration/pipeline_config/SARFE10-PSSS059_psss.json @@ -16,5 +16,9 @@ "processing_threads": 6, "thread_buffer_size": 30, "abort_on_error": false, - "pixel_bkg": 1 + "_enforce_pid": true, + "_enforce_timestamp": true, + "pixel_bkg": 1, + "e_axis_name": "SARFE10-PSSS059:SPECTRUM_X", + "e_int_name": "SARFE10-PSSS059:SPECTRUM_Y" } \ No newline at end of file diff --git a/configuration/pipeline_config/SAROP11-PBPS122_proc.json b/configuration/pipeline_config/SAROP11-PBPS122_proc.json index 095b97b..fee2075 100644 --- a/configuration/pipeline_config/SAROP11-PBPS122_proc.json +++ b/configuration/pipeline_config/SAROP11-PBPS122_proc.json @@ -90,5 +90,6 @@ 0.5789543559357142, 0.593537052066037 ], - "calib_datetime": "2023-03-02 10:03:18" + "calib_datetime": "2023-03-02 10:03:18", + "reload": true } \ 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 653c8ad..66a2b33 100644 --- a/configuration/pipeline_config/SAROP21-ATT01_proc.json +++ b/configuration/pipeline_config/SAROP21-ATT01_proc.json @@ -26,6 +26,5 @@ "fel_on_event": 13, "use_dark": true, "filter_window": 201, - "filter": true, - "create_header": "once" + "filter": true } \ No newline at end of file diff --git a/configuration/pipeline_config/SAROP31-PBPS113_proc.json b/configuration/pipeline_config/SAROP31-PBPS113_proc.json index 9eb3c23..033436a 100644 --- a/configuration/pipeline_config/SAROP31-PBPS113_proc.json +++ b/configuration/pipeline_config/SAROP31-PBPS113_proc.json @@ -16,12 +16,12 @@ "down": "SAROP31-PBPS113:Lnk9Ch0-PP_VAL_PD2", "right": "SAROP31-PBPS113:Lnk9Ch0-PP_VAL_PD3", "left": "SAROP31-PBPS113:Lnk9Ch0-PP_VAL_PD0", - "up_calib": 1.9152148189210352e-05, - "down_calib": 1.7064517938972098e-05, - "left_calib": 4.559264973538026e-05, - "right_calib": 4.21026678608106e-05, - "horiz_calib": -3.7945101173783096, - "vert_calib": -6.267291081440332, + "up_calib": 6.840257443212456e-06, + "down_calib": 6.1653460988550605e-06, + "left_calib": 1.6201787692292536e-05, + "right_calib": 1.584162631910054e-05, + "horiz_calib": -3.733833274072839, + "vert_calib": -5.937107209807579, "uJ_calib": 941.943984588351, "threshold": 0, "queue_length": 5000, @@ -60,14 +60,14 @@ 0.3 ], "calib_x_norm": [ - 0.07963838293840791, - 0.001358220973310467, - -0.07848479540076332 + 0.07671441650364863, + -0.0010584166106423775, + -0.08397835040865761 ], "calib_x_norm_std": [ - 0.04998098709944903, - 0.052423818069909645, - 0.05502543975129206 + 0.24206983712709104, + 0.2517192221440592, + 0.2520562331441098 ], "calib_y_range": [ -0.3, @@ -75,14 +75,14 @@ 0.3 ], "calib_y_norm": [ - 0.04821850397110222, - 0.0004276481255550119, - -0.04751663776769661 + 0.0484748027920197, + -0.00020584146521665983, + -0.05258451427890211 ], "calib_y_norm_std": [ - 0.0571110780155187, - 0.0506525496474363, - 0.050722823751144994 + 0.27576174925738167, + 0.2568940077045247, + 0.25090631714920764 ], - "calib_datetime": "2023-02-23 12:08:52" + "calib_datetime": "2023-03-13 01:48:04" } \ No newline at end of file diff --git a/configuration/pipeline_config/SAROP31-PBPS149_proc.json b/configuration/pipeline_config/SAROP31-PBPS149_proc.json index 2a02271..4409d6d 100644 --- a/configuration/pipeline_config/SAROP31-PBPS149_proc.json +++ b/configuration/pipeline_config/SAROP31-PBPS149_proc.json @@ -17,12 +17,12 @@ "down": "SAROP31-PBPS149:Lnk9Ch0-PP_VAL_PD2", "right": "SAROP31-PBPS149:Lnk9Ch0-PP_VAL_PD3", "left": "SAROP31-PBPS149:Lnk9Ch0-PP_VAL_PD0", - "up_calib": 2.885441486512973e-06, - "down_calib": 2.376016195990847e-06, - "left_calib": 1.0536873159624465e-06, - "right_calib": 1.0169703882630227e-06, - "horiz_calib": -5.257574831198954, - "vert_calib": -4.723951569701649, + "up_calib": 6.432612873830011e-06, + "down_calib": 6.072071603811415e-06, + "left_calib": 1.6284081932120653e-05, + "right_calib": 1.503947199662346e-05, + "horiz_calib": -3.814404543017813, + "vert_calib": -6.296827134124412, "uJ_calib": 605.9512700123181, "threshold": 0.0, "queue_length": 5000, @@ -61,14 +61,14 @@ 0.3 ], "calib_x_norm": [ - 0.0568086430437534, - -0.001171639904946471, - -0.057312414528179256 + 0.07865718285455997, + 0.001302420914521733, + -0.07864128751830261 ], "calib_x_norm_std": [ - 0.03560775333350239, - 0.03623513887049099, - 0.03692516564513892 + 0.21792281240335584, + 0.221813763400327, + 0.2291839932442578 ], "calib_y_range": [ -0.3, @@ -76,14 +76,14 @@ 0.3 ], "calib_y_norm": [ - 0.06329100837870344, - -0.0004336835506567439, - -0.06372130136813298 + 0.047239397573796076, + -9.493284078221608e-05, + -0.048046686547589174 ], "calib_y_norm_std": [ - 0.037638465346541604, - 0.03654784966258248, - 0.03906567845477979 + 0.2332859328988798, + 0.22648051418694554, + 0.22181527176057714 ], - "calib_datetime": "2023-02-23 12:59:38" + "calib_datetime": "2023-03-12 00:17:10" } \ No newline at end of file diff --git a/configuration/pipeline_config/SATBD02-DSCR050_db.json b/configuration/pipeline_config/SATBD02-DSCR050_db.json index 431a11d..1004315 100644 --- a/configuration/pipeline_config/SATBD02-DSCR050_db.json +++ b/configuration/pipeline_config/SATBD02-DSCR050_db.json @@ -7,6 +7,12 @@ "function": "propagate_with_prefix", "prefix": "SATBD02-DSCR050:", "exclude": [ - "SATBD02-DSCR050:image" + "SATBD02-DSCR050:image", + "SATBD02-DSCR050:gr_y_axis", + "SATBD02-DSCR050:gr_y_profile", + "SATBD02-DSCR050:gr_y_fit_gauss_function", + "SATBD02-DSCR050:gr_x_axis", + "SATBD02-DSCR050:gr_x_profile", + "SATBD02-DSCR050:gr_x_fit_gauss_function" ] } \ 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 65d156f..f7699f5 100644 --- a/configuration/pipeline_config/SATBD02-DSCR050_sp.json +++ b/configuration/pipeline_config/SATBD02-DSCR050_sp.json @@ -3,12 +3,15 @@ "image_background": "SATBD02-DSCR050_20221013_123827_350915", "image_threshold": null, "image_region_of_interest": [ - 180, - 1497, - 481, - 1136 + 335, + 1463, + 233, + 1481 ], - "image_good_region": null, + "image_good_region": { + "threshold": 0.1, + "gfscale": 10.0 + }, "image_slices": null, "pipeline_type": "processing", "camera_name": "SATBD02-DSCR050", diff --git a/configuration/pipeline_config/permanent_instances.json b/configuration/pipeline_config/permanent_instances.json index d4ae4d3..338ddd1 100644 --- a/configuration/pipeline_config/permanent_instances.json +++ b/configuration/pipeline_config/permanent_instances.json @@ -41,6 +41,7 @@ "#SINBC02-DSRM310_ib": "SINBC02-DSRM310_ib", "#SINDI02-DSCR075_ib": "SINDI02-DSCR075_ib", "#jungfrau_proc": "jungfrau_proc", + "#test_furka": "test_furka", "#test_merge": "test_merge", "#test_proc_with_bs": "test_proc_with_bs", "#test_stream": "test_stream", @@ -85,7 +86,6 @@ "SLAAR21-LCAM-CS842_proc": "SLAAR21-LCAM-CS842_proc", "SLAAR21-LCAM-CS843_proc": "SLAAR21-LCAM-CS843_proc", "SLAAR21-LCAM-CS844_proc": "SLAAR21-LCAM-CS844_proc", - "test_furka": "test_furka", "test_str": "test_str", "test_tadej": "test_tadej" } \ No newline at end of file diff --git a/configuration/pipeline_config/servers.json b/configuration/pipeline_config/servers.json index c99a839..4a4ed61 100644 --- a/configuration/pipeline_config/servers.json +++ b/configuration/pipeline_config/servers.json @@ -39,7 +39,6 @@ "SAROP11-PBPS110_proc:9007", "SAROP31-PBPS113_proc:9013", "SAROP31-PBPS149_proc:9011", - "SAROP21-ATT01_proc", "SAROP11-PBPS122_proc:9010", "SAROP11-ATT01_proc:9016", "SAROP21-PBPS133_proc:9008", @@ -80,7 +79,8 @@ "SINDI02-DSCR075", "SINBC02-DSRM310", "S10BD01-DSCR030", - "SATBD02-DSCR050" + "SATBD02-DSCR050", + "SATBD01-DSCR120" ], "enabled": true, "expanding": false, @@ -100,6 +100,7 @@ "SATBD02-DSCR050_ib:9013", "SATBD02-DSCR050_db:9003", "SARCL01-DSCR170_sp", + "SATBD01-DSCR120_sp", "SARCL01-DSCR170_ib:9014", "SARCL01-DSCR170_profiles:9005" ] diff --git a/configuration/user_scripts/SAROP21-ATT01_Test_proc.py b/configuration/user_scripts/SAROP21-ATT01_Test_proc.py index 21ca341..59f5590 100644 --- a/configuration/user_scripts/SAROP21-ATT01_Test_proc.py +++ b/configuration/user_scripts/SAROP21-ATT01_Test_proc.py @@ -1,4 +1,4 @@ -from collections import deque +from collections import deque, OrderedDict from logging import getLogger from scipy.signal import savgol_filter import numpy as np @@ -67,7 +67,7 @@ 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 = {} + output = OrderedDict() # Read stream inputs prof_sig = data[params["prof_sig"]] @@ -84,6 +84,7 @@ def process(data, pulse_id, timestamp, params): except: output[f"{device}:raw_wf"] = prof_sig + return None return output # added for intermitent cases with prof_sig shorter than filter window events = data[params["events"]] @@ -125,9 +126,11 @@ def process(data, pulse_id, timestamp, params): edge_results["arrival_time_odd"] = edge_results["edge_pos"] * calib except: edge_results["arrival_time_odd"] = calib + + # push pulse ID for debuging edge_results["pulse_id"] = pulse_id - + #debug just return arrival tim #output[f"{device}:arrival_time"] = edge_results["arrival_time"] #try: @@ -135,8 +138,19 @@ def process(data, pulse_id, timestamp, params): #except: # output[f"{device}:arrival_time_even"] = None # Set bs outputs + #log = "" for key, value in edge_results.items(): - output[f"{device}:{key}"] = value + if isinstance(value,np.floating): + value=float(value) + if isinstance(value,np.integer): + value=int(value) + if type(value) == list: + value = np.array(value) + #if isinstance(value,np.ndarray): + # log = log + " | " + str(key) + " - " + str(value.dtype) + " - " + str(value.shape) + #log = log + " | " + str(key) + " - " + str(type(value)) + output[f"{device}:{key}"] = value + #_logger.info(log) #output[f"{device}:raw_wf"] = prof_sig #output[f"{device}:raw_wf_savgol"] = prof_sig_savgol diff --git a/configuration/user_scripts/pbps.py b/configuration/user_scripts/pbps.py index e860624..a361113 100644 --- a/configuration/user_scripts/pbps.py +++ b/configuration/user_scripts/pbps.py @@ -149,9 +149,9 @@ def process(data, pulse_id, timestamp, params): # Set bs outputs output = {} device, _ = params["up"].split(":", 1) - output[f"{device}:INTENSITY"] = intensity - output[f"{device}:INTENSITY_UJ"] = intensity_uJ - output[f"{device}:XPOS"] = xpos - output[f"{device}:YPOS"] = ypos - + output[f"{device}:INTENSITY"] = float(intensity) + output[f"{device}:INTENSITY_UJ"] = float(intensity_uJ) + output[f"{device}:XPOS"] = float(xpos) + output[f"{device}:YPOS"] = float(ypos) + #_logger.info(str(type(intensity)) + " - " +str(type(intensity_uJ)) + " - " +str(type(xpos)) + " - " +str(type(ypos)) + " - " + " - " +str(xpos) + " - " +str(ypos) + " - " ) return output diff --git a/configuration/user_scripts/pbps_full.py b/configuration/user_scripts/pbps_full.py index 682a8f8..55684aa 100644 --- a/configuration/user_scripts/pbps_full.py +++ b/configuration/user_scripts/pbps_full.py @@ -157,10 +157,10 @@ def process(data, pulse_id, timestamp, params): # Set bs outputs output = {} - output[intensity_ch_name] = intensity - output[f"{device}:INTENSITY_UJ"] = intensity_uJ - output[xpos_ch_name] = xpos - output[ypos_ch_name] = ypos + output[intensity_ch_name] = float(intensity) + output[f"{device}:INTENSITY_UJ"] = float(intensity_uJ) + output[xpos_ch_name] = float(xpos) + output[ypos_ch_name] = float(ypos) intensity_pv, xpos_pv, ypos_pv = create_thread_pvs([intensity_ch_name, xpos_ch_name, ypos_ch_name]) if epics_lock.acquire(False): diff --git a/configuration/user_scripts/pprm_gf.py b/configuration/user_scripts/pprm_gf.py index ce23119..a6ddfe8 100644 --- a/configuration/user_scripts/pprm_gf.py +++ b/configuration/user_scripts/pprm_gf.py @@ -5,7 +5,9 @@ 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","y_center_of_mass","y_fwhm","y_rms","y_fit_amplitude", "y_fit_mean","y_fit_offset","y_fit_standard_deviation","y_profile","gr_x_fit_amplitude", "gr_x_fit_mean","gr_x_fit_offset","gr_x_fit_standard_deviation","gr_x_profile","gr_y_fit_amplitude", "gr_y_fit_mean","gr_y_fit_offset","gr_y_fit_standard_deviation","gr_y_profile"] + #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","y_center_of_mass","y_fwhm","y_rms","y_fit_amplitude", "y_fit_mean","y_fit_offset","y_fit_standard_deviation","y_profile","gr_x_fit_amplitude", "gr_x_fit_mean","gr_x_fit_offset","gr_x_fit_standard_deviation","gr_x_profile","gr_y_fit_amplitude", "gr_y_fit_mean","gr_y_fit_offset","gr_y_fit_standard_deviation","gr_y_profile"] + #removed "gr_x_profile" and "gr_y_profile" + 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","y_center_of_mass","y_fwhm","y_rms","y_fit_amplitude", "y_fit_mean","y_fit_offset","y_fit_standard_deviation","y_profile","gr_x_fit_amplitude", "gr_x_fit_mean","gr_x_fit_offset","gr_x_fit_standard_deviation","gr_y_fit_amplitude", "gr_y_fit_mean","gr_y_fit_offset","gr_y_fit_standard_deviation"] prefix = parameters["camera_name"] for c in channels: ret[prefix+":"+c] = r[c] diff --git a/configuration/user_scripts/psss_2.py b/configuration/user_scripts/psss_2.py index 5f58e35..bf34127 100644 --- a/configuration/user_scripts/psss_2.py +++ b/configuration/user_scripts/psss_2.py @@ -14,6 +14,7 @@ import scipy.signal import scipy.optimize import numba import time +import sys from threading import Thread numba.set_num_threads(4) @@ -77,14 +78,14 @@ def initialize(params): global channel_names, spectra_buffer # fit.recompile() camera_name = params["camera_name"] - output_pv_name = camera_name + ":SPECTRUM_Y" + output_pv_name = params["e_int_name"] + axis_pv_name = params["e_axis_name"] center_pv_name = camera_name + ":FIT-COM" fwhm_pv_name = camera_name + ":FIT-FWHM" fit_rms_pv_name = camera_name + ":FIT-RMS" fit_res_pv_name = camera_name + ":FIT-RES" 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 + ":SPECT-COM" std_pv_name = camera_name + ":SPECT-RMS" res_pv_name = camera_name + ":SPECT-RES" @@ -94,6 +95,7 @@ def initialize(params): def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata=None, background=None): + try: global roi, initialized, sent_pid, nrows, axis global channel_names, buffer @@ -177,9 +179,9 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata spectrum_sum = np.sum(spectrum) # outputs - processed_data[camera_name + ":SPECTRUM_Y"] = spectrum + processed_data[parameters["e_int_name"]] = spectrum processed_data[camera_name + ":SPECTRUM_Y_SUM"] = spectrum_sum - processed_data[camera_name + ":SPECTRUM_X"] = axis + processed_data[parameters["e_axis_name"]] = axis processed_data[camera_name + ":FIT-COM"] = np.float64(center) processed_data[camera_name + ":FIT-FWHM"] = np.float64(2.355 * sigma) processed_data[camera_name + ":FIT-RMS"] = np.float64(sigma) @@ -191,10 +193,12 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata try: if pulse_id > sent_pid: sent_pid = pulse_id - buffer.append((processed_data[camera_name + ":SPECTRUM_Y"], processed_data[camera_name + ":FIT-COM"], + buffer.append((processed_data[parameters["e_int_name"]], processed_data[camera_name + ":FIT-COM"], processed_data[camera_name + ":FIT-FWHM"], processed_data[camera_name + ":SPECT-COM"], - processed_data[camera_name + ":SPECT-RMS"],processed_data[camera_name + ":FIT-RMS"],processed_data[camera_name + ":FIT-RES"],processed_data[camera_name + ":SPECT-RES"])) + processed_data[camera_name + ":SPECT-RMS"],processed_data[camera_name + ":FIT-RMS"], + processed_data[camera_name + ":FIT-RES"],processed_data[camera_name + ":SPECT-RES"] )) finally: epics_lock.release() return processed_data - + except Exception as ex: + _logger.warning(str(sys.exc_info)) \ No newline at end of file diff --git a/configuration/user_scripts/psss_avg.py b/configuration/user_scripts/psss_avg.py index 4291e3d..fbba023 100644 --- a/configuration/user_scripts/psss_avg.py +++ b/configuration/user_scripts/psss_avg.py @@ -30,7 +30,7 @@ def update_avg_spectrum(y_pvname, m_pvname, w_pvname): while True: time.sleep(1) - if len(spectra_buffer) != spectra_buffer.maxlen:intervension + if len(spectra_buffer) != spectra_buffer.maxlen: continue _buffer = np.array(spectra_buffer)