Configuring KNIME to work with Python 2.7.x on Windows

UPDATE: These days it is recommended to use Python3 instead of Python2 Apparently it is tricky to get Python integration working in the KNIME Analytics Platform. If you read the official guide too quickly you can miss some critical information at the bottom of the page. I was getting an error complaining that the google.protobuf library was missing even though I thought that I had everything installed correctly: Library google.protobuf is missing, required minimum version is 2....

August 23, 2017 · Simon

Successfully clearing ports in Salome (Code ASTER)

Figure: Building a geometry in the Salome graphical user interface (GUI). How Salome tracks ports When Salome is starting up, it checks for free ports on your system using a few built-in Python scripts. Then when you close Salome those ports should be freed up again for the next one. This has a number of uses, but one reason is to stop multiple instances of Salome trying to use the same port at once....

June 1, 2017 · Simon

New Paper: Role of twin and anti-phase defects in MnAl permanent magnets

Our latest paper has just been published in the journal Acta Materialia. In it, we compare finite element micromagnetics simulations to experimental evidence in order to investigate the role of twin and anti-phase defects in the reduction of performance in MnAl permanent magnets. Figure: Room temperature (BH) max as a function of approximate raw material costs for the theoretical MnAl permanent magnet and experimental values for a selection of common commercial permanent magnets....

April 13, 2017 · Simon

Parallelization in Python example with joblib

It can be ridiculously easy to parallelize code in Python. Check out the following simple example: import time from joblib import Parallel, delayed # A function that can be called to do work: def work(arg): print "Function receives the arguments as a list:", arg # Split the list to individual variables: i, j = arg # All this work function does is wait 1 second... time.sleep(1) # ... and prints a string containing the inputs: print "%s_%s" % (i, j) return "%s_%s" % (i, j) # List of arguments to pass to work(): arg_instances = [(1, 1), (1, 2), (1, 3), (1, 4)] # Anything returned by work() can be stored: results = Parallel(n_jobs=4, verbose=1, backend="threading")(map(delayed(work), arg_instances)) print results Output:...

April 3, 2017 · Simon

The Fall of a Superhero

NOTE: Due to a system migration the mathematical equations within the following article are not currently functioning. I will endeavour to repair this as soon as possible Recently I have been reading through a newer edition of Young & Freedman’s University Physics, the main course textbook when I was a physics undergrad. Chapter 2 contains the following basic problem concerning 1-dimensional motion with constant acceleration. Since the book does not contain an answer or solution I decided to post a solution here....

February 25, 2017 · Simon

How to get up-to-date Python packages without bothering your cluster admin

If you have ever been stuck as a user on an out-of-date cluster without root access it can be frustrating to ask the admin guy to install packages for you. Even if they respond, by the time they get round to it you might have moved onto something else. The moment could be gone. Luckily, as far as Python is concerned, the pyenv project allows users to install their own local Python version or even assign different versions to different directories/projects....

September 1, 2016 · Simon

Plotting multivariate data with Matplotlib/Pylab: Edgar Anderson’s Iris flower data set

The problem of how to visualize multivariate data sets is something I often face in my work. When using numerical optimization we might have a single objective function and multiple design variables that can be represented by columnar data in the form {x1, x2, x3, … xn, y} a.k.a. NXY. With design spaces of more than a few dimensions it is difficult to visualize them in order to estimate the relationship between each independent variable and the objective, or perform a sensitivity study....

August 31, 2016 · Simon

The new default colormap for matplotlib is called “viridis” and it’s great!

It’s probably not news to anyone in data visualization that the most-used “jet” colormap (sic) (sometimes referred to as “rainbow”) is a bad choice for many reasons. Doesn’t work when printed black & white Doesn’t work well for colourblind people Not linear in colour space, so it’s hard to estimate numerical values from the resulting image The Matlab team recently developed a new colormap called “parula” but amazingly because Matlab is commercially-licensed software no-one else is allowed to use it!...

April 6, 2016 · Simon

[PDF] “Grain-size dependent demagnetizing factors in permanent magnets” reprint update

New paper The reprint of our Journal of Applied Physics (JAP) paper “Grain-size dependent demagnetizing factors in permanent magnets” has been updated since the old version was not being discovered by the Google Scholar crawler. There is also now a version on arXiv. I hope that Google Scholar will now correctly index the paper so that it’s easier for people to find! Citation The full, correct reference for the paper is:...

March 20, 2016 · Simon

Equations in Gmail with the “TeX for Gmail” Chrome extension

Science via email One thing scientists and engineers have to do daily is discuss collaborative work via email exchanges. This often includes the need to share and discuss mathematical equations and to represent variables with subscripts and superscripts or special characters; something that is tricky when you are emailing in plain text. Source: WikiImages/Pixabay Of course it is possible to work around this problem! Email was invented by scientists, and for decades they have been communicating in this manner, using various conventions to convey the correct information using plaintext....

November 25, 2015 · Simon

HP Spectre x360 keyboard turning off; problem solved!

I recently bought a new notebook; the HP Spectre x360, a 13” convertible ultra-slim notebook PC. It is a really nice piece of hardware, chiselled from solid aluminium with great battery life, decent performance and a pretty usable keyboard. When the laptop is folded back it automatically converts to tablet mode, wherein the keyboard is automatically turned off so that the keys are not accidentally pressed while using the touchscreen interface....

November 14, 2015 · Simon