Translating warnings and optimset from MATLAB to similar operations in Python
Show older comments
I am trying to translate some code from MATLAB to Python. Right now I am having trouble understanding the syntax of MATLAB (and in general reading this section of the code) and converting it to Python.
The following is the code:
if (verbose == 0) | (verbose == 1)
warning('off','all');
options = optimset('Display', 'off','Diagnostics','off','MaxIter',2000,'TolFun',1e-10,'TolX',1e-10 );
else
warning('on','all');
options = optimset('Display', 'final','Diagnostics','on','MaxIter',2000,'TolFun',1e-10,'TolX',1e-10);
end
I know that I can import the warnings class into Python. However I am wondering if the class is similar to the one used in MATLAB? Also, as a clarifying question, I am reading the warnings in MATLAB as they have described it in their documentation (warning(state,mode) controls whether MATLAB displays the stack trace or additional information about the warning). Is there an equivalent to that in Python?
As an edit, I also realized that optimset is also a MATLAB specific function and it changes the state of a lot of parameters. Are there any tips or other help as to how to do the same in Python?
Thank you all!
Answers (0)
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!