Giter Club home page Giter Club logo

instrumental's People

Contributors

alexsludds avatar czee avatar eedm avatar fmarazzi avatar ivan-galinskiy avatar jondoesntgit avatar max-herbold avatar natezb avatar rogers132 avatar sdshlanta avatar seb5g avatar sylvainpelissier avatar zakv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

instrumental's Issues

optics.beam_tools.get_profiles

I have a Python(X,Y) 2.7.10 installation and have I have installed instrumental-lib using pip on a Windows7 machine. I get the error message below when I try to run the quick-start example from readthedocs.:

Traceback (most recent call last):
File "C:\Users....\Instrumental.py", line 18, in
plot_profile(qt_r, qs_r, '1064nm', cavity_elems, cyclical=True)
File "C:\Python27\lib\site-packages\instrumental\optics\beam_plotting.py", line 85, in plot_profile
clipping, zeroat)
File "C:\Python27\lib\site-packages\instrumental\optics\beam_tools.py", line 133, in get_profiles
z = linspace(cur_z, cur_z + el.d, 10000, endpoint=(i == len(rev_elems)-1))
File "C:\Python27\lib\site-packages\numpy\core\function_base.py", line 93, in linspace
dt = result_type(start, stop, float(num))
TypeError: data type not understood

Add external trigger support to uc480 driver

In reference to #5.

I'd suggest an API something like the following:

set_trigger(self, mode, edge='rising')

mode is 'off', 'hardware', or 'software' (default)
edge is 'rising' or 'falling'

set_trigger_delay(self, delay)

delay is a string or pint Quantity (see e.g. grab_image for an example of this)

Note that currently start_capture() calls is_SetExternalTrigger() every time (and so does start_live_video()), so these will need to be changed accordingly.

Cannot Load Thorlabs Camera Parameters from file

I am using a Thorlabs DCx camera and trying to use the load_params() command. I have written a .tcp file from ThorCam and want to load it during use with Instrumental.

The error I am getting is:

Traceback (most recent call last):
File "C:/Users/ntoyonaga/Documents/test/multiCamera.py", line 20, in
cam1.load_params('camProfile.tcp')
File "C:\Users\ntoyonaga\AppData\Local\Continuum\anaconda3\envs\test_env\lib\site-packages\instrumental\drivers\cameras\uc480.py", line 488, in load_params
self._dev.ParameterSet(cmd, param, ffi.sizeof(param))
File "C:\Users\ntoyonaga\AppData\Local\Continuum\anaconda3\envs\test_env\lib\site-packages\nicelib\nicelib.py", line 824, in call
result = self._func(*(self._handles + args), niceobj=self._niceobj)
File "C:\Users\ntoyonaga\AppData\Local\Continuum\anaconda3\envs\test_env\lib\site-packages\nicelib\nicelib.py", line 433, in wrapped
"{}".format(inarg, argtype))
TypeError: Cannot convert <cdata 'wchar_t[]' owning 30 bytes> to required type<ctype 'void *'>

Add Unit Testing

This one's challenging because Instrumental is so hardware-centric, and failure to import unsupported drivers is actually a feature. Also, it's hard to automatically (from software) tell that hardware is working correctly, and you don't want to tell an instrument to start doing random things like setting DAQ voltages that could break something.

However, you could have optional hardware tests that do simple things like opening and closing a device, maybe querying some basic info. Non-hardware, non-optional codepaths should be as fully tested as possible.

At there very least, there should be regression testing to make sure drivers don't break due to stupid things like syntax errors that were overlooked.

After looking into the frameworks, I'd like to use pytest.

Problems using Instrumental with py2exe, need option to specify custom defaults_en.txt for pint.

I'm running into issues using py2exe to package an applicaton using instrumental because the pint-module in Instrumental is configured to only use the default config-files (defaults_en.txt). The issue is discribed in further detail here.
http://stackoverflow.com/questions/30769305/python-py2exe-error-after-compile

It would be convenient to have an option in Instrumental to use custom config text file for pint.

Any ideas how I can solve this without forking Instrumental and using the solution given in the Stack overflow-link?

[motion.kinesis] Organize Kinesis to support multiple devices

The Thorlabs Kinesis software can be used to control many devices, using many interrelated headers and DLLs. Each device-specific DLL depends on Thorlabs.MotionControl.DeviceManager.dll, which provides TLI_ functions for listing and getting info of all kinesis devices on the system.

Then there are the device-specific functions, e.g. those starting with FF_, ISC_, BMC_, etc. There are a number of device-specific functions that are the same (barring the prefix) across the drivers, as well as completely different functions.

I think a proper kinesis-wide driver would have a list_instruments() which doesn't require any of the device-specific driver wrappers to be built.

  • Create a mini-header that just contains the TLI_ functions and data structures
  • Separate mid-level libraries into their own modules
  • Separate DLL-specific drivers into their own modules

Other Considerations:

  • Should minimize the amount of repeated code
    • Probably doesn't matter as much for the mid-level bindings, since Sigs are pretty compact, though it could be nice to have a central collection of all Sigs, which get selectively added to each mid-level class
    • Could reuse code in drivers either by using subclassing, or having a common collection of functions which can be selectively added as methods to each Instrument class.
  • Might want some kind of "unsupported instrument" marker for ParamSets, so we can return ParamSets even for Kinesis devices we haven't yet written a specific Instrument class for.
  • Should move all kinesis files other than kinesis.py (and maybe _build_kinesis.py?) into a separate _kinesis subdirectory.

I'm working on this a bit now, in a separate branch which I'll be pushing shortly.

Issue releasing device resources from 0.3.1 to 0.4.2

I have a function:

def func():
     daq = NIDAQ('Dev1')
     task = Task(daq.ao0, daq.ai0)
     task.set_timing(duration='1s', fsamp='1000Hz')
     task.run(data) # data is a dict

The first time I run this function it works as expected. The second time I run this function it causes error stating that device is already in use. I only get this when using 0.4.2, but when reverting back to 0.3.1 this goes away and works great. I haven't tried other versions, but will soon.

Issue when using multiple thorlabs 480x cameras

This problem is the underlying reason I made #44 -- but rather than self-diagnosing perhaps this is a more general issue in Instrumental.

I have loaded two thorlabs camera objects, cam1 and cam2. They are physically identical and I am using them in a stereo application so they are under similar physical lighting conditions. When I use the "ThorCam" application they obviously produce similar quality images.

However, when I try to load them and take images in instrumental the first image captured (here cam1) always comes out signficantly brighter than the other. My code is as follows:

cam1 = instrument(instrumentList[1])
cam2 = instrument(instrumentList[0])

img1 = cam1.grab_image(exposure_time = "10ms")  ##set exposure using "x_ms"
img2 = cam2.grab_image(exposure_time = "10ms" )

I have tried taking multiple images with each camera (since I know opencv has an issue where sometimes repeated image captures are necessary to get the real image. However, all images taken by cam1 are bright and all by cam2 are dark.

Additionally, switching the physical camera associated with cam1 and cam2 does not change which is brighter and darker. In other words whichever physical device is loaded as cam1 and whichever is loaded as cam2, cam1 is brighter and cam2 is darker.

However, reversing the order (taking cam2 before cam1) does change which is brighter. When I capture Cam2 first and Cam1 2nd, Cam2 has a bright image and Cam1 a dark image.

Thanks!

Thorlabs camera not recognised

Hello,

I am trying to connect to a Thorlabs camera UI-3240LE_NIR-GL but I'm getting errors and the camera is not recognised.

When I try

from instrumental.drivers.cameras import uc480

The output is:

Module _uc480lib does not yet exist, building it now. This may take a minute...
Searching for headers...
Traceback (most recent call last):
  File "R:\aa938\NanoPhotonics\Python\camera.py", line 9, in <module>
    from instrumental.drivers.cameras import uc480
  File "c:\users\ana andres\documents\github\instrumental\instrumental\drivers\cameras\uc480.py", line 28, in <module>
    info = load_lib('uc480', __package__)
  File "C:\Program Files\Anaconda2\lib\site-packages\nicelib\__init__.py", line 81, in load_lib
    lib_module = _load_or_build_lib(name, pkg)
  File "C:\Program Files\Anaconda2\lib\site-packages\nicelib\__init__.py", line 67, in _load_or_build_lib
    build_module.build()
  File "c:\users\ana andres\documents\github\instrumental\instrumental\drivers\cameras\_build_uc480.py", line 35, in build
    ignore_system_headers=True)
  File "C:\Program Files\Anaconda2\lib\site-packages\nicelib\build.py", line 93, in build_lib
    header_paths, predef_path = handle_header_path(header_info)
  File "C:\Program Files\Anaconda2\lib\site-packages\nicelib\util.py", line 53, in handle_header_path
    raise KeyError("Header dict must contain key 'header'")
KeyError: "Header dict must contain key 'header'"

And when I try

from instrumental import list_instruments
paramsets = list_instruments()
print paramsets

The output is empty.

I have checked that the camera can be seen by the ThorCam software.

Thank you for any advice.

Recording changes in instrument's state via logging

Hey guys,

I've developed my own library for controlling hardware over at https://github.com/jondoesntgit/hardware. One of the features that we're implementing in our library is this notion of "logging" any changes of instrument state to a file. When an instrument is loaded, all of its properties and settings are appended to a text file associated with that day's date, along with a timestamp. When an experiment is being performed, this can be helpful for keeping good records of what changed in what order.

Do you have plans of implementing this in your repository?

list_instruments() does not see Thorlabs DCx camera

I am using python 3.6.1 and instrumental 0.4.2.

As per the advice in this issue, I ran the import command from instrumental.drivers.cameras import uc480.

The error I got was:

Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 20, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\ntoyonaga\AppData\Local\Continuum\anaconda3\envs\test_env\lib\site-packages\instrumental\drivers\cameras\uc480.py", line 15, in
import win32event
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 20, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'win32event'

Any help much appreciated!

Cannot connect to Bristol 721 Spectrometer

I've tried to connect to a Bristol 721 spectrometer (NIR model), but there appears to be an error in the initial communication to initialise the device. It appears to be a checksum error, and the command line continues displaying this message until a keyboard interrupt is sent. Any ideas as to why this is happening?

Mock Instruments

Hey,

I would like to write a functionality to mock some instruments based on this framework. Something akin to what QCoDeS refers to as a Manual Instrument. Would you be willing to merge this in if I wrote it?

Jonathan

Attocube ECC100 issues

Hello,

Im trying to use your driver module to create my own raster scan program using the ECC100. However, I am finding it very difficult to set things like the amplitude and frequency as it keeps giving me a dimensionality error? How do you enter in a value to change these quantities as it is not clear at all in the documentation.

Thanks

Andrew

Issues connecting with Thorlabs DCC3260C Camera

I'm trying to run a thorlabs DCC3260C Camera, but it is not showing in the instruments list. The camera works well with the Thorcams software. Also, I tried using "from instrumental import instrument, list_instruments but get the second error below about not fining library. Any help is appreciated!

C:\Users\berto_perez-reyes>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from instrumental import instrument, list_instruments
paramsets = list_instruments()
paramsets
[]

from instrumental.drivers.cameras import uc480
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\instrumental\drivers\cameras\uc480.py", line 28, in
info = load_lib('uc480', package)
File "C:\Python27\lib\site-packages\nicelib_init_.py", line 67, in load_lib
build_module.build(**kwargs)
File "C:\Python27\lib\site-packages\instrumental\drivers\cameras_build_uc480.py", line 35, in build
ignore_system_headers=True)
File "C:\Python27\lib\site-packages\nicelib\build.py", line 113, in build_lib
lib_name = handle_lib_name(lib_name, filedir)
File "C:\Python27\lib\site-packages\nicelib\util.py", line 152, in handle_lib_name
raise ValueError("Cannot find library '{}'".format(lib_names))
ValueError: Cannot find library '('uc480', 'ueye_api')'

