Category: Technology

Programming, gadgets (reviews thereof) and computers

British Wars–presented in fancy Javascript timeline format

Working my way through various bits of scientific history it becomes clear that what is going on outside the lab can have a profound impact on the protagonists. For the early years of the Royal Society the English Civil War and the Restoration had a big impact on the Fellows; the general feeling was “never again” and there was a search for stability and order. Later, in the 18th century, the American War of Independence and the subsequent wars arising from the French Revolution had an impact on The Lunar Men, impacting as it did on trade and their own radical politics. Lavoisier was to find the French Revolution terminal. In the 20th century, scientists were to play a large role in the Second World War; in codebreaking, radar and in building the atomic bomb. This followed a lesser role in the First World War, developing chemical weapons.

As someone whose formal education in history ended at the age of fourteen I thought I should get a feel for the wars going on around the people closer to my interests; this also seemed to be a good opportunity to play with whizzy Javascript timeline technology courtesy of Simile. It turns out the tricky bit is getting Javascript to run inside WordPress, I cheated a little by simply installing the Simile timeline plugin which fixed things in a way I don’t pretend to understand.

The timeline below is derived from a page in wikipedia entitled British Wars, I wanted to go back to the beginning of the 17th century so I supplemented that list with the linked “List of wars involving England”; Great Britain did not exist prior to the Acts of Union in 1707. You can slide the timeline backwards and forth by dragging it with the mouse.

 

 

 

 

Javascript timeline broken on upgrade to WordPress 3.5, you can see it here now.

I’ve colour coded the wars geographically as follows civil war: blue, Africa: brown, European:green, Americas:red, India:olive, SE Asia:black, New Zealand:purple and Middle East:orange, I have done this slightly erratically. During the 19th century we appear to have engaged in an awful lot of colonial conflicts around the world.

Developing this timeline I have experienced some of the shortcomings of the timeline presentation, I started off with the Cast of Characters in Lisa Jardine’s “Ingenious Pursuits”, entering their birth and death dates, but quickly found I had a rather ugly pile of people whose lives centred around 1680 with outliers before and after that time. Once I started on “British Wars” a second drawback becomes apparent: what is important and what isn’t? In a sense I gave up this decision to the compilers of the Wikipedia page, blindly adding all they had put in. This means the Cod Wars appears alongside the First World War implying some sort of equivalence. They also rate “The Troubles” in Northern Ireland as a war which I struggle to admit.

As a second exercise I tried working out how “important” a war was through numbers of military casualties, for this exercise the full list of British Wars is a bit long so again I left the deciding what was important to someone else, in this case a BBC History timeline, this finds a more manageable 10 major wars over the last 400 years or so. In fact it turns out that the Crimean and Boer Wars had relatively few military causalities, so I have omitted them. Below you can see the number of causalities for each war, expressed as a fraction of the population at that time. The casualty figures come from a combination of Wikipedia and Necrometrics, the population figures from the Historical Atlas.

WarCasualties

This plot lumps together a whole sequence of conflicts from the first plot into “Napoleonic Wars”. I’ve always known that World War I was known as the war to end all wars, that the casualty figures were horrific, but hadn’t appreciated that the Napoleonic Wars were similar in scale compared to the size of the population. Similarly the English Civil War scores highly for casualties but even so is under-represented in this plot since I decided to use the military casualty figures rather than total deaths relating to the war i.e. including civilians and those who died of disease or famine.

This is a rather parochial view but it has got the sequence of wars Britain has undertaken into some sort of chronology for me.

Get Organised!

This is a post about how I record my research, I write it in the hope that others will reveal some of themselves and perhaps gain something from the writing. I write it because how exactly people work is something of a mystery.

This seems like something I’ve picked up slowly over many years rather than being taught it all in one big bang as an undergraduate. I suspect there may have been attempts to teach me this, but sometimes it takes getting it horribly wrong for you to learn stuff, like the importance of backing up your files.

Clearly scientific literature (including company internal reports) has always been important to my work. I wrote a little bit about scientific publication a while back (here). Generation 1 of my filing system was Windows 3.1’s Cardfile program which I used at the start of my PhD, for each paper I photocopied I typed the details onto an index card. I wrote a sequence number on the corner of each printed paper along with a couple of keywords which I also enter into whatever indexing system I’m using and filed it away in a filing cabinet, ordered by the sequence number. These days most papers are available as PDF and I file this in a directory with the sequence as the first part of the filename.

After Cardfile I moved on to Endnote, and currently I use Reference Manager which are more specialist pieces of software specifically designed for storing the details of publications and also formatting bibliographies in popular wordprocessing packages. Notes on the contents of a paper still get scribbled onto the paper copy in red ink…

These days Zotero and Mendeley both look like good free options for reference management. I haven’t switched to Zotero because it’s currently tied to the Firefox browser and I haven’t switched to Mendeley because I’m not absolutely certain what it is syncing to the Cloud and what other people can see of it there, exposing even the titles of internal company reports to outsiders is a Very Bad Thing. I also had some minor problems importing my legacy collection into Mendeley. Unlike previous iterations of such software Zotero and Mendeley both make reasonable attempts at extracting paper details from PDF files or webpages.

Stray bits of paper scribbled on at meetings I still haven’t really cracked, I try to write the date and a sequence number on any bit of paper I use, and some link to the project it relates too but this is unsatisfying. For many years I’ve considered scanning in bits of paper; our company photocopiers will e-mail scans of paper to you in PDF format and with harddisk space being so cheap now* it seems odd not to do this. All this means I still have a folder per project where bits of paper end up. And, truth be told, I still find it easier to comment on a bit of work by scribbling on a bit of paper.

I’ve started using OneNote a bit for odd note collecting, the OneNote metaphor is of a collection of notebooks, each notebook is divided into sections by tabs along the top of the page and each section is divided further into pages using tabs down the righthand side of the page. My main problem with OneNote is that it’s not possible to display your notes in date order, I seem to use it mainly for a jumping off point to other things.

My lab books have been the core of my research since I started my PhD., in my loft there’s a sequence of about 20 of them. Some of my colleagues have fantastically neat lab books with diagrams and graphs carefully sellotaped in and orderly paragraphs describing the experiments done, I never really got that well organised but I did a fair job of adding to an index at the front of each one.  I still use paper lab books today but at a reduced rate. I’ve switched to a system using Microsoft Word, for each month I have have a document which looks like the one below:

I can type things in, hyperlink to other documents and cut and paste graphs and pictures as well. I use the Document Map view and, by applying appropriate styling, I get quick links to each day with a view of the keywords for the day – in this instance, designing the Death Star in AutoCAD ;-) For each year I get 12 documents which I store in a folder for that year. The thing I haven’t got working in this system is nice keyword searching across multiple years.

I’ve worked on multiple projects throughout my career and I’ve come to the conclusion that trying to separate them for the purposes of lab books and references doesn’t work too well – you end up spending time working out which lab book / file you should be adding stuff to and with decent indexing it just isn’t necessary.

These days you can buy specialised electronic lab book software, it seems it is normally done at a large scale though rather than by individual which I can’t help thinking is not a good thing since we all have individual ways of working which will vary with both the work we do and our own personal ways of doing things.

Looking at my current electronic lab book it strikes me that WordPress could be used for the task. The thing that Word can’t do easily is to give me rapid links by category or date to any part of my labbook but it strikes me that WordPress does this pretty well if you put the appropriate widgets into the sidebar. I suspect any electronic lab book software is essentially a database with a front end, for WordPress the front-end is written in PHP. The benefit of WordPress is that it’s very widely used, with lots of plugins to provide new functionality and extending it is within the reach of most programmers.

Here endeth the world’s dullest blog post, comments on your own “ways of working” are most welcome!

*Except if you’re in a corporate environment, in which case the laws of every decreasing disk space cost seem to work differently.

Medical ultrasound imaging

