Skip to content
4 changes: 2 additions & 2 deletions pylablib/core/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
except ImportError:
metadata=None
try:
import pkg_resources
import importlib.resources as pkg_resources
except ImportError:
pkg_resources=None
import sys
Expand Down Expand Up @@ -227,4 +227,4 @@ def install_if_older(pkg, min_ver="", ignore_frozen=True):
if get_package_version(pkg) is None or cmp_package_version(pkg,min_ver)=="<":
pip_install(pkg,upgrade=True)
return True
return False
return False
29 changes: 18 additions & 11 deletions pylablib/devices/Thorlabs/kinesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def check_background_comm(self, messageID):

_device_SN={ 20:"BSC001", 21:"BPC001", 22:"BNT001", 25:"BMS001", 26:"KST101", 27:"KDC101", 28:"KBD101", 29:"KPZ101",
30:"BSC002", 31:"BPC002", 33:"BDC101", 35:"BMS002", 37:"MFF10." ,
40:"(BSC101|SSC20.)", 41:"BPC101", 43:"BDC101", 44:"PPC001", 45:"LTS", 48:"MMR", 49:"MLJ",
40:"(BSC101|SSC201)", 41:"BPC101", 43:"BDC101", 44:"PPC001", 45:"LTS", 48:"MMR", 49:"MLJ",
50:"MST60" , 51:"MPZ601", 52:"MNA601", 55:"K10CR1", 56:"KLS101", 57:"KNA101", 59:"KSG101",
60:"0ST001", 63:"ODC001", 64:"TLD001", 65:"TIM001", 67:"TBD001", 68:"KSC101", 69:"KPA101",
70:"BSC.03", 71:"BPC.03", 72:"BPS103", 73:"BBD103",
Expand All @@ -213,8 +213,9 @@ def _model_match(self, model_no, port_model_no):
return True
if model_no.startswith(port_model_no):
return True
if re.match("^"+port_model_no+"$",model_no):
return True
for model in port_model_no.split("|"):
if re.match("^"+port_model_no+"$",model_no):
return True
return False
def get_device_info(self, dest="host"):
"""
Expand Down Expand Up @@ -1225,7 +1226,7 @@ def _autodetect_stage(self):
stages={2:"Z706",3:"Z712",4:"Z725",5:"CR1-Z7",6:"PRM1-Z8",
7:"MTS25-Z8",8:"MTS50-Z8",9:"Z825",10:"Z812",11:"Z806"}
return stages.get(stage_id,None)
if self._model=="K10CR1" or self._model.startswith("MPC"):
if self._model=="K10CR1" or self._model.startswith(("MPC", "M30", "KVS30")):
return self._model
return None
def _get_stage(self, scale):
Expand All @@ -1239,6 +1240,8 @@ def _get_step_scale(self, stage):
stage=stage.strip().upper()
if stage=="STEP":
return 1,"step"
if self._model.startswith("M30"):
return 1E7, "m"
if stage in {"MTS25-Z8","MTS50-Z8","Z806","Z812","Z825"}:
return 34304E3,"m"
if stage in {"Z606","Z612","Z625"}:
Expand All @@ -1249,7 +1252,7 @@ def _get_step_scale(self, stage):
return 12288E3,"m"
if stage in {"DDSM50","DDSM100"}:
return 2000E3,"m"
if stage in {"DDS220","DDS300","DDS600","MLS203"}:
if stage in {"DDS220","DDS300","DDS600","MLS203"} or self._model.startswith("KVS30"):
return 20000E3,"m"
if stage=="DDR100":
return 3276800/360,"deg"
Expand All @@ -1259,7 +1262,7 @@ def _get_step_scale(self, stage):
return 1440000/360,"deg"
if stage=="HDR50":
return 75091/0.99997,"deg"
if self._model in ["TST001","MST601"] or self._model.startswith("BSC00") or self._model.startswith("BSC10"):
if self._model in ["TST001","MST601"] or self._model.startswith(("BSC00", "BSC10")):
if stage.startswith("ZST"):
return 125540.35E3,"m"
if stage.startswith("ZFS"):
Expand All @@ -1274,7 +1277,7 @@ def _get_step_scale(self, stage):
return 25600/360,"deg"
if stage=="NR360":
return 25600/(360/66),"deg"
if self._model in ["TST101","KST101","MST602","K10CR1"] or self._model.startswith("BSC20") or self._model.startswith("SSC20"):
if self._model in ["TST101","KST101","MST602","K10CR1"] or self._model.startswith(("BSC20", "SSC20")):
if stage.startswith("ZST"):
return 2008645.63E3,"m"
if stage.startswith("ZFS"):
Expand All @@ -1297,7 +1300,7 @@ def _get_step_scale(self, stage):
return 1,"step"
def _calculate_scale(self, scale):
if isinstance(scale,tuple):
return scale,"user"
return scale
if scale=="stage":
scale=self._stage
if isinstance(scale,py3.textstring) or scale is None:
Expand All @@ -1310,12 +1313,16 @@ def _calculate_scale(self, scale):
if self._model in ["TBD001","KBD101"] or self._model.startswith("BBD10") or self._model.startswith("BBD20"):
time_conv=102.4E-6
return (ssc,ssc*time_conv*2**16,ssc*time_conv**2*2**16),units
if self._model in ["TST001","MST601"] or self._model.startswith("BSC00") or self._model.startswith("BSC10") or self._model.startswith("MPC"):
if self._model in ["TST001","MST601"] or self._model.startswith(("BSC", "MPC", "M30", "KVS30")):
return (ssc,ssc,ssc),units
if self._model in ["TST101","KST101","MST602","K10CR1"] or self._model.startswith("BSC20"):
if self._model in ["TST101","KST101","MST602","K10CR1"]:
vpr=53.68
avr=204.94E-6
return (ssc,ssc*vpr,ssc*vpr*avr),units
if self._model.startswith("BSC20") or self._model.startswith("SCC20"):
vpr=8.26
avr=204.94E-6
return (ssc,ssc*vpr,ssc*vpr*avr),units
warnings.warn("can't recognize motor model {}; setting all scales to internal units".format(self._model))
return (1,1,1),"internal"
def _get_scale(self):
Expand Down Expand Up @@ -1613,4 +1620,4 @@ def v2i(v, scale=10):
open_loop_out=current_parameters.open_loop_out if open_loop_out is None else open_loop_out
data=struct.pack("<hhhhHHhh",xmin,ymin,xmax,ymax,route,open_loop_out,xgain,ygain)
self._quad_set(0x05,data)
return self.get_output_parameters()
return self.get_output_parameters()