Hi Chris,
My name is Suleman. I am a new grad student at the DiCarlo lab.
I am planning to run some stimulation experiments. I was wondering if I can send strings on a specified TCP port through mworks directly.
Alternatively, can I use the run_python_file action to send messages through python? In that case, how would I pass the command line arguments to the script?
Thank you for your help.
Best,
Suleman
Hi Suleman,
I was wondering if I can send strings on a specified TCP port through mworks directly.
No, that isn’t possible at present.
Alternatively, can I use the run_python_file action to send messages through python?
Yes, you definitely can use Python to send messages via a TCP socket.
In that case, how would I pass the command line arguments to the script?
Your Python code will run inside the MWServer process. To get data from your MWorks experiment to your Python code, you need to assign it to one or more MWorks variables. Then, your Python code can use the getvar
function to read the variables’ values and act accordingly. For more info on the MWorks-specific functions available to your Python code, see the documentation for run_python_file.
If you need further assistance, please let me know!
Cheers,
Chris
Hi Chris,
Thanks for the response. For now, I was able to set up my experiment. All python scripts being in the same workspace/scope worked as a feature for me as I needed to open one connection and keep it alive till the end of the protocol.
I hope there is no plan to change it anytime soon.
Best,
Suleman
Hi Suleman,
For now, I was able to set up my experiment.
Great!
All python scripts being in the same workspace/scope worked as a feature for me as I needed to open one connection and keep it alive till the end of the protocol. I hope there is no plan to change it anytime soon.
It’s meant to work that way. I have no plans to change it.
Cheers,
Chris