Scan1Alert readers will remember that I am in the process of becoming a father, and that the occasion of this announcement was the "dating scan" (Codename Beetle). In the UK, at least, this is an ultrasound scan targeted to take place at about 12 weeks pregnancy with a view to getting a more precise estimate of birth date from the size of the fetus, measured from “crown” to “rump”. Alongside this a nuchal fold measurement may be made to help test for Down’s Syndrome, it turns out this requires a cooperative fetus willing to assume just the right posture, Beetle wasn’t!

From a scientific point of view this is all really interesting: you can see inside people! In this instance, my wife.

The inside of a human is largely squidgy but different parts have different squidginess, in particular there is a nice contrast between the muscular wall of the womb and the liquid contents and again between the liquid contents of the womb and the fetus. Ultrasound is reflected when there are interfaces between things of different squidginess. There’s a direct analogy between this squidginess and the “impedance” of electrical components in things like hifi equipment, and the transmission of sound waves and the transmission of radio waves.

The scan starts off with the operator squirting generous quantities of lubricant onto the wife’s belly (in a hospital environment this gives me flashbacks to the Unexpected Prostate Examination Incident). The lubricant is to give good “impedance matching” between the ultrasound scanner and the swollen belly of the wife, without it the sound bouncing off the skin surface would be all you heard.

To build up an ultrasound image we listen for echoes. The ultrasound probe lets out a squeak and waits for echoes, the time taken for the echo to arrive tells you how far away the thing that created the echo. This is really obvious in the earliest ultrasound devices which worked in what is know as “A-mode”: sending out a single beam of sound in one direction and recording the sound that came back as a function of time. Typical data* shown below.

A_scan

The echo marked A represents a structure closer to the surface than the echo marked B.

You can build up a proper image by scanning your beam of sound backwards and forwards to map out a fan, this is known as “B-mode” and is the type of imaging you will be most familiar  with, the image at the top of the page is an example. It shows a vertical fan-shaped slice into the body, with features at the bottom of the scan further from the surface than those at the top.

In the old days moving the beam backwards and forwards was a mechanical process but modern scanners do it electronically with no moving parts. This is done with a “phased array” similar to those used in radar systems; a line of transmitters is fed signals with different phases (the sinusoidal sound waves are offset in time by different amounts) the result of this is a sound beam that can be steered backwards and forwards without physically moving any parts.

Kamryn Thinking Cropped_mediumThese days you can even get “4D” scans done. These use a square (2D) array of emitters to scan rapidly over an area, getting the third dimensions from the echo time and a fourth (time) dimension by being able to repeat the process rapidly. These scans are converted to a moving 3D surface (or “baby”) by thresholding the 3D data set and using computer graphics techniques to produce nice graphics. I must admit I find these images a bit creepy (the one on the right is not Beetle). Given my experience of image analysis, extracting a neat surface from the noisy data, in real time, is pretty tricky.

   

Voluson 730 Pro BT03If I’d been paying attention I could probably have read the name of the particular ultrasound scanner used on my wife, but I had other things on my mind. As it was I could identify it because there’s an interesting looking coding on the sonograph (RAB-4-8L/0B) which turns out to be the serial number of a detector for the General Electric Voluson 730 devices. A quick bit of googling reveals a convincing looking image of the scanner, they cost something in the range £20k-£40k.

Ultrasound imaging utilises sound in the frequency range 2-18MHz although for the probe used for Mrs S’s scan the range is 4-8MHz wavelengths for such waves are 0.2-0.3mm which will be the maximum achievable spatial resolution. The lowest of these ultrasound frequencies is 100 times higher than the upper limit of human hearing at 20kHz, and 10 times higher than those used by bats and dolphins.

The velocity of sound waves in water is 1540m/s, for the purposes of this calculation humans are approximately water, the raster rate (speed at which the sound beam goes backwards and forwards) appears to have been 18Hz or once every 1/18th of a second). Given the speed of sound in Mrs S, we could actually image many metres into her – if required. This suggests that the speed sound is not a limiting factor in how fast we can do scans: the noise in the signal is the limiting factor. That’s to say the strength of the echoes we get back is rather weak and looking at the images they are mixed with a lot of noise.

Ultrasound machines are really rather high technology bits of kit, containing lots of interesting physics. I must admit having read up a bit – I want one to play with!

*”Typical data”, in scientific terms means “I’m going to claim this is typical but actually this is the best we collected”.

Book review: The Lunar Men by Jenny Uglow

LunarMenI read “The Lunar Men” by Jenny Uglow a few years ago, this was in a time before blogging so I’d forgotten the contents. I’ve recently reread it, my interest reawakened by my recent reading of the King-Hele biography of Erasmus Darwin. Darwin was a key member of the group of industrialists, inventors, doctors and experimenters based in the West Midlands which finally became the Lunar Society.

Uglow lists the principal Lunar men as John Whitehurst (1713-1788), Matthew Boulton (1728-1809), Josiah Wedgewood (1730-1795), Erasmus Darwin (1731-1802), Joseph Priestley (1733-1804), William Small (1734-1775), James Keir (1735-1820), James Watt (1736-1819), William Withering (1741-1799), Richard Lovell Edgeworth (1744-1817), Thomas Day (1748-1789), Samuel Galton (1753-1789).

It’s notable how many of the Lunar Men were Scots, in the mid-18th century England had two universities, Scotland had five.

It’s not until 1775 some 15 or so years after the core group had originally met that the Lunar Society is formalised. At the time arranging events to coincide with the full moon was not uncommon. Alongside the Royal Society there were numerous other local “Philosophical Societies” although I’m not clear of the details of these other groups it seems there was nothing exceptional about the Lunar Society in terms of the mix of people but they were rather exceptional people. They were proactive in seeking out new members, for example Withering was recruited on the death of William Small. As gradually the founding members died, the group dissolved in 1813.

Matthew Boulton, owner with John Fothergill of the Soho Manufactory, started as a maker of “toys” (which in this case means any number of small metal items) and non-ceramic ornaments but he collaborated with James Watt to make stream engines. He was later to set up the Soho Mint, which used patented pressing equipment to make high quality coins and medals in bulk.

James Watt made his first breakthrough in the design of steam engines in 1765 but it wasn’t until 1775 that they received a 25 year extension of the key patent and in 1776 they install their first engine in Cornwall. The revenue from these engines came in the form of a fee related to the cost savings on coal which the more efficient design of the Watt engine provided compared to the Newcomen atmospheric engines, introduced in the early 1700s. The protection and creation of patents was an important part of the Watt and Boulton business plan, they even supported Richard Arkwright, with whom they did not see eye to eye, in the protection of his patents for the cotton processing equipment at the heart of his factory. Patents are one route to deriving income from intellectual property, the newly formed Society of Arts offered another route: prizes, or premiums, for named topics which centred around manufacture.

On the face of it the presence of Josiah Wedgewood, a potter, in the group seems odd but reading the book it becomes obvious just how high-tech an industry the potteries were. Clay is not simply dug up from any old patch of ground and flung on a wheel – the correct raw materials must be selected and once this is done they must be processed properly before they can be formed into shapes. Even then it isn’t over: the process of applying glazes and firing the ceramics is far from straightforward. The ceramic industry was one of the high tech industries of its time, an 18th century Silicon Valley.

Boulton and Wedgewood were both in the business of mass producing desirable consumer goods and marketing them to the middle classes. They recruited excellent artists to produce designs, often based on classical themes and objects. Initially selling them to the very wealthy but with a view to mass production and the use of their aristocratic clients as promotional material. For Wedgwood the culmination of this was the creation of replicas of the Portland Vase.

Alongside the factories growing up in the Midlands came the canals with which the Lunar Men were heavily involved. The canals brought freight costs down from 10d per mile to 1.5d per mile. They started to replace the turnpike roads and river navigations, both enabled by acts of parliament which gave rights to maintain roads and rivers to corporation – along with the right to raise tolls. This previous incarnation of transport seems to have been initiated around 1650. By the mid-19th century a full-scale rail network was in place, replacing in turn the canals. The canals meant that raw materials could be moved around more cheaply, and that expensive (and delicate) manufactured goods could be shipped out.

The Lunar Men had a range of political views, although Uglow comments that scientific experimentation was more associated with Whigs than Tories. The manufacturers, Boulton and Wedgwood, were notably less radical most likely with an eye to maintaining the political support required to keep their businesses running, although Boulton in particular was pretty progressive in the treatment of his workforce. Many of the group were supportive of the French Revolution, American independence and the abolition of slavery. Priestley was a Dissenting preacher, and when the backlash against all manner of radical thought came his house was one of 30 or so properties singled out for attack during the 1791 Birmingham Riots, Withering’s house was also attacked.

The scientific context is quite different compared to today: public demonstrations of cutting edge science including electrical demonstrations were common and a group of educated gentlemen could make valuable contributions to science as amateurs doing the work in their spare time. Withering and Darwin fought over the discovery of digitalis as a well-defined medical material. Priestley was probably the most impactful “scientist” of the group being one of several who played a key role in the discovery of oxygen and it’s properties. Darwin was largely a “scientist” who suffered from having ideas before his time particularly with regard to evolution but also his ideas on meteorology were in advance of his time. Others in the group such as Watt and Keir were clearly entirely competent in scientific areas.

Strangely I found the King-Hele biography of Erasmus Darwin pretty much as informative on the Lunar men as this book and more readable – perhaps because it’s more difficult to write a compelling narrative around a, sometimes loose collective, compared to an individual. I am now intrigued about the evolution of factories in the 18th century and, more disturbingly, 18th century intellectual property rights.

Photovoltaic solar power – one year on

This time last year we had a photovoltaic solar power system installed, a few years after we had a thermal solar system installed. This post is an update on how we’ve got on with the photovoltaic solar system. This is facilitated by my weekly collection of electric, solar and gas meter readings – I suspect this data collection is a bit of a minority sport. A couple of months ago the company that the installed the system did offer me a fancy monitoring system… which cost about £1500!

As my earlier blog post highlights the calculated output for our system, given the latitude and orientation of our roof and the peak capacity of our system is 1393kwh per year. The first meter reading was on 28th August 2010, as of 25th August 2011 the reading is 1362.9kwh. So the measured output is 98.5% of the predicted output – not bad at all! Our import from the grid for the same period was 1896.2kwh compared with an annual consumption of 2397.5kwh in the previous year. So a 20% reduction in consumption and generation of 57% of our pre-installation level. The difference here is because our peak generation (mid-late morning) does not match our peak usage (early evening), since we can’t store any electricity the excess goes onto the grid. These figures are illustrated graphically below:

consumption

We receive the feed-in tariff and payments for exported electricity from our supplier, npower. This seems to be a small scale operation since to set this up you interact with named individuals who don’t change! So far we’ve received two cheques from them for £105.29 for the period 16/9/10-04/03/11 and £174.38 for the period 4/3/11-21/5/11. I should probably go prod them about whether they want another meter reading.

We can dig a little deeper into the data, below I show our monthly electricity consumption (red/green lines) from the grid for the last few years along with the last year of solar generation (the blue line).

monthlyconsumptionOur electricity consumption has been fairly constant through the year with a hint of an increase during the deep winter months due to the shortening days and an increased use of electric lighting. Since about March this year our electricity consumption has been significantly reduced compared to previous years, offset by our solar generation. This pattern wasn’t maintained in the September / October / November last year – I think because I was at home (using electricity) for an extended period following an operation.

The amount of solar generation varies smoothly through the winter months but seems to plateau during the summer. We did have a week of zero generation when the panels were covered in snow. I suspect in principle that the average power generation will vary sinusoidally through the year, since the variation in day length is sinusoidal, but that this can disturbed by “weather”, in particular the figure for May includes the very sunny Easter period without this boost the curve would have varied smoothly through the summer rather than plateauing.

In summary: we’ve generated almost exactly the amount of solar electricity we anticipated which amounts to nearly 60% of our annual consumption of electricity.