27 lines
920 B
Python
27 lines
920 B
Python
from collections import OrderedDict
|
|
from cam_server.pipeline.data_processing import functions, processor
|
|
from logging import getLogger
|
|
import numpy as np
|
|
|
|
_logger = getLogger(__name__)
|
|
|
|
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_fit_mean","y_fit_mean"]
|
|
prefix = parameters["camera_name"]
|
|
for c in channels:
|
|
value = r[c]
|
|
if value is None:
|
|
_logger.warning("None:" + str(c))
|
|
return None
|
|
if value == float('nan'):
|
|
_logger.warning("NAN:" + str(c))
|
|
return None
|
|
if isinstance(value,np.floating):
|
|
value=float(value)
|
|
if isinstance(value,np.integer):
|
|
value=int(value)
|
|
ret[prefix+":"+c] = value
|
|
return ret
|