Questions regarding Mworks

Suleman Zaidi's Avatar

Suleman Zaidi

06 Jul, 2021 02:33 PM

​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

  1. Support Staff 1 Posted by Christopher Sta... on 06 Jul, 2021 02:47 PM

    Christopher Stawarz's Avatar

    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

  2. 2 Posted by Suleman Zaidi on 06 Jul, 2021 03:01 PM

    Suleman Zaidi's Avatar

    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

  3. Support Staff 3 Posted by Christopher Sta... on 06 Jul, 2021 03:46 PM

    Christopher Stawarz's Avatar

    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

  4. Christopher Stawarz closed this discussion on 13 Jul, 2021 03:14 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac