labscript-suite-oldfinal1 / labscript_devices

Module containing labscript suite hardware compatibility, separate from the main programs. Device compatibility is implemented with a plugin architecture, for modularity and extensibility. Each file in this module contains a labscript device class, a BLACS tab class, a BLACS worker class and a runviewer parser class for a particular device. These implement functionality for the device which the programs in question call on when they encounter each device in user labscript code, hdf5 files, or connection tables.
0 stars 0 forks source link

imaqdx camera server makes model-specific assumptions #31

Open philipstarkey opened 5 years ago

philipstarkey commented 5 years ago

Original report (archived issue) by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


I was setting up a Point Grey Flea 3 camera with the imaqdx camera server, and a bunch of the attributes have different names than what the server assumes.

I'm not 100% sure how to go about fixing this, but I'm told perhaps some sub-part of the attribute string is universal, so perhaps the correct attribute can be found for a particular model by looking at all attributes and looking for that sub-part.

Here's the changes I had to make to get it working. The exposure time attribute has no parts of the string in common with what the server was previously assuming it to be, though I haven't confirmed I can actually change the exposure time with this attribute, haven't gotten that far yet.

Anyhow flagging this as inadequate, we need a better solution, hopefully something better than hard-coding attribute lists by camera model.

@@ -312,7 +316,7 @@

         # Set the camera properties
         timeout_attr = 'AcquisitionAttributes::Timeout'
-        exposure_attr = 'CameraAttributes::Controls::Exposure::ExposureTimeAbs'
+        exposure_attr = 'CameraAttributes::Shutter::Value'
         if timeout_attr not in imaqdx_properties:
             # Set acquisition timeout to fixed value
             print('Setting {} to {:.3f}s'.format(timeout_attr, stop_time + 5))
@@ -329,11 +333,11 @@

         # Get the camera properties
         self.exposure_time = self.camera.get_attribute(exposure_attr)
-        self.width = self.camera.get_attribute('CameraAttributes::ImageFormat::Width')
-        self.height = self.camera.get_attribute('CameraAttributes::ImageFormat::Height')
+        self.width = self.camera.get_attribute('AcquisitionAttributes::Width')
+        self.height = self.camera.get_attribute('AcquisitionAttributes::Height')
         self.binning_horizontal = self.camera.get_attribute('CameraAttributes::ImageMode::BinningHorizontal')
         self.binning_vertical = self.camera.get_attribute('CameraAttributes::ImageMode::BinningVertical')
-        self.pixel_format = self.camera.get_attribute('CameraAttributes::ImageFormat::PixelFormat')
+        self.pixel_format = self.camera.get_attribute('AcquisitionAttributes::PixelFormat')

         print(f'Configuring camera for {self.n_images} images.')
philipstarkey commented 5 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


One solution might be to a) save no attributes. Then we don't need to know what they are called, but the downside is they don't get saved. This is not as bad as it sounds - do you really need to know the dimensions of an image? Pixel format and binning are nice to know, but for specialy usage you will know what they are already and may have saved them as a runmanager global if they are something likely to change.

Another option is b), save all attributes, as returned by IMAQdxEnumerateAttributes2. We also don't need to know what they are called in this case, and they do get saved - but indiscriminately, and there are many of them. This is probably the solution I am leaning toward to make the code properly general

The exposure time is the only one that interacts with labscript. For this, perhaps we could rename the exposure_time attribute in labscript to trigger_width or similar (with an alias for backward compatibility), since that's what it actually is in labscript, and the only reason labscript needs to know about it since it makes the triggers. Otherwise, the user can set the exposure time by setting the appropriate attribute for the camera, and labscript doesn't need to know what the attribute is called. In the case that this corresponds to the exposure time, this is because the user has configured the camera that way - it is not something that is always true.

Removing these references to specific attributes would allow the code to be completely general.

Thoughts, @rpanderson?

philipstarkey commented 5 years ago

Original comment by Russell Anderson (Bitbucket: rpanderson, GitHub: rpanderson).


Option (b) is good.

Regarding the exposure_time attribute: yes, labscript only needs to know about this in the context of a trigger width, but the two are not synonymous, and renaming it might cause confusion. The trigger width only corresponds to the the exposure time if the TriggerSelector, TriggerMode, and TriggerActivation attributes are set correctly.

See my comments to pull request #63.