The HDF5 format can be used for almost anything, including image stacks.
To signal graphical interactive HDF5 viewers that a dataset is an image stack, add
HDF5 image metadata,
as in these Python and Matlab
examples.
HDFview
will show an optional video player for this dataset due to the image metadata added.
Google Shared Drive is for groups of people with Gmail addresses (corporate or personal).
Public folder or limited access link-sharing of folders and files in Shared Drives are possible as with personal Google Drive.
Moving files is done in
bundles of files, not by folder.
Google Drive for desktop works for Shared Drives like individual Google Drive for read/write access.
Google Shared Drives and personal Google Drive can be synced with
rclone,
which is especially handy for HPC and cloud computing.
If using Windows Subsystem for Linux, keep the files on the
native Windows filesystem.
Two of the most important aspects of a build system are generation speed and build/rebuild speed.
For non-trivial projects in any compiled language, build speed can be a significant pain point.
Build speed is the time it takes to first build project targets.
Rebuild speed is the time taken on subsequent builds of a target, where most build artifacts can be reused, but the dependencies and sources must be scanned for changes since last build.
Even for medium projects, the seconds lost rebuilding add up lost productivity for developers.
CMake and Meson are among the fastest generators, while SCons and Autotools are among the slowest.
CMake and Meson have full support for Ninja.
Ninja is generally significantly faster than GNU Make, particularly for the case where only a few out of very many files need to be rebuilt.
Meson is a Python program without external dependencies.
It’s easy to run the latest development snapshot or track Git changes as a result.
pip install meson ninja
Since Meson generates Ninja build files, we installed Ninja as well.
With Meson, the code build process goes like:
meson setup build
meson compile -C build
CMake has existed since the early 2000’s, and has broad usage.
Build a CMake project like:
HTML plotting is important for communicating key data to colleagues, the general public and policymakers.
HTML plots allow easy sharing of interactive data plots to any web browser.
There are numerous HTML plotting methods available from Python.
These methods are completely open source and work in any web browser.
The HTML file can be shared by several means:
Matplotlib
HTMLWriter
can plot animated sequences.
More powerful HTML plotting capability requires
mpld3.
Virtually any Matplotlib plot can be converted to HTML for display in any web browser.
mpld3 uses HTML and
D3.js
to animate the plots.
mpld3.show() converts any Matplotlib plot to HTML and opens the figure in the web browser.
mpld3.save_html(fig,'myfig.html') method saves figures to HTML files for archiving or uploading as an iframe to a website, etc.
D3.js enabled interactive elements are available from the
mpld3 API.
Note the template_type='simple' keyword for .save_html(), which can increase robustness across web browsers.
The open source
Plotly
library can plot completely offline, without Plotly servers.
Plotly can make offline Python plots that work in any web browser.
Plotly offline plots don’t need IPython/Jupyter, although you can certainly use them as well.
Offline plotting is important as it doesn’t rely on external proprietary services that could prevent future users from making plots.
The
Plotly API
is available for Python, R, Matlab, JavaScript, Scala and a growing number of other programming languages.
Plotly examples
show the simple syntax.
When using plain Python, be sure to use plotly.offline.plot() as plotly.offline.iplot (iplot) will silently fail to do anything!
MyPy
supports
PEP 585 and 604, bringing concise Python 3.10 type annotation syntax to earlier Python versions.
The new type annotation syntax works all supported Python versions, if each file using them has at the top:
from__future__import annotations
Separately,
Numpy 1.20
made the long-awaited Numpy type hinting a reality.
The
benefits
of Python static type checking and
examples
have been discussed at length and widely adopted and funded by major tech companies, especially Dropbox.
Python static type checking enhances code quality now and in the future by defining (constraining) variables and functions (methods).
Type enforcement can be done with assert.
Type hinting is more concise, flexible and readable than assert, with significantly less performance impact.
Type hinting is being continually enhanced in CPython, numerous IDEs and type annotation checkers.
With type hinting, the hint is right at the variable name (e.g. in the function declaration), while assert must occur in the code body.
MyPy is installed and upgraded by:
pip install -U mypy
MyPy static type checker considers the following to be interchangeable (valid) due to
duck typing:
assuming Python package files are under “src/”
Then issue command:
python -m mypy
Note this command checks the package and not the top-level scripts, which must be manually specified.
Configure pyproject.toml
to eliminate nuisance errors or otherwise configure mypy.
It takes a little practice to understand the messages.
Where multiple types are accepted, for example, str and pathlib.Path use typing.Union.
See the examples below.
Unison file synchronizer works like a mashup of Dropbox, rsync and Git, although internally working via its own means.
Unison attempts to remotely sync changes in files between a local and (typically) remote location.
We have used Unison to manage systems on isolated remote networks.
That is, where the remote network is isolated from directly accessing the Internet and so Dropbox etc. aren’t available.
Assuming one trusts Unison, this could be useful for cases where it is desirable to keep files out of the “cloud”.
Unison file synchronizer has executable
downloads
for popular operating systems.
Red Hat is a common Linux distro used for HPC and other high reliability computing environments.
Miniconda
Python works well on Red Hat and many other Linux distros as well as macOS and Windows.
Thanks to .whl binary wheel packaging, many packages such as Numpy can be quickly installed via pip without compilation whether using system Python or Miniconda.
Miniconda Python install does not require “sudo”.
Using
EPEL
or
IUS,
requires “sudo”.
One may also load Python 3 with
modules,
commonly used on HPC.