-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pycromanager.Core API parity #679
Comments
I believe this difference comes from the differences in the java and python SWIG wrappers of the cores. I don't know the historical reasons of why these two differ. It would be nice to have a common API between the two, but not breaking backwards compatibility is a big concern here, as well as the layer in which these fixes should occur. Certainly, this would be cleaner with new, lower-level APIs for the device layer. Maybe Mark has some insight here. |
I think that's just how SWIG works with templates. This line in MMCoreJ.i is performing the same task as the corresponding line in pymmcore ... which is to convert the C++ My point came more from the perspective of addressing your goal of being able to start in python, and then control either a python core or a java core, swapping back and forth seamlessly (for example, to be able to use pymmcore-widgets to control either a pure python-stack engine, or to then switch and control a Java-side engine). To achieve that goal, i think the single most valuable object would be a
that would be easy enough with an additional flag to your
I feel like it's teed up and ready to go already no? Just need to add a bit more logic to your bridge object to properly convert a few additional types? |
Yes, I think that is a good idea
Yes, true. the camel case conversion is already a step in this direction. I've just partially done some of this (but partially in the reverse direction of matching pymmcore to mmcorej) in https://github.com/henrypinkard/pycro-manager/blob/43ccdfe50b6966f4004bee8266b7d9386880c83b/pycromanager/headless.py#L27
One complication. I would like to eventually split the Java-python bridge into its own repo, because i think it would be useful for other projects and is very much a separate module from what is on top of it. And the bridge and the other stuff are nearly if not entirely independent in the code base. So this should probably be done in such a way to avoid hard coding things about mmcoreJ in the bridge
I think it just needs to be exposed as an argument via |
I'm focused on other projects in the near term and won't have the bandwidth to look into this, but I think this is a good idea, and if you want to take it on, pull requests welcome! |
FYI the Core functionality has been split out of pycro-manager to a new separate repo (https://github.com/micro-manager/mmpycorex) I don't have any plans to work on this in the forseeable future, but if you are interested, pull requests welcome! |
hey @henrypinkard, I was looking into what it would take for pymmcore-widgets to control a pycromanager Core instance instead of a pymmcore instance (for example, to have a Qt DeviceProperty browser that's controlling a headless java core). At the moment, a barrier for being able to share all of the python-side widgets to also control an MMCoreJ instance in another process is the fact that
pycromanager.Core
doesn't have API parity withpymmcore.CMMCore
. some of the types are mapped correctly (for example, with the Demo config, callingcore.getCameraDevice()
returns 'Camera' as expected), but most of the container types are still returningJavaObjectShadow
with a separate API (e.g.core.getLoadedDevices()
returns ammcorej_StrVector
that can't be iterated without using a special API).If a goal is to be able to use python to seamlessly transition between a pure python core backend and a java bridge backend using the same API, then I think a good place to start would be to ensure that the java bridge to MMCoreJ behaves like the swig wrapper does.
See the following script as an example test (could add a ton more methods here to assert that the bridge is behaving like
pymmcore
would). Note I usepymmcore_plus
just because it has an easy cross-platform way to install and access micromanager, but you can update the script however you like to change that. run withPYCRO=1
to test the pycromanager side, or without it to test the pymmcore side.there are some additional things that I would have to do in pymmcore-widgets (such as not using many of the convenience APIs we've built on top of pymmcore), but those are all doable if the underlying core objects behaved the same...
This general concept extends as well to anything we're doing in pymmcore-plus/widgets. If we standardize on the core object itself, then parity should come pretty easily
cc @nicost @marktsuchida
The text was updated successfully, but these errors were encountered: