sorted out some stuff with the motion lib package
This commit is contained in:
@@ -10,6 +10,7 @@ import threading as th
|
||||
from PIL import Image, ImageDraw
|
||||
import numpy as np
|
||||
from utils import get_datestr, get_timestr
|
||||
#================================adding Paths to local files==============================
|
||||
|
||||
config_path = r"C:\Users\berti_r\Python_Projects\StagePerformaceDocu\Config\config.json" #Path to the config file which has the parameters for the next measurement
|
||||
#library_path = r"C:\Users\berti_r\Python_Projects\templates\motion_libs" #Path to the motion function lib (ESS based)
|
||||
@@ -31,7 +32,7 @@ check_path(config_path)
|
||||
#check_path(library_path)
|
||||
#sys.path.append(library_path)
|
||||
check_path(measurement_mov_path)
|
||||
|
||||
#================================linking modules==============================
|
||||
import motionFunctionsLib as mfl # ToDo: comment out when using torque test
|
||||
from image_analysis import image_center_of_mass, __process_img
|
||||
import ad
|
||||
@@ -42,14 +43,14 @@ import myutility as myu
|
||||
|
||||
if not os.path.exists(workdir):
|
||||
os.makedirs(workdir)
|
||||
|
||||
#================================Connecting to PLC==============================
|
||||
# connect to PLC using NetId and PLC Port (from AIK in the TwinCat) TODO: <- comment out plc connect when using torque test
|
||||
plc = mfl.plc('5.67.222.118.1.1', 852)
|
||||
#TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
#plc.connect()
|
||||
axis2 = mfl.axis(plc, 2)
|
||||
|
||||
#insert try catch later
|
||||
#================================Functions interacting with config of meas==============================
|
||||
def get_pixel_size():
|
||||
config = myu.load_object(config_path)
|
||||
return config.get("pixel_size_mu")
|
||||
@@ -75,7 +76,7 @@ def safe_meas_settings(save_path):
|
||||
print(f"dir: {save_path}")
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
||||
#================================functions for Img processing (depreciated)==============================
|
||||
def compute_gradient(img, pos):
|
||||
x, y = pos
|
||||
x_int, y_int = int(x), int(y)
|
||||
@@ -138,7 +139,7 @@ def band_pass_filter(img_float, low_radius, high_radius):
|
||||
|
||||
return img_back
|
||||
|
||||
|
||||
#================================Measurement functions==============================
|
||||
|
||||
def aquire_avg(camera_a, nr=10):
|
||||
x_array = []
|
||||
@@ -158,7 +159,7 @@ def aquire_avg(camera_a, nr=10):
|
||||
com_x = np.average(x_array)
|
||||
com_y = np.average(y_array)
|
||||
return com_x, com_y
|
||||
|
||||
#================================main function ==============================
|
||||
def run_repeatability_series(
|
||||
motor_pv_prefix=0, ntries=100,save_images=True, run_analysis=False):
|
||||
|
||||
@@ -458,7 +459,7 @@ def analyze_repeatability(input_file, pixel_size, units='um'):
|
||||
print(f"Plot saved in {plot_file:s}")
|
||||
|
||||
|
||||
|
||||
#================================collection of interaction with cam and measurements==============================
|
||||
|
||||
def image_test(motor_on_off=0):
|
||||
if os.getenv("EPICS_CA_ADDR_LIST") is not None:
|
||||
@@ -606,18 +607,4 @@ def my_set_ev():
|
||||
del camera_seting
|
||||
|
||||
|
||||
"""if os.getenv("EPICS_CA_ADDR_LIST") is not None:
|
||||
pass
|
||||
else:
|
||||
os.environ["EPICS_CA_ADDR_LIST"] = "129.129.181.64"
|
||||
|
||||
camera_seting = ad.AD()
|
||||
camera_seting.set_ev_time(init_exposure_time())
|
||||
|
||||
print(camera_seting.get_exposure_time())"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user