Taking Cards


In an increasing digital world, with 4G on your iPhone (or Android), people are turning from paper to plastic and electronic. But is your business being held back by your payment acceptance! Continue reading

Unicenta & RaspberryPI

Raspberry Pi

If your using Unicenta but want multiple machines all sharing the same catalogue, and you want the information centrally you need a shared database server.
You can just install a database server (MySQL, Postgres etc) onto any machine, such as your back office machine, but if your like us we don’t have a central computer or the space for a full computer.
For a few months we just just a old small PC running Ubuntu, but this has now passed on. So we were looking for a newer, better solution.
Continue reading

Rebinning Data


So i’ve encountered a serious problem in some of my research. I want to convert an image from 2.5″/px to 4.3″/px and preserve the source fluxes.

I program in Python personally but I also work with people who use IDL, and I couldn’t find an algorithm/script that achieved this end in either.

  1. Routines such as IDL’s REBIN only work for discrete step changes e.g 1″/px-2″/px (factor of 2).
  2. CONGRID seeks to preserve the Surface Brightness, at the expense of Flux.

A possible solution here is to use IDL’s CONGRID (which has a Python implementation) and renormalise back to the total. The factor it will be decreased by is: \frac{old^2}{new^2}

In my case: \frac{4.3^2}{2.5^2} = 2.96


I have written a small Python function to rebin data, maybe you’ll find it useful.

