Files
dev/script/cpython/wrapper.py
2019-08-16 11:37:13 +02:00

37 lines
1.7 KiB
Python
Executable File

from jeputils import *
def gfitoff(x, y, off=None, amp=None, com=None, sigma=None):
ret = call_jep("cpython/GaussFit", "gfitoff", [to_npa(x), to_npa(y), off, amp, com, sigma])
return ret if ret is None or is_list(ret) else ret.data
MODULE = "cpython/SimulatedCamera"
def new_simulated_camera(size_x=1280, size_y=960, number_of_dead_pixels=100, noise=0.1, beam_size_x=100, beam_size_y=20):
ret = call_jep("cpython/SimulatedCamera", "new_simulated_camera", [None, size_x, size_y, number_of_dead_pixels, noise, beam_size_x, beam_size_y ])
return ret
def get_image(raw=False):
ret = call_jep("cpython/SimulatedCamera", "get_image", [raw])
return ret.data
def img_get_int(fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2 , filter_median = False, filter_nsigma = 0):
ret = call_jep("cpython/image_functions", "img_get_int", [fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2, filter_median, filter_nsigma])
#return ret
#TODO: Why I_sum ans I_sum_bgr are strings?
(I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = ret
return (int(I_sum), area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, int(I_sum_bgr), area_bgr)
def img_read(fname, header, width, height, depth):
ret = call_jep("cpython/image_functions", "img_read", [fname, header, width, height, depth])
#return Convert.reshape(ret.data, width, height)
return ret.data
#def hfitoff(data, xdeg):
# ret = call_jep("cpython/hfitoff", "hfitoff", [to_npa(data),to_npa(xdeg)])
# return (ret[0], ret[1], ret[2],ret[3], ret[4].data, ret[5].data)