Cannot interrogate NI9215 using ni.py out of the box

When I try to load the NI9215 DAQ, I get the following stack trace:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-ef151580f6db> in <module>()
----> 1 daq = instrument(paramsets[0])

c:\users\daq\dropbox\digonnet\instrumental\instrumental\drivers\__init__.py in instrument(inst, **kwargs)
   1265         inst = find_visa_instrument_by_module(params)
   1266     else:
-> 1267         inst = find_nonvisa_instrument(params)
   1268 
   1269     if inst is None:

c:\users\daq\dropbox\digonnet\instrumental\instrumental\drivers\__init__.py in find_nonvisa_instrument(params)
   1165         for classname in classnames:
   1166             try:
-> 1167                 return create_instrument(driver_module, classname, normalized_params)
   1168             except (InstrumentTypeError, InstrumentNotFoundError):
   1169                 log.info("Failed to create instrument using '%s'", classname)

c:\users\daq\dropbox\digonnet\instrumental\instrumental\drivers\__init__.py in create_instrument(driver_module, classname, paramset, visa_inst)
   1085         return cls._create(paramset, _rsrc=visa_inst)
   1086     else:
-> 1087         return cls._create(paramset)
   1088 
   1089 

c:\users\daq\dropbox\digonnet\instrumental\instrumental\drivers\__init__.py in _create(cls, paramset, **other_attrs)
    511         obj._before_init()
    512         obj._fill_out_paramset()
--> 513         obj._initialize(**paramset.get('settings', {}))
    514         obj._after_init()
    515         return obj

c:\users\daq\dropbox\digonnet\instrumental\instrumental\drivers\daq\ni.py in _initialize(self)
   1437         self._load_analog_channels()
   1438         self._load_internal_channels()
-> 1439         self._load_digital_ports()
   1440 
   1441     def _create_mini_task(self, io_type):

c:\users\daq\dropbox\digonnet\instrumental\instrumental\drivers\daq\ni.py in _load_digital_ports(self)
   1459         for line_path in self._dev.GetDevDILines().decode().split(','):
-> 1460             port_name, line_name = line_path.rsplit('/', 2)[-2:]
   1461             if port_name not in ports:
   1462                 ports[port_name] = []

ValueError: not enough values to unpack (expected 2, got 1)

cannot import name errortext

I'm trying to talk to a PCO camera using Instrumental. I don't see any output from list_instruments(), instead I get the following:

Module _uc480lib does not yet exist, building it now. This may take a minute...
Searching for headers...
Module _nilib does not yet exist, building it now. This may take a minute...
Searching for headers...

When I try import instrumental.drivers.cameras.pco, I get the following:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "instrumental\drivers\cameras\pco.py", line 18, in <module>
    from ._pixelfly import errortext
ImportError: cannot import name errortext

Any ideas? I'm probably doing something stupid, but I can't quite see what. I've got the latest version from Github, but errortext doesn't seem to be present.

A data structure for multiple instruments

I'm wanting to group multiple instruments together into larger instruments, similar to what QCoDeS describes as a Meta Instrument.

One idea that I had was to store the instruments, and perhaps devices together in an Apparatus class. I might write another library that also describes a Device class, that would represent some object, like a laser diode. The laser diode could be connected to some laser diode driver Instrument. Together, these could be described as an Apparatus that would also have some properties, perhaps "intensity."

Is this functionality something that would be useful integrating into this framework, or should I write another library that implements Instrumental?

This answer might also depend on #56

DAQ analog output data is assigned to a random channel

When I tried writing data to multiple output channels via a Task, I noticed that the output data were coming out of the wrong channel! Which channel each set of data was assigned to was random, and only changed upon resetting the program.

I noticed that ni.py, line 177-178 depends on the order of output channels listed. Python doesn't necessarily always keep dictionaries in the same order, so this was effectively jumbling the output channels.
ao_names = [name for (name, ch) in self.channels.items() if ch.type == 'AO'] arr = np.concatenate([Q_(data[ao]).to('V').magnitude for ao in ao_names])

