Convert animated GIF to PNG stack using ImageMagick by:
magick in.gif out_%04.png
where 04 is governed by the number of images in the GIF–04 accommodates up to 10000 images.
GIFs are not a great format for science image data, because the palette is compressed to 8-bit (256 colors).
For plotting reduced data, GIFs can be fine.
Spyder IDE is a complex but usually stable Python program.
A problem symptom is Spyder not getting past the splash logo or not even showing the splash logo.
To totally reset Spyder (erasing all user preferences for Spyder), type in Terminal / Command Prompt:
spyder --reset
Normally, that fixes Spyder.
To diagnose further, start Spyder from Terminal instead of OS Start menu, it might give some hints.
Access GPU CUDA, cuDNN and NCCL functionality are accessed in a Numpy-like way from
CuPy.
CuPy also allows use of the GPU in a more
low-level
fashion as well.
Before starting GPU work in any programming language realize these general caveats:
I/O heavy workloads may make realizing GPU benefits more difficult
Consumer GPUs (GeForce) can be > 10x slower than workstation class (Tesla, Quadro)
CUDA requires a discrete Nvidia GPU.
Check for existence of an Nvidia GPU by:
Linux: a blank response means an Nvidia GPU is not detected.
lspci | grep -i nvidia
Windows: Look under the “render” tab to see if an Nvidia GPU exists.
cupy.cuda.runtime.CUDARuntimeError: cudaErrorInsufficientDriver: CUDA driver version is insufficient for CUDA runtime version
This means the CUDA Toolkit version is expecting a newer Nvidia driver.
The Nvidia driver can be updated via your standard Nvidia update program that was installed from the factory.
“Table 1” of the CUDA Toolkit release notes gives the
CUDA Toolkit required Driver Versions.
A code cell in popular Python IDEs including
PyCharm
and
Spyder
is created by line starting with # %%.
This “code cell” is analogous to IPython code cells and
Matlab code sections.
You will see like
importmath# %% user datax = 3y = 4# %% main loopfor i inrange(5):
x += y
The code cells allow running sections of code in an IDE without the need to constantly set/unset breakpoints in the IDE.
They also catch the eye of developers to delineate logical blocks of code in the algorithm.
We encourage the use of code cell syntax, even if you don’t use them in the IDE directly, as the IDE will highlight sections of code to visibly delineate these separate parts of the algorithm.
GitLab Community Edition is
open source.
Anyone may host their own self-managed GitLab instance if desired instead of gitlab.com.
Git SSH.
For this example, we use Kitware’s CMake GitLab instance.
First, create an account on the self-managed GitLab instance and fork the desired repo.
This will be available like
xarray.open_dataset
can open HDF5 files.
However, unexpected HDF5 file layouts can cause Python to quietly crash without error message.
This is true even with the minimum required versions of xarray, h5py and h5netcdf installed.
We don’t have a specific workaround for this other than to use
h5py
to build up an xarray Dataset variable-by-variable.
One should almost always use a Python
context manager
when working with file I/O in Python.
Context managers for Python I/O resources help avoid exceeding system
resource limits.
For long running jobs, context managers help avoid random crashes due to excess file I/O resource utilization from files left hanging open.
There are edge cases where you do need to keep the handle open without context manager–for example, inside a for loop.
In many cases, it may be better and easier to let the file open and close with the context manager.
It is also possible to create your own content managers with Python
contextlib,
which we use in
georinex
for example.
The Free TightVNC server works with Ubuntu and other modern Linux distros.
In general the default 3-D Ubuntu desktop is not available over VNC, so we use a traditional 2-D desktop environment over VNC.
Install Linux VNC Server:
apt install tightvncserver openbox
Choose desktop environment on server PC: XFCE4, Openbox or other you prefer.
Pick ONE of the following:
Openbox is the lightest-weight desktop environment–right click to open a menu.
Otherwise, you just have a plain gray background, extremely minimal–good for embedded systems and old PCs.
Openbox-Message: Unable to find a valid menu file “/var/lib/openbox/debian-menu.xml”
When experiencing this error, I’m also unable to open a terminal.
You can leave your VNC desktop running – it is not the same as your local desktop.
It is a little tricky to share your local desktop reliably. X11VNC can be more trouble than it is worth.
It’s MUCH easier to startup a new separate desktop session with vncserver or x11vnc
After installing a new desktop environment, at your next local login, you’ll need to rechoose the traditional Ubuntu desktop (it will then remember this choice).