cversek / python-fli Goto Github PK
View Code? Open in Web Editor NEWPython bindings for Finger Lakes Instrumentation (FLI) cameras and peripherals.
License: MIT License
Python bindings for Finger Lakes Instrumentation (FLI) cameras and peripherals.
License: MIT License
Note that the method name USBCamera.set_bit_depth
has changed to USBCamera.set_bitdepth
.
Originally, the method USBCamera.take_photo
returned a numpy array with dtype=numpy.uint16
regardless of previous bitdepth
setting in the USBCamera.set_bitdepth
method; now this has been fixed to return an
array of dtype=numpy.uint8
when using the "8bit"
setting. Furthermore, a bitdepth
attribute has now been added to USBCamera
objects to track this setting, the default value gets set to "8bit"
during object initialization.
I am attempting to compile the shared library on a Mac (I have successfully compiled on SL7 and it works great!). To do so, I added the framework flags below to the $(CC) line:
libfli.so: libfli.o $(ALLOBJ)
I am still running into an error of:
gcc -shared -o libfli.so libfli.o libfli-sys.o libfli-debug.o libfli-mem.o libfli-usb.o libfli-usb-sys.o libfli-serial.o libfli-camera.o libfli-camera-parport.o libfli-camera-usb.o libfli-filter-focuser.o -framework Foundation -framework IOKit
Undefined symbols for architecture x86_64:
"_linux_bulktransfer", referenced from:
_FLIUsbBulkIO in libfli.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libfli.so] Error 1
Any thoughts?
If you are getting an error message like
OSError: libfli.so: cannot open shared object file: No such file or directory
it is very likely that the FLI SDK hasn't been compiled and installed properly.
There are a few steps that one needs to prepare FLI's SDK so that python-FLI can provide access to the C library.
First, the SDK must be compiled as a shared object/dynamic library (.so file) rather than the default, which is a static object (.a file). I have just posted a replacement Makefile that can be dropped in the libfli-1.104 source package folder. Then one can run make clean
(if code was already compiled) then make install
(as root). That should build the library so that it can be handled by the Python ctypes module (python-FLI is just a slightly more convenient OO wrapper for this foreign function interface module) and copy it to /usr/local/lib
.
Now depending on the target Linux system /usr/local/lib
might not be on the dynamic libraries path. There are many ways to get this library found, but I have a few suggestions in order of least hacky first. On Ubuntu and similar, that path could be added to the end of file /etc/ld.so.conf
, which is updated next by running ldconfig
. If that doesn't seem to work, you could create a symbolic link like this:
sudo ln -s /usr/local/lib/libfli.so /usr/lib
If ctypes is still having trouble finding the library, you could always just drop it into the python package folder (probably somewhere like /usr/local/lib/python2.7/dist-packages/FLI-dev-py2.7.egg/FLI/
)
Hello,
first thank you for sharing your work with people wanting to use FLI devices with Python.
I have a problem with FLIList, for instance when I call:
fws = USBFilterWheel.find_devices()
as given in the test code in filter_wheel.py, I get the following error:
Traceback (most recent call last):
File "<pyshell#14>", line 1, in
fws = USBFilterWheel.find_devices()
File "XX\python-FLI\src\FLI\device.py", line 50, in find_devices
cls._libfli.FLIList(cls._domain, byref(tmplist)) #allocates memory
ValueError: Procedure called with not enough arguments (8 bytes missing) or wrong calling convention
I am working on Windows, but I don't think this changes anything concerning how the procedure is called.. Did anybody else have such a problem? Do you have any clue?
Thank you for your help!
++
I have this error with FLIList while testing lib.py:
>>>domain = flidomain_t(FLIDOMAIN_USB)
>>>names = POINTER(char_p)()
>>>libfli.FLIList(domain, byref(names))
File "C:/Users/.../pythonFLI/lib.py", line 335, in chk_err
raise FLIError(msg)
FLIError: Invalid argument
Therefore, I tried:
>>> names = POINTER(POINTER(char_p))()
>>> libfli.FLIList(domain, names)
WindowsError: exception: access violation writing 0x0000000000000000
Any hints?
We are planning to acquire a FLI USB camera, so we would like to know if you know if some part of the software (FLI Kernel module, FLI SDK or python-FLI) would have some problem with Linux Kernel 3.x or even 4.x. We plan to use Debian 8.x or Ubuntu 16.x.
Thanks!
JM
Possibly, the following fact might have caused an issue with some method calls: the original code
def set_temperature(self, T):
"set the camera's temperature target in degrees Celcius"
self._libfli.FLISetTemperature(self._dev, T)
did not explicitly convert the argument T
to a ctype
type.
This conversion has been forced in the version:
def set_temperature(self, T):
"set the camera's temperature target in degrees Celcius"
self._libfli.FLISetTemperature(self._dev, c_double(T))
A similar change was made for the num
argument of USBCamera.set_flushes
def set_flushes(self, num):
"set the number of flushes to the CCD before taking exposure"
self._libfli.FLISetNFlushes(self._dev, c_long(num))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.