To ensure consistency, I've added a line before 178 that sorts ao_names before creating arr, with a short comment explaining the sorting function.
ao_names.sort(key=lambda x: [int(s) if s.isdigit() else s for s in x.split()]) # key = function sorts by number preferentially

Let me know if there's a better way of doing this!

nicelib does not get installed by instrumental's setup.py

Just did a clean install on a lab computer, and for importing instrumental.drivers.daq.ni I got an ImportError: No module named 'nicelib'

Easily resolved by pip install nicelib, but perhaps it would be good to include the dependency in setup.py

Cannot use non-VISA instrument without PyVISA or FakeVISA set up

You should be able to use a non-VISA instrument (e.g. an Attocube stage) even if VISA isn't configured properly.

Currently, importing anything from the drivers package forces FakeVISA to try to connect to a server, and if it doesn't find it, it will raise an exception.

Cannot import name list_instruments / instrument 'module' object is not callable

Hello,

I have updated my instrumental version from 0.5.dev.1 to 0.5.1 according to the output from instrumental.__version__ in Spyder but 0.5.3 according to the output from conda list or pip list in the command prompt (nicelib is the same at version 0.4) and I now get the following errors:

When I try: from instrumental import list_instruments
I get: ImportError: cannot import name list_instruments

When I try:

from instrumental import instrument
instrument('uc480')

I get: TypeError: 'module' object is not callable

My first thought was that list_instruments and instrument have been re-organised but I I haven't been able to find their new location, and I'm not sure if I have inadvertently changed something else.

I updated the instrumental library in my computer because, even thought it was working well, I tried installing it in another computer to control a UI-3240LE camera and it was giving me these errors. Therefore I wanted to have both computers with the latest version of instrumental and then my computer started giving these errors too.

Thank you for any advice.

Not recognizing Thorlabs camera

I'm having an issue where I can't see the Thorlabs camera with list_instruments() on some computers. I have it working on a couple of computers just fine, but on others, it won't recognize the camera at all. On the computers that it doesn't work, I tried reinstalling and matching the driver for the Thorlab camera to the driver on the working computers. Same OS (Windows 10) on some computers even. Any ideas what the issue could be?

Fix IDS uEye support in UC480 driver

After switching to NiceLib for this driver, we're currently only searching for the Thorlabs version of the header (uc480.h), not the IDS version (uEye.h). I think it's reasonable to implement support for multiple sets of possible headers within NiceLib, just as multiple possible lib binaries are supported.

Thorlabs Camera Viewing Live Image

Hello,

I have a Thorlabs camera that I'm trying to be able to get live images from. I have gotten my camera to work with xxxx.grab_image( ) but I'm not able to make it work with xxxx.start_live_video( ).

I also tried running camera_gui.py and it would not work. I got the following error.

"
image = QImage(arr.data, self.camera.width, self.camera.height, bpl, format)

TypeError: arguments did not match any overloaded call:
QImage(): too many arguments
QImage(QSize, QImage.Format): argument 1 has unexpected type 'memoryview'
QImage(int, int, QImage.Format): argument 1 has unexpected type 'memoryview'
QImage(str, int, int, QImage.Format): argument 1 has unexpected type 'memoryview'
QImage(sip.voidptr, int, int, QImage.Format): argument 1 has unexpected type 'memoryview'

"

Any advice is greatly appreciated!

Thanks!

[non-issue] InstrumentKit

Hello Instrumental devs,

I just wanted to take the time to bring a similar project to your attention, InstrumentKit, which I started several years ago with similar goals. While it looks like we had different priorities during initial development (for example, Instrumental relies on and integrates nicely with VISA, while InstrumentKit was designed to be connection agnostic without requiring VISA), there is considerable overlap between the two.

I hope that we can learn from each other so that we can continue to help the instrumentation community.

Cannot detect uc480 camera

Hello,

I am trying to use instrumental on another computer to control a uc480 camera but it doesn't find it. The camera works well with instrumental on two other computers, and is accessible via ThorCam on this computer but still I can't find it with python.

