Discussion:
[Pyzo] Major problems transitioning from MATLAB to Pyzo
a***@gmail.com
2016-03-19 03:14:50 UTC
Permalink
Matlab users expect two fundamental bits:

1) The path of execution of a script is not set automatically. It took me a while to figure why the program could not see a script located within the same folder as my "main" script. This is especially odd, as when I "Run File as Script" the path is set.

2) users also expect functions defined in user-space modules to be re-loaded automatically upon change. I scratched my head for a while on this issue. I noticed something about IPython and the possibility of having (load_ext autoreload, autoreload).

Mathworks has been irresponsive for years about the needs of my community, I'd be happy to leave them
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Almar Klein
2016-03-21 21:03:38 UTC
Permalink
Thank you for your comments. I am working on changes of the Pyzo website. Maybe it could do with a special section for Matlab converts to explain the most important differences. Also look at matlab.pyzo.org (which redirects to a page on differences).

- Almar



From: ***@gmail.com
Sent: 19 March 2016 09:58
To: Pyzo
Subject: [Pyzo] Major problems transitioning from MATLAB to Pyzo

Matlab users expect two fundamental bits:

1) The path of execution of a script is not set automatically. It took me a while to figure why the program could not see a script located within the same folder as my "main" script. This is especially odd, as when I "Run File as Script" the path is set.

2) users also expect functions defined in user-space modules to be re-loaded automatically upon change. I scratched my head for a while on this issue. I noticed something about IPython and the possibility of having (load_ext autoreload, autoreload).

Mathworks has been irresponsive for years about the needs of my community, I'd be happy to leave them
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Tagliasacchi
2016-03-29 04:00:23 UTC
Permalink
Dear Almar,

I think the best solution is to make the transition from matlab to pyzo as
painless as possible.
For example, matplotlib already copied much of the MATLAB api, and that is
why it was quite successful!!

There are a few things in pyzo that are _very_ different from MATLAB:

For example:

- there is no “return” command when running a script (so that execution of
that script is halted and control goes back to the command line)
- there is no “change folder to path of script being executed” (this caused
a couple of head scratches the first time I started pyzo)
- there is no “path_tool”?
- there is no “clear” command equivalent for iPython
- there is no “dbstop if error” (I found something in iPython but doesn’t
work as advertised
)
- there is no way of querying the size of the screen
- there is no “movegui(‘east’), etc

- when creating a figure, it is created in the background (although this
happens also in matlab unless you “close all”)
- if you want to be successful you should really pick a UI backend and
_stick_ to it.
- a few others that do not come to mind


Cheers
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Almar Klein
2016-03-29 12:00:32 UTC
Permalink
Thanks for your comments. Please keep in mind that Python is not Matlab. Some things work differently. I agree that a smooth transition is desirable, but Python/Pyzo should not try to be exactly like Matlab. You would need to adjust your workflow a little :)
there is no “return” command when running a script (so that execution of that script is halted and control goes back to the command line)
How can your return from a script? You can only return from a function. In Matlab you have one file per function. In Python you can define multiple functions in a module. If you want to be able to return early, write your code as a function.

You may want to start using the “run file as a script”. It will change the folder path to the path of the script, it will give you a fresh interpreter (equivalent to clearing all variables). You can also ``del x, y`` to delete individual variables.
there is no “path_tool”?
What is a path tool? Pyzo does have a pretty handy file explorer.
there is no “dbstop if error” (I found something in iPython but doesn’t work as advertised
)
There is something better. After an error has occurred, you can enter debug mode using shell > post-mortem debug. For optimal usability, bind this to e.g. CTRL-P.
there is no way of querying the size of the screen
There is. But maybe not in Matplotlib? You can certainly do it in Qt, which is the preferred tool for creating (advanced) user interfaces. You can create some GUI stuff with Matplotlib, but its naturally limited.
there is no “movegui(‘east’), etc

Not sure what this should do. There is not (and should not be) a way to change the position of the IDE from within Python, because the interpreter runs in a subprocess of the IDE (which is why it can be restarted, and can have multiple instanced, etc.). If you mean to change the position of a GUI element, you can certainly do this with Qt. Not sure about MPL.
when creating a figure, it is created in the background (although this happens also in matlab unless you “close all”)
Yeah, this can be annoying. This is one of the few downsides of the fact that the interpreter runs in a separate process. Not much we can do about that as far as I know.

Regards,
Almar



From: Andrea Tagliasacchi
Sent: 29 March 2016 06:00
To: Almar Klein
Cc: Pyzo
Subject: Re: [Pyzo] Major problems transitioning from MATLAB to Pyzo

Dear Almar,

I think the best solution is to make the transition from matlab to pyzo as painless as possible.
For example, matplotlib already copied much of the MATLAB api, and that is why it was quite successful!!

There are a few things in pyzo that are _very_ different from MATLAB:

For example:

- there is no “return” command when running a script (so that execution of that script is halted and control goes back to the command line)
- there is no “change folder to path of script being executed” (this caused a couple of head scratches the first time I started pyzo)
- there is no “path_tool”?
- there is no “clear” command equivalent for iPython
- there is no “dbstop if error” (I found something in iPython but doesn’t work as advertised
)
- there is no way of querying the size of the screen
- there is no “movegui(‘east’), etc

- when creating a figure, it is created in the background (although this happens also in matlab unless you “close all”)
- if you want to be successful you should really pick a UI backend and _stick_ to it.
- a few others that do not come to mind


Cheers
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Almar Klein
2016-04-11 12:55:05 UTC
Permalink
Post by Almar Klein
How can your return from a script? You can only return from a function. In
Post by Almar Klein
Matlab you have one file per function. In Python you can define multiple
functions in a module. If you want to be able to return early, write your
code as a function.
Call it however you want. In latex for example this is called “\endinput”
IPython is not python, it’s an interactive console, so there is nothing
wrong in saying that a script should terminate mid-length. What I am saying
is that people using matlab will rely heavily on this feature when
prototyping, and that this feature is completely missing.
I think in this case you could just create a new cell divider (##) and run
a portion of the script by running the cell.


For example, as far as I can see I cannot put any IPython commands directly
Post by Almar Klein
in the script
 this could surely be possible?
The \endinput function could then be just an IPython command
The magic IPython commands are parsed before they are given to the
interpreter. Therefore this does not work when used in the editor itself.
Even if it were possible, I'd be against it, because it would not be Python
anymore, and could only run via an IPython interpreter.
Post by Almar Klein
This is used to tell the python interpreter where to look for what you
call “modules”. From what I can see now the only path I can specify is the
one under the “Edit shell configuration”.
Yes, The paths that Python will look for are the default paths, the ones in
PYTHONPATH (i.e. in the shell config), the directory of the script (if
running as script), and optionally the directory in the file browser (click
the star on a starred directory for the menu where you can activate it).

The reasons for which I don’t think you should ignore problems related to
Post by Almar Klein
MPL is that MATLAB provides everything: UI, math libraries and IDE. If pyzo
is to become a market leader it is your responsibility to make sure that
MATLAB users don’t get frustrated when moving to pyzo. The developer of MPL
cannot understand/see these issues, so it’s Pyzo-devs that need to lobby
the MPL-devs to get things done properly.
Note that I am developing Pyzo in my free time, which is scarce with two
small children. Although I try hard to make a great tool, because I believe
in Python and in open source, I don't think I have a responsibility to take
away all frustrations for Matlab users. Learning a new language and the
associated tools takes time, no matter how easy it will be made for you.

Regards,
Almar
Post by Almar Klein
Thanks for your comments. Please keep in mind that Python is not Matlab.
Post by Almar Klein
Some things work differently. I agree that a smooth transition is
desirable, but Python/*Pyzo should not try to be exactly like Matlab*.
You would need to adjust your workflow a little :)
I perfectly agree, Pyzo should steal from Matlab everything that works
well and forget the rest. I did adjust my workflow but it was quite a
substantial adjustment. The smallest the adjustment the more likely people
will transition from Matlab to Pyzo!!
I have been really annoyed by mathworks, my patience is now exhausted.
Post by Almar Klein
How can your return from a script? You can only return from a function.
In Matlab you have one file per function. In Python you can define multiple
functions in a module. If you want to be able to return early, write your
code as a function.
Call it however you want. In latex for example this is called “\endinput”
IPython is not python, it’s an interactive console, so there is nothing
wrong in saying that a script should terminate mid-length. What I am saying
is that people using matlab will rely heavily on this feature when
prototyping, and that this feature is completely missing.
For example, as far as I can see I cannot put any IPython commands
directly in the script
 this could surely be possible?
The \endinput function could then be just an IPython command
Post by Almar Klein
You may want to start using the “run file as a script”. It will change
the folder path to the path of the script, it will give you a fresh
interpreter (equivalent to clearing all variables). You can also ``del x,
y`` to delete individual variables.
Yes, I have noticed that. I found it very counter-intuitive that “run main
file” and “run file as a script” perform very different actions. For
example the first doesn’t update the execution folder, while the first
does!!! (I spent an hour trying to understand why my script couldn’t find a
function in the same folder, and as I was used to Matlab, where folders are
always changed to the path containing the executed script, this was
___very___ frustrating).
Post by Almar Klein
Post by Andrea Tagliasacchi
there is no “path_tool”?
What is a path tool? Pyzo does have a pretty handy file explorer.
This is used to tell the python interpreter where to look for what you
call “modules”. From what I can see now the only path I can specify is the
one under the “Edit shell configuration”.
Post by Almar Klein
Post by Andrea Tagliasacchi
there is no “dbstop if error” (I found something in iPython but doesn’t
work as advertised
)
There is something better. After an error has occurred, you can enter
debug mode using shell > post-mortem debug. For optimal usability, bind
this to e.g. CTRL-P.
Alright, I will take a look next time.
Post by Almar Klein
There is. But maybe not in Matplotlib? You can certainly do it in Qt,
which is the preferred tool for creating (advanced) user interfaces. You
can create some GUI stuff with Matplotlib, but its naturally limited.
Fair enough, it’s mostly a missing core feature of Matplotlib.
Post by Almar Klein
Post by Andrea Tagliasacchi
there is no “movegui(‘east’), etc

Not sure what this should do. There is not (and should not be) a way to
change the position of the IDE from within Python, because the interpreter
runs in a subprocess of the IDE (which is why it can be restarted, and can
have multiple instanced, etc.). If you mean to change the position of a GUI
element, you can certainly do this with Qt. Not sure about MPL.
This changes the position of a figure, so that you can re-execute a script
fresh and not have to bring figures in the front and re-position them
manually. Again, it should be a matplotlib add-on, but it’s very easy to
start a blame-game and having pyzo and mpl blaming each other for what is
broken/buggy/missing.
Post by Almar Klein
Post by Andrea Tagliasacchi
when creating a figure, it is created in the background (although this
happens also in matlab unless you “close all”)
Yeah, this can be annoying. This is one of the few downsides of the fact
that the interpreter runs in a separate process. Not much we can do about
that as far as I know.
I found a trick, but this is ugly and relies on Qt being the backend,
get_current_fig_manager().window.raise_()
The reasons for which I don’t think you should ignore problems related to
MPL is that MATLAB provides everything: UI, math libraries and IDE. If pyzo
is to become a market leader it is your responsibility to make sure that
MATLAB users don’t get frustrated when moving to pyzo. The developer of MPL
cannot understand/see these issues, so it’s Pyzo-devs that need to lobby
the MPL-devs to get things done properly.
Note all I am saying is in Pyzo’s best interest. I am currently evaluating
whether to adopt python/matlab or whether I should stick to MATLAB for my
Sep’16 class
 Anything I do in Pyzo should “just work”.
Wish you all the best
— ataiya
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
atagliasacchi via Pyzo
2018-02-24 00:00:58 UTC
Permalink
Seems you guys have fixed quite a lot! Great job :)
I have been using PyCharm but it feels a bit heavy, and I am going to give a try to PyCharm once more. I'll likely submit my feedback on the GitHub page though.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...