Be sure you’re using SYSTEM Python, not Anaconda python or other user Python installs.
Remove pympress and pympress*distinfo directories from ~/anaconda3/lib/python3.6/site-packages/pympress* or wherever it might be under your ~ directory. Remove ~/anaconda/bin/pympress and then:
Conda 4.6 added official support for Python in PowerShell.
They also improved support in general for a variety of shells, so it’s worth updating conda in any case.
Update to latest conda by from Command Prompt / Terminal:
conda update conda
setup the new shell support (PowerShell, Bash, Command Prompt, etc.) with
conda init --dry-run --verbose
if you’re OK with the changes, make them happen for real by:
reopen shell(s) to see new conda environment.
You may get an error upon opening PowerShell like:
Documents\WindowsPowerShell\profile.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
It’s useful to know if the Matlab or GNU Octave GUI is open for a number of use cases, including
pause for each group of a large set of plots–only if user is there to look at them, otherwise save to disk and close thereafter.
increase (or decrease) verbosity of print statements or if console output is logged, depending on if it batch mode or not.
We don’t use the Matlab ≥ R2019a batchStartupOptionUsed as it doesn’t detect the -nodesktop case often used for unattended batch processing.
Save this code to isinteractive.m for your project.
%!assert(islogical(isinteractive))function isinter = isinteractive()
%% tell if the program is being run interactively or not.% helpful to say pause after making groups of plots--only if user has GUI desktop open.% don't use batchStartupOptionUsed as it neglects the "-nodesktop" casepersistent inter;if isempty(inter)if isoctave inter = isguirunning;else% matlab, this test below doesn't work for Octave inter = usejava('desktop');endendisinter=inter; % has to be a separate line/variable for matlabend
Paths to executables for Python
on Windows and other operating systems are handled cleanly as follows.
A simple boilerplate method to handle these issues follows, typically put in __init__.py for your package or other suitable location
#!/usr/bin/env pythonfrom pathlib import Path
# directory of this Python .py file
R = path(__file__).resolve().parent
# wherever your executable is
EXE = R /'..'/'build'/'myprogram'if os.name =='nt':
EXE = EXE.with_suffix('.exe')
# cast EXE to str() in general with subprocess
cmd = [str(EXE), myparam1, myparam2]
is more than 5 times faster than
at scalar exponentiation, while
was in-between Python and Julia in performance.
The test was run on Python 3.5, 3.6 and 3.7 with similar results.
In all cases, the timing was the same for integer or float base or exponent.
Python testing done with:
The ** operator in Python also has the advantage of returning int if inputs are int and arithmetic result is integer.
18.8 ns ± 0.263 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
%timeit pow(10, -3)
490 ns ± 5.62 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
%timeit math.pow(10, -3)
572 ns ± 10.4 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
is known in general to be slower at scalar operations than Python-native operators and Python built-in
But of course Numpy is generally a lot faster and easier for N-dimensional array operations.
%timeit numpy.power(10, -3)
3.85 µs ± 440 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
Julia 1.1.0 was likewise benchmarked for reference on the same computer.
First we installed Julia
For certain use cases, it’s feasible to run a Bash script from within Windows.
The obvious ways to do this are via Cygwin and Windows Subsystem for Linux.
However, there is a third way to run Bash scripts from within Windows itself, not needing Cygwin or Windows Subsystem for Linux.
In this example, we rely on the Bash shell installed with Git on Windows.
The trick is to start the Bash script you want to run from Linux or Windows with the shebang (first line of Bash script file):
This tells the shell (Linux or Windows) to first try /bin/bash which is a Unix-like path, and then try the Git Bash shell on Windows.
If Python is on your Windows Path, you can even use Bash scripts that also invoke Python scripts.
This is very handy in general.
GNU Octave can install third-party packages in a friendly way, analogous to the Matlab App Store or how Linux repositories work.
Regardless of operating system, Octave can install these extension packages from the Octave command line.
Some packages require a compiler or libraries.
If you get an error on installing a package, look at the error to see if you need to install a system library.
Packages are installed at the Octave command prompt, and download automatically.
Prereqs are not automatically installed, but messages are given telling which package needs to be installed first.
signal is a perfect example of this, given below.
A very popular package is the signal package, which brings many functions found in Matlab’s DSP and Communications Toolbox.
We’ll see that signal needs other packages first; let’s walk through the Octave signal install.
All commands are from Octave command prompt.
Try using a command that requires signal
warning: the ‘diric’ function belongs to the signal package from Octave Forge which seems to not be installed in your system.
if I had already installed signal, but forgotten to load it since I started Octave, the error would have been:
warning: the ‘diric’ function belongs to the signal package from Octave Forge which you have installed but not loaded.