I've got the latest version of instrumental (0.5) and nicelib (0.6.dev0) that I've cloned from GitHub. I've also upgraded the packages pycparser and pywin32. I've tried placing the uc480_64.dll file in the Windows/System32 folder, as well as adding the Thorlabs folder with the dll to the python PATH. list_instruments() returns blank, from instrumental.drivers.cameras import uc480 gives no errors, but camera = instrument('uc480') returns "Exception: Instrument with alias 'uc480' not found in config file".

I suspect something is configured incorrectly but I haven't been able to figure out what. Do you have any suggestions?

Thank you,
Ana

[cameras.picam] Integrate and clean up driver

This driver needs to be integrated with the new parameter system introduced in version 0.4. More fundamentally, it needs to be modified to inherit from Camera and implement that interface.

Seems to have memory leak for continuous read/write

while true:
    daq = NIDAQ("Dev1")
    task = Task(daq.ao0,daq.ai1)
    task.set_timing(duration='10s', fsamp='100Hz')
    read_data = task.run(write_data)
    task.unreserve()

Here is working example of my code. The first 20 or so loops memory usage is not increasing, then it increases quite fast and kills program.

ValueError: Cannot find library '('uc480' , 'ueye_api')'

I'm getting an error when I try to import:
from instrumental.drivers.cameras import uc480
ValueError: Cannot find library '('uc480' , 'ueye_api')'
I added the correct folders to my PATH, but it's still not working. The camera works just fine with ThorCam.
Windows 64 bit. Can you please help?

[cameras.tsi] hw_edge trigger doesn't work from n_frames > 1

This one's kinda tricky. Software (auto) and bulb (PDX) triggering work fine, but HW edge triggering only works correctly for n_frames== 1. The manual for 8051/4070/340 Series cameras indicates that when FRAME_COUNT != 0, a single edge triggers multiple exposures. It also seems to indicate that for FRAME_COUNT == 1, you can trigger multiple exposures during a single capture sequence by generating multiple edges (as long as the edges don't overlap with the current exposure or readout). However, neither of these seems to work, as GetFrameCount never increments past 1 and GetPendingImage never returns more than the first image.

Ultimately, we want n_frames in the high-level API to specify the total number of frames in the capture, where each frame is individually triggered (similar to the second case above). We could also perhaps provide another trigger mode of our own that performs an entire capture sequence off of one trigger.

[tempcontrollers.covesion] Covesion driver release

The Covesion OC driver was recently merged into master. There are some things that ideally would get cleaned up before this hits a release version. A lot of is it little stylistic or formatting things.

  • Remove Py3-style type annotaion
  • Remove print statements. These could be converted into logging if that's appropriate.
  • Remove any dead code (the stuff that's commented out)
  • Clean up the imports:
    • Reorganize the imports into (future, stdlib, third party, package-relative) sections
    • Remove unused imports
    • Remove import *
  • Remove per-instance status_key, driver_str, etc. if that makes sense
  • Use Quantity.m_as() to get quantity magnitudes
  • PEP8/formatting fixes:
    • Add spaces in arglists
    • Fix indentation of OC_status_keys and _initialize()
  • Update old pyvisa commands: get_instrument() -> open_resource(), ask() -> query()
  • Use appropriate exception types

Some higher-level stuff:

  • Switch to using _check_visa() support instead of implementing list_instruments()
  • Remove all the explicit ResourceManager stuff, if possible
  • Make CovesionOC inherit from VisaMixin, if appropriate
  • Make communication robust, so we don't have to rely on repetition

Input on all of this is welcome, including any discussion of what's feasible, or inclusion of other stuff that should be addressed before this is considered "release-quality".

Changing Color Gain/White Balance

Hello, I have a Thorlabs camera and I am trying to change the gain on the individual color. I've was able to successfully change the gain with the following command, but can't figure out how to do it for an individual color. Any help would be appreciated!

A=cam.grab_image(exposure_time = "32ms",gain = 25)

Thanks!
-Berto

Error UC480: AttributeError: 'Sig' object has no attribute 'args'

Hello, I have been attempting to set up instrumental for UC308, but I have confronted this error message. I am unsure of what the problem is and I have tried to go through the files and search for a possible cause. Am I lacking a dependency or am I incorrectly using the class?

This error occurs whenever start_capture() is called. Thank you!

Saving instruments fails due to missing `conf.data_dir`

For some insane reason I changed the name of data_dir to user_data_dir here f48aef6 without checking if any code used it. Unfortunately, this breaks saving of instruments in release 0.2.1. Whoops.

Maybe when fixing this we should rename it as conf_dir anyway to distinguish it from the user-settable conf.prefs['data_directory'].

Add support for Thorlabs Compact-Scientific Cameras

The old "legacy" TSI SDK for Thorlabs scientific cameras had no C API (ABI, really), so we hackily wrapped its C++ interface. Now (as of ThorCam 3.1.0) there is a C API, so we should wrap that instead.

Currently, it is unclear whether both the "Scientific" and "Compact Scientific" cameras are supported by this new SDK. The READ_THIS.html document shown upon ThorCam install reads,

The Compact Scientific Camera family and the Scientific family (above) share the same USB driver and .NET interface. In the future, they will share the same SDK.

It's not quite clear whether this "future" has come to pass yet or not. Either way, it would be nice to wrap this with an eye to the future.

See #55 for previous discussion of this.

[cameras.pixelfly] Explicitly inform user about invalid settings

Currently, using e.g. an exposure time that's too long results in a pretty cryptic exception that comes directly from the SDK. We should catch this (or validate the input before using it) and say explicitly what setting is wrong.

This can be especially confusing b/c the valid exposure times depend on the shutter mode (single, double, video) and camera model.

Also, if single shutter mode is being used and the desired exposure is too long, we could let the user know that you can perform longer exposures in video mode.

tsi.h not getting installed

Currently, the handwritten header tsi.h is not getting installed properly. setup.py will need to be changed to fix this.

NIDAQ device memory underflows before max sample rate

Hi,
First, thank you for sharing your code. I have a question regarding the maximum output frequency I can get from my NiDAQ (6361). I am running your example to generate a sine wave:
data = sin( 2_pi * linspace(0, 1, 101) )_5_u.V + 5_u.V
daq.ao0.write(data, duration='1s', freq='100Hz')
The maximum output frequency that I can get is 7.5kHz from an analog output. Above it, I am getting an error in the DAQmxWaitUntilTaskDone function which means that there is not enough time for the DAC conversion. Although there is an internal 10Mhz clock in the device.

I was wondering if you have encountered this problem, and can give me a hint on how to fix it.

Thanks again!

Sasha

Loading DAQmx with no internal channels

I have a DAQmx board which doesn't have any output channels and the NIDAQ class was giving me an error in the _load_internal_channels function from ni.py as it would try to run a for loop over None object:
1454, in _load_internal_channels for ch_name in ch_names: TypeError: 'NoneType' object is not iterable

I found a simple fix to be adding a None check before the loop:

def _load_internal_channels(self):
        ch_names = _internal_channels.get(self.product_category)
        if ch_names is not None:
            for ch_name in ch_names:
                setattr(self, ch_name, AnalogIn(self, ch_name))

Imaging at higher frame rates with Thorlabs DCC1545M

Hi, I'm trying to use this package to image with the Thorlabs DCC1545M camera with at least 30 fps. In order to do that I need to subsample or select an area of interest (AOI) to reduce the resolution. Subsampling is the ideal solution to maintain the full field of view. Unfortunately, I don't see a way to subsample when looking through the code. I saw a method for binning, but that's not supported with this camera. When I tried setting an AOI, I still get the full resolution image returned to me. To test if I can set an AOI, I tried:

cam = instrument(list_instruments()[0])
cam.grab_image(top=0, bottom=400, left=0, right=400)

Perhaps that's not the correct way to do it? I'd appreciate any help you can offer!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.