This commit is contained in:
root
2022-08-15 15:11:24 +02:00
parent ec92902990
commit 1cf100baa9
16 changed files with 82 additions and 59 deletions

View File

@@ -1,10 +1,10 @@
{
"camera_calibration": {
"reference_marker": [
1190,
578,
1202,
596
1192,
587,
1199,
594
],
"reference_marker_width": 42.0,
"reference_marker_height": 42.0,

View File

@@ -2,9 +2,9 @@
"camera_calibration": {
"reference_marker": [
1296,
988,
1349,
1134
1039,
1394,
1152
],
"reference_marker_width": 136.0,
"reference_marker_height": 137.0,

View File

@@ -16,7 +16,7 @@
"rotate": 0,
"roi": null,
"image_background": null,
"source_type": "epics",
"source_type": "bsread",
"prefix": "SARES20-PROF141-M1",
"name": "SARES20-PROF141-M1",
"source": "SARES20-PROF141-M1",

View File

@@ -16,14 +16,14 @@
"rotate": 0,
"roi": null,
"image_background": null,
"source_type": "epics",
"name": "SAROP21-PPRM138",
"source": "SAROP21-PPRM138",
"source_type": "bsread",
"group": [
"Photonics",
"Bernina"
],
"alias": [
"PROF_ATT (SAROP21-PPRM138)"
]
],
"name": "SAROP21-PPRM138",
"source": "SAROP21-PPRM138"
}

View File

@@ -23,11 +23,12 @@
"instances": []
},
"http://sf-daqsync-04.psi.ch:8880": {
"enabled": true,
"enabled": false,
"expanding": false,
"instances": []
},
"http://sf-daqsync-05.psi.ch:8880": {
"enabled": false,
"expanding": false,
"instances": []
},
@@ -105,4 +106,4 @@
"expanding": false,
"instances": []
}
}
}

View File

@@ -1,6 +1,6 @@
{
"image_background_enable": "passive",
"image_background": "SARES11-SPEC125-M1_20220702_175312_661472",
"image_background": "SARES11-SPEC125-M1_20220719_155656_052483",
"image_threshold": null,
"image_region_of_interest": null,
"image_good_region": null,

View File

@@ -11,12 +11,19 @@
"name": "SARES11-XMI125-C4P1_db",
"mode": "PUSH",
"roi_signal": [
0,
1024,
0,
1280
600,
1000,
550,
750
],
"no_client_timeout": 0,
"pixel_bkg": 0,
"port": "9011"
"port": "9011",
"multiprocessing": false,
"_buffer_size": 5,
"processing_threads": 3,
"thread_buffer_size": 20,
"send_buffer_size": 50,
"block": false,
"debug": true
}

View File

@@ -19,12 +19,12 @@
"down": "SAROP11-CVME-PBPS2:Lnk9Ch11-DATA-SUM",
"right": "SAROP11-CVME-PBPS2:Lnk9Ch14-DATA-SUM",
"left": "SAROP11-CVME-PBPS2:Lnk9Ch15-DATA-SUM",
"up_calib": 0.4745836387414782,
"down_calib": 0.5560757031313921,
"left_calib": 0.3264283790325681,
"right_calib": 0.3463639735196534,
"horiz_calib": -4.37433336689245,
"vert_calib": 4.846107248781251,
"up_calib": 0.7009986890982698,
"down_calib": 0.7808270234896648,
"left_calib": 0.43420142538784995,
"right_calib": 0.4903870266897458,
"horiz_calib": -4.699602873741405,
"vert_calib": 4.466420368917907,
"uJ_calib": 605.4608924473305,
"threshold": 0,
"queue_length": 5000,
@@ -56,4 +56,4 @@
"xpos_dif_w_pvname": "SAROP11-PBPS110:XPOS-DIF-HIST-W",
"ypos_dif_m_pvname": "SAROP11-PBPS110:YPOS-DIF-HIST-M",
"ypos_dif_w_pvname": "SAROP11-PBPS110:YPOS-DIF-HIST-W"
}
}

View File

@@ -1,11 +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",
"camera_name": "SAROP31-PBPS113",
"name": "SAROP31-PBPS113_sp"
}

View File

@@ -1,11 +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",
"camera_name": "SAROP31-PSCR068",
"name": "SAROP31-PSCR068"
}

View File

@@ -4,6 +4,7 @@
"#SARES11-SPEC125-M2_psen_ib": "SARES11-SPEC125-M2_psen_ib1",
"#SARES12-CAMS128-M1_psen_db": "SARES12-CAMS128-M1_psen_db",
"#SARES12-CAMS128-M1_psen_ib": "SARES12-CAMS128-M1_psen_ib",
"#SARES30-CAMS156-PCO1_ib": "SARES30-CAMS156-PCO1_ib",
"#test_stream": "test_stream",
"#testdb_ib": "testdb_ib",
"SARES11-SPEC125-M1_psen_db": "SARES11-SPEC125-M1_psen_db1",

View File

