Open Itaborala opened 2 years ago
Some great progress was made to make this feature possible. this commit instide this branch shows a simple example. I tested with Pd and in --headless
mode, just send an osc message like so: /Custom testfile testfunc. The module testfile.py
was imported and the function testfile.testfunc was called!
So, from OSC-Qasm
server's perspective I'd ask myself: if the qasm code still needs to be changed before sending it to the machines, then why don't you only send me the FINAL version of the qasm code instead?
From an OSC-Qasm
cIient perspective though, looking at some of the simpler ones we have right now, I can understand that some additional massaging could be useful.
👉 That is to say that I am not yet sure of the immediate application of this: could you share a concrete example?
Are you suggesting transforming qasm into other type of instructions for other backends? That would also imply changing the portion of the code that is responsible for actually sending the job so... it might be a little bit more involved. Is that the idea? And, thinking back to end user: do you want them to have python in order to be able to do that?
Fear points, indeed. I agree with both arguments. From OSC-Qasm
Server, there's no reason to manipulate the circuit. OSC-Qasm
Client, however, could benefit from better circuit optimization/error mitigation (which can actually be interesting future features). But that's not the application that I have in mind.
Here's my concrete application idea: I have a circuit that is being constantly updated for QSphere visualizations (QAC Toolkit), and sometimes, I 'bang' the circuit into OSC-Qasm for counts. However, we came across this very interesting repo called QPi for 3D Qsphere visuals using Raspi. It was implemented in python and the main function receives a QuantumCircuit() object and does the rest of the work. So, in this case it would be more than just having a 'stavevector_simulator' option. if I have a dedicated raspi machine to receive Qasm data with OSC and run the jobs, wouldn't it make sense for me to import the Qpi function inside OSC-Qasm as well? Or at least a way to 'forward' the circuit to other scripts?
This means I want to send Qasm through OSC for visualization, not for jobs.
As discussed today, via qasmoverlatitudes
, we'll make this the meta issue for allowing Plugins to be added to OSC-Qasm.
The idea of allowing Plugins to be added to OSC-Qasm
might as well mean that it'll be a new major version. But it would need a good documentation to instruct users on how to build their own plugins. And give some thought into how to articulate it with the GUI version. Another question to be asked is: should we ship OSC-Qasm
with some plugins already or make that an optional (additional repository) thing to download?
it might be good to start with a simple plugin example. Can you describe a couple toy examples like:
Here's an idea: OSC-Qasm is a bridge connecting max/pd/sc and python. Imagine I have a python script that takes a qasm circuit and does something different or more complex, maybe a pre or post-processing algorithm, circuit optimization, or an interesting statevector visualization/simulation - any separate python application that could use a qasm file.
Could we send the circuit to a new custom function through OSC-Qasm? If so, what is the best approach?
Some broad ideas to make this happen:
-callback
/Custom
callback.map("/Custom", custom)