BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
microscope.cameras.pvcam.PVParam Class Reference
Inheritance diagram for microscope.cameras.pvcam.PVParam:
microscope.cameras.pvcam.PVEnumParam microscope.cameras.pvcam.PVStringParam

Public Member Functions

def __init__ (self, camera, param_id)
 
def set_value (self, new_value)
 
def access (self)
 
def available (self)
 
def count (self)
 
def values (self)
 
def current (self)
 

Static Public Member Functions

def factory (camera, param_id)
 

Public Attributes

 cam
 
 param_id
 
 name
 
 dtype
 

Detailed Description

A wrapper around PVCAM parameters.

Definition at line 1199 of file pvcam.py.

Constructor & Destructor Documentation

◆ __init__()

def microscope.cameras.pvcam.PVParam.__init__ (   self,
  camera,
  param_id 
)

Definition at line 1224 of file pvcam.py.

1224 def __init__(self, camera, param_id):
1225 # Use a weakref back to the camera to avoid circular dependency.
1226 self.cam = weakref.proxy(camera)
1227 self.param_id = param_id
1228 self.name = _param_to_name[param_id]
1229 self._pvtype = param_id >> 24 & 255
1230 if self.name == "PARAM_READOUT_TIME":
1231 # Bugged. Here is what the SDK says: "The parameter type is
1232 # incorrectly defined. The actual type is TYPE_UNS32."
1233 self._pvtype = TYPE_UNS32
1234 self.dtype = _dtypemap[self._pvtype]
1235 self._ctype = _typemap[self._pvtype]
1236 self.__cache = {}
1237

Member Function Documentation

◆ access()

def microscope.cameras.pvcam.PVParam.access (   self)
Return parameter access attribute.

Definition at line 1303 of file pvcam.py.

1303 def access(self):
1304 """Return parameter access attribute."""
1305 return int(
1306 _get_param(self.cam.handle, self.param_id, ATTR_ACCESS).value
1307 )
1308

References microscope.cameras.pvcam.PVParam.cam, and microscope.cameras.pvcam.PVParam.param_id.

◆ available()

def microscope.cameras.pvcam.PVParam.available (   self)
Return whether or not parameter is available on hardware.

Definition at line 1310 of file pvcam.py.

1310 def available(self):
1311 """Return whether or not parameter is available on hardware."""
1312 return bool(
1313 _get_param(self.cam.handle, self.param_id, ATTR_AVAIL).value
1314 )
1315

References microscope.cameras.pvcam.PVParam.cam, and microscope.cameras.pvcam.PVParam.param_id.

Referenced by microscope.cameras.pvcam.PVParam.set_value().

◆ count()

def microscope.cameras.pvcam.PVParam.count (   self)
Return count of parameter enum entries.

Definition at line 1317 of file pvcam.py.

1317 def count(self):
1318 """Return count of parameter enum entries."""
1319 return int(
1320 _get_param(self.cam.handle, self.param_id, ATTR_COUNT).value
1321 )
1322

References microscope.cameras.pvcam.PVParam.cam, and microscope.cameras.pvcam.PVParam.param_id.

Referenced by microscope.device_server.Filter.filter(), and microscope.cameras.pvcam.PVEnumParam.values().

◆ current()

def microscope.cameras.pvcam.PVParam.current (   self)
Return the current (or cached) parameter value.

Subclasses should override this for more complex data types.

Reimplemented in microscope.cameras.pvcam.PVEnumParam, and microscope.cameras.pvcam.PVStringParam.

Definition at line 1331 of file pvcam.py.

1331 def current(self):
1332 """Return the current (or cached) parameter value.
1333
1334 Subclasses should override this for more complex data types."""
1335 return self._query()
1336
1337

References microscope.cameras.pvcam.PVParam._query().

◆ factory()

def microscope.cameras.pvcam.PVParam.factory (   camera,
  param_id 
)
static
Create a PVParam or appropriate subclass

Definition at line 1203 of file pvcam.py.