@@ -24,7 +24,7 @@
},
"http://sf-daqsync-02.psi.ch:8881": {
"cameras": [],
"enabled": true,
"enabled": false,
"expanding": false,
"instances": []
},
@@ -55,19 +55,20 @@
},
"http://sf-daqsync-04.psi.ch:8881": {
"cameras": [],
"enabled": true,
"enabled": false,
"expanding": false,
"instances": []
},
"http://sf-daqsync-05.psi.ch:8881": {
"cameras": [],
"enabled": true,
"enabled": false,
"expanding": false,
"instances": []
},
"http://sf-daqsync-06.psi.ch:8881": {
"cameras": [
"SARES30-CAMS156-XE",
"SARES30-CAMS156-PCO1",
"SAROP31-PPRM113",
"SAROP31-PPRM150"
],
@@ -75,12 +76,14 @@
"expanding": false,
"instances": [
"SARES30-CAMS156-XE_sp",
"SARES30-CAMS156-PCO1_sp",
"SAROP31-PPRM113_sp",
"SAROP31-PPRM150_sp",
"SAROP31-PPRM113_proc:9001",
"SAROP31-PPRM113_ib:9000",
"SAROP31-PPRM150_ib:9002",
"SAROP31-PPRM150_proc:9003"
"SAROP31-PPRM150_proc:9003",
"SARES30-CAMS156-PCO1_ib:9004"
]
},
"http://sf-daqsync-08.psi.ch:8881": {

View File

@@ -18,7 +18,7 @@ nus = 299792458 / (lambdas * 10**-9) # frequency space, uneven
nus_new = np.linspace(nus[0], nus[-1], num=2048, endpoint=True) # frequency space, even
filters = {
"YAG": np.concatenate((np.ones(20),signal.tukey(40)[20:40], np.zeros(2008), np.zeros(2048))), # back timetool YAG
"SiN": np.concatenate((signal.tukey(40)[25:40], np.zeros(2033), np.zeros(2048))) # SiN
"SiN": np.concatenate((signal.tukey(40)[25:40], np.zeros(2033), np.zeros(2048))) # back timetool SiN
}
# Functions for image analysis and spectral encoding processing
@@ -90,6 +90,7 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata
background_mode = parameters.get("image_background_enable")
roi_signal = parameters.get("roi_signal")
project_axis = parameters.get("project_axis", 0)
#events = data[parameters["events"]] # added 2022-07-19
# maintain the structure of processing_parameters
background_shape = None
@@ -102,7 +103,7 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata
if roi_signal is not None:
projection_background = get_roi_projection(background, roi_signal, project_axis)
projection_signal = get_roi_projection(image, roi_signal, project_axis)
peak_pos, peak_amp, sig_deriv, sig_uninterp = edge("SiN", projection_background, projection_signal, 0)
peak_pos, peak_amp, sig_deriv, sig_uninterp = edge("YAG", projection_background, projection_signal, 0)
except Exception as e:
lineno = sys.exc_info()[2].tb_lineno
@@ -116,6 +117,7 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata
"status": status,
"background_name": background_name,
"roi_signal": roi_signal
#"events": events[21]
}
processing_parameters = json.dumps(processing_parameters)

View File

@@ -1,6 +1,8 @@
from cam_server.pipeline.data_processing import functions, processor
import json
import scipy.signal
import numpy as np
from collections import deque
from logging import getLogger
@@ -11,6 +13,7 @@ background = deque(maxlen=4)
DEFAULT_ROI_SIGNAL = None
DEFAULT_ROI_BACKGROUND = None
um_per_px = 2.28 # calibrated xxxx-yy-zz
def get_roi_projection(image, roi, axis):
x_start, x_stop, y_start, y_stop = roi
@@ -18,15 +21,38 @@ def get_roi_projection(image, roi, axis):
project = cropped.mean(axis=axis)
return project
def find_spacing(py, extend=5):
"finds the spacing of a (laser or x-ray induced) ladder on a high viscosity jet from the microscope images"
py -= py.mean()
if extend > 1:
py = np.concatenate((py, np.zeros(len(py) * extend)))
spectrum = np.abs(np.fft.fft(py))
freq = np.fft.fftfreq(len(spectrum))
which = (freq > 0.005)
spectrum = spectrum[which]
freq = freq[which]
index_peaks = scipy.signal.find_peaks(spectrum)[0]
peaks_pos = freq[index_peaks]
peak_height = spectrum[index_peaks]
cut_freq = peaks_pos[np.argmax(peak_height)]
return freq, spectrum, cut_freq
def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata=None):
processed_data = dict()
if bsdata is not None:
processed_data.update(bsdata)
event = processed_data.get("SAR-CVME-TIFALL4:EvtSet", None)
event = processed_data.get("SAR-CVME-TIFALL4:EvtSet", None)
image = image.astype("int64")
image_property_name = parameters["camera_name"]
roi_signal = parameters.get("roi_signal", DEFAULT_ROI_SIGNAL)
@@ -38,4 +64,8 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata
jet_width = get_roi_projection(image, roi_signal, 0)
processed_data[image_property_name + ".jet_width"] = jet_width
freq, spectrum, cut_freq = find_spacing(jet_projection, extend=10)
jet_spacing = um_per_px / cut_freq
processed_data[image_property_name + ".jet_spacing"] = jet_spacing
return processed_data

View File

@@ -161,7 +161,7 @@ def process(data, pulse_id, timestamp, params):
output[f"{device}:INTENSITY_UJ"] = intensity_uJ
output[xpos_ch_name] = xpos
output[ypos_ch_name] = ypos
intensity_pv, xpos_pv, ypos_pv = create_thread_pvs([intensity_ch_name, xpos_ch_name, ypos_ch_name])
if epics_lock.acquire(False):
try:

View File

@@ -9,4 +9,5 @@ def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata
prefix = parameters["camera_name"]
for c in channels:
ret[prefix+":"+c] = r[c]
ret['input_pulse_id'] = pulse_id
return ret