def rebin(array, dimensions=None, scale=None):
	""" Return the array ``array`` to the new ``dimensions`` conserving flux the flux in the bins
	The sum of the array will remain the same

	>>> ar = numpy.array([
	>>> rebin(ar, (2,2))
		[1.5, 4.5]
		[4.5, 7.5]

		If the totals of the input and result array don't agree, raise an error because computation may have gone wrong

	if dimensions is not None:
		if isinstance(dimensions, float):
			dimensions = [int(dimensions)] * len(array.shape)
		elif isinstance(dimensions, int):
			dimensions = [dimensions] * len(array.shape)
		elif len(dimensions) != len(array.shape):
			raise RuntimeError('')
	elif scale is not None:
		if isinstance(scale, float) or isinstance(scale, int):
			dimensions = map(int, map(round, map(lambda x: x*scale, array.shape)))
		elif len(scale) != len(array.shape):
			raise RuntimeError('')
		raise RuntimeError('Incorrect parameters to rebin.\n\trebin(array, dimensions=(x,y))\n\trebin(array, scale=a')
	print dimensions
	print "Rebinning to Dimensions: %s, %s" % tuple(dimensions)
	import itertools
	dY, dX = map(divmod, map(float, array.shape), dimensions)

	result = numpy.zeros(dimensions)
	for j, i in itertools.product(*map(xrange, array.shape)):
	    (J, dj), (I, di) = divmod(j*dimensions[0], array.shape[0]), divmod(i*dimensions[1], array.shape[1])
	    (J1, dj1), (I1, di1) = divmod(j+1, array.shape[0]/float(dimensions[0])), divmod(i+1, array.shape[1]/float(dimensions[1]))
	    # Moving to new bin
	    # Is this a discrete bin?
	    if (I1-I == 0) | ((I1-I == 1) & (di1==0)):
	        dx = 1
	    if (J1-J == 0) | ((J1-J == 1) & (dj1==0)):
	    # Prevent it from allocating outide the array
	    result[J, I] += array[j,i]*dx*dy
	    result[J_, I] += array[j,i]*(1-dy)*dx
	    result[J, I_] += array[j,i]*dy*(1-dx)
	    result[J_, I_] += array[j,i]*(1-dx)*(1-dy)
	allowError = 0.1
	assert (array.sum() < result.sum() * (1+allowError)) & (array.sum() >result.sum() * (1-allowError))
	return result
© Martyn Bristow 2015, and licensed under GPL v3: Basically you can use this code at no cost but I provide no warranty for it.

Science Speed Dating


Speed Date a Scientist

Well that’s the event i`ll be talking at next week, in a special outreach session, to help encourage students to take up STEM subjects. So I’ll be answering what its like to do a PhD in Astrophysics, what it generally involves and how you can get here.

Northern Electrics


The Liverpool to Manchester railway reached an exciting milestone on Monday to 23rd February 2015 with the FIRST electric train to operate under the new wires.
At 1947 a test train from Network Rail traversed curve at Earlsestown and then running on to Liverpool. Following on from this test a surprise was in store at Liverpool Lime St as 5F01 ran from Allerton into Lime St and then took its first run out to Newton Le Willows, shortly followed by a sister unit making a number of runs along the route.
After what is believed to be a successful test the 319’s are proposed to be scheduled to begin working service to Manchester Airport (MIA) on Monday the 30th February.

Image Credit: Flickr User AlbertX209
Network Rail Test Train
319 Path

Converting with OpenOffice


Ever been stuck with some weird Open Document format (*.odt…), yet your a Microsoft Office kinda person, or if you quickly want to convert your document into PDF for whatever reason?

Well Open Office (or LibreOffice) has a nice little command line utility you can use on Linux and MacOSx to convert into PDF

soffice --headless --convert-to pdf
Where is the name of your document.

soffice convert-to pdf

Using the command line to create a PDF of an invoice on a remote server (via ssh)

In the above example I’m running on it via ssh, with no X11 forwarding. To avoid any X11 conflicts simply set the DISPLAY environment variable to “:0”
SH/BASH: export DISPLAY=:0

If your running via a remote connection with no x11 forwarding you may get this error if you haven't set your display to :0

If your running via a remote connection with no x11 forwarding you may get this error if you haven’t set your display to :0

The trick also works for other formats:

Making a DOCX file

Making a DOCX file

Garlands Night Club


Following a police raid last Thursday (12th February 2015), at Garlands night club on Eberle Street Liverpool, the nightclub has been given a 3 month ban as a licensed premise, following the illegal activity that had been on occurring. However the future is now very uncertain for the venue being closed for at least 3 months.

Garlands raided by 140 offices from Merseyside police following a lengthy investigation into activity at the venue after an investigation found class A drugs being dealt to students at the popular event.
The police have been granted a 3 months closure order, which can be appealed but the success of which is remote given the evidence and levity of the crimes. Reports state 90 bags of drugs were ceased at the premises and that the investigation had been ongoing for some time.

The swoop followed months of investigations which police said revealed dealers brazenly selling illegal drugs to young students. @Liverpool Echo

Continue reading

The Greenhouse


So it has a somewhat ambiguous and odd name, but The Greenhouse is a sexual health clinic for men who like men, at the Royal Hospital Liverpool. Offering a much better experience than the standard “drop in clinic”.

It was an oddly warm Thursday evening as I entered the hospital just before 6 and went up to the usual clinic to check in. I’d phoned up that morning to make an appointment and was kindly told that 6pm was available, not bad for a last minute quick checkup. I checked in and was sent to a private waiting area before the doctor came for me after 10 minutes, hastily apologising for running late. He them swiftly whisked me off to his consulting room where I was given a full sexual health check and out within 15 minutes! This made a dramatic contrast to my usual experience of waiting for 2-3 hours to see just the nurse, who would start off by making me try and relive every failed relationship and casual encounter.

The service provides what it states:

  • Free
  • Confidential
  • Respectful
  • Non-judgemental

The clinic can offer: Full sexual health check including chlamydia, gonorrhoea, HIV & syphilis, as well as rapid HIV testing and PEP (Post Exposure prophylaxis) and support & advice, about practising a good sex life.

And for the nosey ones out there my tests came back clear.

The Greenhouse – Gay & Bisexual Men’s Sexual Health
Phone: 0151 706 2623
Thursday Evenings 3-6pm

IDL in Sublime Text


SublimeText is test BEST palin text editor I have used, if you program and haven’t tried it you should. It has syntax highlighting and prediction which makes code writing effortless. However it doesn’t natively support IDL (Interactive Data Language), which I am not a fan of.

However this will tell you how to add IDL santa highlighting to your Sublime Text.

  • Download the TextMate package for IDL (from here)
  • Then Add bundle object into Sublime Texts Packages Folder
Open the Browse Packages Folder (Example on OS X)

Open the Browse Packages Folder (Example on OS X)

The packages folder, drop the IDL bundle into this folder.

The packages folder, drop the IDL bundle into this folder.

Get Sublime Text