Fixing a USB Flash drive that has been “corrupted” by balenaEtcher.

Recently I used balenaEtcher to create a bootable Linux drive. It is a nice Windows program that simplifies the process of creating Linux disks and is recommended by some Linux distro vendors. After the program successfully writes a bootable Linux USB drive, the drive no longer appears correctly in Windows. That’s because a bootable USB contains certain drive partitions with filesystem types that are not visible to the Windows operating system. ...

May 16, 2019 · 2 min · Simon

Fetching, wrangling and visualising sunrise and sunset data using Python

Previously I showed how it was possible to obtain sunrise and sunset times for a whole year at any location on Earth, from a public source. This time I am going to explain how to fetch that data, clean it up and create graphical visualizations like the one below, all using Python. A Jupyter Notebook is available on GitHub. Such data might even be useful in, for example, simulation of solar power generation. ...

February 2, 2018 · 11 min · 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 · 7 min · 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 · 2 min · Simon

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

As is known by anyone in the field of data visualization, the “jet” colormap has some flaws: 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 since Matlab is commercially-licensed software, it’s use is restricted. The Matplotlib team have therefore developed their own version, based on the principles of colour theory (covered in my own BSc lecture courses on Visualization). The new Matplotlib default colormap is named “viridis” and it will become the new default colour map starting with Matplotlib v2.0. Users of older versions v1.5.1 can still choose viridis manually using cmap=plt.cm.viridis. ...

April 6, 2016 · 1 min · Simon

5 Tips for making finite element models with Salome

Salome is an open source software package used to create geometric models and finite element meshes for use in numerical simulations. It is also able to perform its own numerical simulations and has post-processing capabilities built in. Here are my 5 tips for anyone who is interested in using Salome for model and mesh creation. 1. Practice manually first This goes without saying. Although Salome has a powerful Python-based scripting capability, it is worth practicing with manual model generation. By that I mean, clicking with your mouse in the GUI. Manual practice lets you get familiar with the quirks of the Salome workflow, which has a different mentality to many other model generator programs. ...

August 15, 2015 · 3 min · Simon

Paper “Hard Magnet Coercivity” published in proceedings of REPM2014

This August Prof. Dominique Givord of Institut Néel CNRS presented our paper titled “Hard Magnet Coercivity” during the 23rd International Workshop on Rare earth and Future Permanent Magnets and Their Applications (REPM2014) in Annapolis, Maryland. The manuscript was included in the conference proceedings and we would now like to make the reprint available to the wider public: Please click here for the PDF file. Abstract: Based on a critical analysis of the experimental coercive properties, general considerations on the reversal mechanisms in RFeB magnets are recalled. By plotting together the experimental parameters obtained in various magnets, common features of the reversal processes are demonstrated. Modeling provides an almost quantitative description of coercivity in these materials and permits connecting the defect characteristic properties to reversal mechanisms. ...

December 12, 2014 · 1 min · Simon

Aligning qhost output on the commandline when hostnames are too damn long

qhost is a UNIX command line tool to print the status of nodes on a Grid Engine system. The output is normally quite readable and is sorted by columns to give information on the hostname (“HOSTNAME”), architecture (“ARCH”), no. of CPUs (“NCPU”), processor load (“LOAD”), total available memory (“MEMTOT”), current memory usage (“MEMUSE”), swap memory size (“SWAPTO”) and current swap usage (“SWAPUS”) of each node on the cluster. Unfortunately, when the hostnames are too long, instead of truncating them to keep the columns aligned the row gets shunted along, making the output messy and much harder to read quickly. ...

September 24, 2014 · 2 min · Simon

Paper “Micromagnetics of shape anisotropy based permanent magnets” accepted for Journal of Magnetism and Magnetic Materials (JMMM)

Our new paper titled “Micromagnetics of shape anisotropy based permanent magnets” has been accepted for publication in Journal of Magnetism and Magnetic Materials (JMMM). Short description Visualizations of the computed magnetization data during reversal of soft prolate spheroids for aspect ratios (a) 1.95 and (b) 15.6, showing the different reversal modes. ...

March 26, 2014 · 2 min · Simon