1203 def factory(camera, param_id):
1204 """Create a PVParam or appropriate subclass"""
1205 # A mapping of pv parameters types to python types.
1206 # None means unsupported.
1207 # Parameters omitted from the mapping will default to PVParam.
1208 __types__ = {
1209 TYPE_SMART_STREAM_TYPE: None,
1210 TYPE_SMART_STREAM_TYPE_PTR: None,
1211 TYPE_VOID_PTR: None,
1212 TYPE_VOID_PTR_PTR: None,
1213 TYPE_ENUM: PVEnumParam,
1214 TYPE_CHAR_PTR: PVStringParam,
1215 }
1216 # Determine the appropiate type from its id.
1217 pvtype = __types__.get(param_id >> 24 & 255, PVParam)
1218 if pvtype is None:
1220 "Parameter %s not supported" % _param_to_name[param_id]
1221 )
1222 return pvtype(camera, param_id)
1223

References microscope.cameras.pvcam.PVParam.__cache, microscope.cameras.pvcam.PVParam._ctype, microscope.cameras.pvcam.PVParam._pvtype, microscope.cameras.pvcam.PVParam.cam, microscope.abc._Setting.dtype, microscope.cameras.pvcam.PVParam.dtype, microscope.abc._Setting.name, microscope.cameras._SDK3.dllFunction.name, microscope.cameras.atmcd.dllFunction.name, microscope.cameras.pvcam.dllFunction.name, microscope.cameras.pvcam.PVParam.name, BioImager.Automation.Action.name, BioImager.Automation.Recording.name, BioImager.Filt.name, BioImager.Function.name, BioImager.ImageJ.RoiDecoder.name, BioImager.LightSource.name, BioImager.Plot.name, BioImager.Scripting.Script.name, and microscope.cameras.pvcam.PVParam.param_id.

◆ set_value()

def microscope.cameras.pvcam.PVParam.set_value (   self,
  new_value 
)
Set a parameter value.

Subclasses should do whatever processing they need on new_value,
then call super().set_value(new_value)

Reimplemented in microscope.cameras.pvcam.PVEnumParam, and microscope.cameras.pvcam.PVStringParam.

Definition at line 1238 of file pvcam.py.

1238 def set_value(self, new_value):
1239 """Set a parameter value.
1240
1241 Subclasses should do whatever processing they need on new_value,
1242 then call super().set_value(new_value)"""
1243 try:
1244 ref = ctypes.byref(new_value)
1245 except TypeError:
1246 # Need to convert python type to ctype first.
1247 ref = ctypes.byref(self._ctype(new_value))
1248 _set_param(self.cam.handle, self.param_id, ref)
1249 # Read back the value to update cache.
1250 self._query(force_query=True)
1251

References microscope.cameras.pvcam.PVParam.__cache, microscope.cameras.pvcam.PVParam._ctype, microscope.cameras.pvcam.PVParam._query(), microscope.cameras.pvcam.PVParam.available(), microscope.cameras.pvcam.PVParam.cam, microscope.abc._Setting.name, microscope.cameras._SDK3.dllFunction.name, microscope.cameras.atmcd.dllFunction.name, microscope.cameras.pvcam.dllFunction.name, microscope.cameras.pvcam.PVParam.name, BioImager.Automation.Action.name, BioImager.Automation.Recording.name, BioImager.Filt.name, BioImager.Function.name, BioImager.ImageJ.RoiDecoder.name, BioImager.LightSource.name, BioImager.Plot.name, BioImager.Scripting.Script.name, microscope.cameras.pvcam.PVParam.param_id, and microscope.cameras.pvcam.PVParam.set_value().

Referenced by microscope.stages.linkam._LinkamMDSMixin.move_to(), microscope.stages.linkam.LinkamCMS.refill_chamber(), microscope.stages.linkam.LinkamCMS.refill_dewar(), microscope.stages.linkam.LinkamCMS.set_condensor(), microscope.stages.linkam.LinkamCMS.set_light(), and microscope.cameras.pvcam.PVParam.set_value().

◆ values()

def microscope.cameras.pvcam.PVParam.values (   self)
Get parameter min and max values.

Subclasses for strings and enum override this.

Reimplemented in microscope.cameras.pvcam.PVEnumParam, and microscope.cameras.pvcam.PVStringParam.

Definition at line 1324 of file pvcam.py.

1324 def values(self):
1325 """Get parameter min and max values.
1326
1327 Subclasses for strings and enum override this."""
1328 return (self._query(ATTR_MIN), self._query(ATTR_MAX))
1329

References microscope.cameras.pvcam.PVParam._query().

Referenced by microscope.cameras.pvcam.PVEnumParam.set_value().

Member Data Documentation

◆ cam

◆ dtype

microscope.cameras.pvcam.PVParam.dtype

◆ name

◆ param_id


The documentation for this class was generated from the following file: