Lazy Robot

Friday, 12 September 2014

Leeds Hyperbeastly

It's been five long months since I posted anything to this blog. Including this post here, I have posted no less than three times in 2014. As you can tell, I am nothing if not prolific.
I would not park here.
A lot has changed since the last time I posted anything. I sold all my SLR gear, for a start, and switched to micro four-thirds. I got a lovely, lovely little Olympus OM-D E-M10 and a small selection of lenses including the must-have Panasonic 20mm f/1.7 pancake and the stunning Olympus 45mm f/1.8. Marvellous, and the camera, four lenses and spare batteries and SD cards in a bag that wouldn't fit the SLR and a single lens. Cracking stuff, because it's now small enough to carry all the time. In fact the body and pancake lens is barely bigger than my Fuji X10 compact!
Flakey.
Anyway, the point of this post; I've taken several walks through Leeds while I've worked there over the past few years and I've been finding it more and more difficult to find non-boring subjects. Everything is so drab and bleak and uninviting.
Still works. Seldom used.
At the same time I've come to enjoy VSCOcam on my phone. The built-in RAW processing on my camera, the built-in wifi and VSCOcam on my phone mean I can do a full photographic workflow from RAW to Flickr without involving a computer. Of course once I get home Lightroom definitely gets a look-in because it is so much more capable, but for quick edits on the go doing it on my phone is great. One of the presets in VSCOcam is called "Hyperbeast" and I quite like it. A high-key, faded look with deep blacks and flattened highlights. I decided to recreate it in Lightroom.
Eye tea?
So here we go. I took some photos on my lunchtime walk today of things that, while maybe not pretty or interesting, sum up the bit of Leeds I walk through. I processed them with my mocked-up Hyperbeast-esque preset and gave them some spit and polish, and here they are. Leeds through my eyes.
Toxic sofa.
It might not be most complimentary photo set, but I think they are quite pleasing in their own way.

Anyway, there are a handful in the post but the whole set can be seen on the photos page under the Leeds Hyperbeastly album. Enjoy.


Wednesday, 9 April 2014

Another canal walk

The sun has started being a little more present lately, so some mornings are actually quite pleasant. On one such morning I decided to have a wander up the canal.


The clouds made everything look a bit Toy Story, and the low sun gave a lovely light and contrast to everything else.


Of course, it wasn't sunny everywhere. But even in the darker places, such as right underneath Leeds railway station, the sun had a go at peeking in.


Friday, 31 January 2014

Shooting the Enterprise

I was recently asked if I could help out providing an image for a magazine article about stress management. For reasons as yet undiscovered the requested image would be of the USS Enterprise flying through a storm in space. Unfortunately I didn't have a lot of time (just a couple of hours), but I did have a very nice model of the Enterprise D I could use to build the image around.

Thinking fast, I rigged up a rather slapdash rig consisting of a black reflector backdrop, an umbrella and stand from which dangled the model by a thread, and a couple of strobes. One light above, diffused, to provide the key light, and another, reflected and lower power, to fill some of the very dark shadows. It ended up all looking something like this:


Using a fast shutter, f/16 and cunning flash positioning I managed to keep the background black and give the model suitably textured lighting so it didn't have that flat, uniform, shadowless appearance of, well, a model. The narrow aperture obviously helped with the depth of field, although it was still only around 1" so I had to be careful with the focal plane. A tilt lens would be lovely in situations like this.


To get the desired effect of Star Trekky space type things, I had to do some post-processing. A starfield background from NASA first, followed by a zoom-blurred mass of swirling colour to give that classic Trek feel. They sure did love that swirly mass of colour. One or two minor lighting alterations to give a little more colour and texture to the model, as well as glowing nacelle and dish lights, completes the look except, of course, for the lightning.

The lightning is randomly generated by applying a difference filter between a gradient and random cloud-like noise, then crunching the levels so only the brightest whites are visible. It means you only have limited control over the output (direction and waviness is roughly controlled by gradient width and direction) but it's quick and easy so you can make a whole load and pick your favourites.

Layering the swirling mass of electrical charge over the ship and liberal application of masks to make it go under, over and around the hull finish it off nicely. I toyed with colouring the lightning, but decided the swirling mass of colour was enough.


So there it is. Not bad for a couple of hours frantic snapping and Gimping. Given more time I'd have liked to try some more dynamic angles, render it in higher quality, and other such enhancements. Maybe I will, later. Or maybe I'll do something completely different.

Friday, 20 December 2013

Top 10 of 2013

One of the things a fan of music must do is put themselves through the annual trial of trying to figure out which of the albums they bought/borrowed/stole this year are the best. It took me until about March last year. This year I have been a little more proactive and have produced a list already.

I bought 55 albums this year. I also acquired a further 58 through freebies, promos, borrowings and artists giving me stuff. That's a lot of stuff to choose from. I was considering limiting my self only to stuff released this year, but decided that some things were too good to leave off despite them being discovered by me this year, although released some time in the past. This didn't end up making the job any easier.

Anyway, after much deliberating, thinking, changing of minds and giving up in disgust, I have produced a list of 10 albums split evenly across "metal" and "non-metal", as well as a handful of "honourable mentions." So, without further ado, and in no particular order, the top several albums of 2013!

Metal

Be'lakor - Of Breath And Bone (melodic death metal, 2012)

First up, Australia's Be'lakor with their third album, Of Breath And Bone. I reviewed this one on The Mix Eclectic and said how much I liked it. And I still do. It's one of those albums that's accessible on the surface (depending on your appetite for melodeath, I guess), but has plenty of depth for those who want to look for it.

Dark Tranquillity - Construct (melodic death metal, 2013)

Ah, Dark Tranquillity. Another album, another top 10 mention. This album has split opinion; it is doomier, gloomier, and less hooky than previous albums. But that doesn't take away from the excellent song-writing, musicianship and immersion. And it's a doomy death metal album you can actually sing along to without having to follow along with the lyrics booklet thanks to Mikael Stanne's typically excellent vocal delivery.

Parasite Inc. - Time Tears Down (melodic death metal, 2013)

More melodeath! This time from Germany. Unlike Construct, this album does have hooks. It is catchy, it is heavy, it is mind-pummelling and brain melting and it's brilliant. Melodeath has oft been called "samey" and "tired", but this is the third release in this list that proves otherwise. Thoroughly enjoyable.

Tribulation - Formulas Of Death (ostensibly death metal, 2013)

Ostensibly? Yes. Tribulation's new album sounds more to my ear like some kind of blackened jazz gone haywire. There is never a dull moment, even during the 13 minute closing track, thanks to some excellently positioned riffs, grooves and jazzy moods.

Mael Mordha - Damned When Dead (doom/folk metal, 2013)

A doomy folk metal record about Irish history of invasions and war. What more could a folk metal fan ask for? The liner notes include historical passages explaining the context and content of the songs, and the songs themselves are hard and heavy and educational all at the same time. Having seem them live at Warhorns festival I can conclude that they are a force to be reckoned with in the world of folk metal.

Non-metal

Ancient VVisdom - Deathlike (trippy rock, 2013)

I have no real idea what genre Ancient VVisdom (with two Vs) fall under. They're not really "metal", hence them appearing in this list, but they have metal-ish themes. The sound is almost post-shoegaze rock but with the reverb turned up to 111 and the ominousness slider at maximum. Anyway, it's really good even if they can't spell.

Sigur Rós - Kveikur (post rock, 2013)

Iceland's greatest musical export (sorry, Bjork) are back with a new album that harks back to earlier outings like Takk... and Ágætis byrjun in mood, darkness and crunchiness, rather than the rather lighter whimsy of recent albums. The opening track has an epic base boom that the juices flowing and the mood continues apace throughout the whole album, giving it a certain uncomfortable edge while engaging the listener and drawing them in.

Editors - Weight Of Your Love (alt rock, 2013)

Certainly the most "pop" record on my list, Editors take the new direction introduced with In This Light And On This Evening and run with it. The melancholy is piled on (sometimes too) thick but it has an enduring charm and strong enough music that it maintains interest. It's like doom metal sentiments for the indie rocker.

Steeleye Span - Wintersmith (folk rock, 2013)

If you like folk rock or Discworld, there's something for you on this album. If you like both, then it's a must-have. The music swings wildly from the whimsical to the energetic, the melancholy to the balladic. From the utterly silly The Wee Free Men to the heart wrenching Love Enough it's a whole lot of emotion all wrapped up in a package that is amusingly sinister.

Paul Leonard-Morgan - Dredd: Original Film Soundtrack (electronic post-industrial? 2012)

A soundtrack? On a top 10 list? Surely it must be utterly amazing to have got this far? Yes, it is. If you liked the film, or if you like the sort of ambient post-industrial noise of NIN and the like, you'll like this. It is even somewhat similar to Sigur Rós's album, also in this list, but with less Icelandic oddities and much crunchy Dreddness.


Honourable Mentions

It is traditional to mention a few albums that almost made the cut but had to be dropped because I'm not doing a top 100. Noumena is first up with Death Walks With Me; another melodeath album, this time incorporating female vocals and surprisingly coherent growling. Gormathon, another melodeath band discovered at BOA 2013, get a mention for their 2010 album Lens Of Guardian, a death metal album with almost pop-like structure and catchiness.

Next up is Entropia for their latest atmospheric black metal outing Vesper, with tracks named after famous philosophical and artisan types and a cameo from David Bowie in his role of Nikola Tesla in the film The Prestige on the track cunningly titled Tesla. Thy Light also have an atmospheric black metal album in No Morrow Shall Dawn, although this time incorporating other aspects such as ... spanish guitar? Sort of, yes. A very interesting and thorough relaxing experience.

Last up is Riverside with their album Shrine Of New Generation Slaves (or S.O.N.G.S. for short. Yes, I know ...) It took me a good while to get round to listening to this one, but when I finally did I was glad to have.

And that's it for 2013. If you disagree with my selections for the year, then ... good? I guess. It's good to hold your own opinions.


Tuesday, 12 November 2013

Feeling Puddled

A bit of a change of pace on the blog. I've not posted anything remotely nerdy for ages, so here is a post containing four very nerdy things: functional programming, Haskell, Scala and Twitter interview questions. The Twitter interview in question was not mine, but instead was one posted about by Michael Kozakov on his blog post "I Failed a Twitter Interview."

So, interview questions, eh? This Michael fella thinks he failed the interview by getting the question wrong, but you and I know that's not how it works. The interviewer is more interested in finding out how you go about solving problems than whether you get this particular problem right. After all, unless they have some nasty leaky roof scenario, I can't imagine there being a particular pressing need for Twitter to need their interview candidates to get this one spot on.

That all being said, I don't much care about the problem solving technique. I care about figuring it out and making a really expressive, concise version that looks like awesome code. Because I'm vain.

My first attempt, I will admit, sucked. It was an imperative, state-machine based algorithm that tried to calculate puddles by walking the landscape and figuring out if it was in, out, or around about a puddle. It was awful. It was messy, hard to grok, and about 1000 lines long. Terrible, terrible, terrible. I even fell into the "local maxima" trap described in the blog post, but didn't notice until it was too late.

But of course, a little niggly bit of me knew there must be a good, functional way to do it using a good, functional language. Seeing a pretty elegant faux-functional solution done with PHP's awful array manipulators made me even more determined that there must be a really nice way to do this.

The problem itself is simple; for a given landscape defined by integers, calculate what volume of water would stay in any puddles left due to run-off being impeded. I decided to solve it using Haskell (a safe, useless language) because that's what nerds do, and also using Scala because I happen to be messing about with it. Scala has the advantage of allowing both the imperative and functional versions to work side-by-side. Some may not see this as an advantage.

Consider the following landscape, as defined by an array of integers:

My random landscape. Stunning.

It should be fairly obvious where the puddle should end up. The problem is how to calculate it. From the imperative solution I knew that the trick lay in calculating cumulative maxima, both starting at the left and working right, and also starting at the right and working left. This would give me the "shape" of the puddle.


Haskell: maxl w = scanl1 max w

Scala: def maxl(w: List[Int]) = w.scanLeft(0)(max(_,_)).tail

Hmm ... it's already evident that Haskell is at least more brief than Scala, and that Scala's scanLeft function needs a tweak or two. However, the resulting list is the same for each:

Cumulative maxima, as seen from the left.

Good. This is the shape of the landscape, from the perspective of the left hand end. Not terribly useful on its own. We need its brother, maxr:


Haskell: maxr w = scanr1 max w

Scale: def maxr(w: List[Int]) = w.scanRight(0)(max(_,_)).init

Haskell's code looks very similar to the previous function. So does Scala's, but there are a couple of weird things about it. The use of "init" to strip the trailing 0 left over by the binary nature of the function, as opposed to the cleanliness of Haskell's unary scanr1 function. Still, the results are, again, the same:

Cumulative maxima, as seen from the right.

Stunning. It's evident that in each of the shapes the side we start at is shaped to the landscape, and the opposite side is largely flat. We can make use of this by fitting the shape to the landscape by calculating the intersect of the two shapes. Due to the nature of the shape (a list of positive integers) we can just use "min" to calculate the intersect. This gives us the maximum water levels for each column.

Haskell: levels w = zipWith min (maxl w) (maxr w)

Scala: def levels(w: List[Int]) = (maxl(w), maxr(w)).zipped map(min(_,_))

The code isn't terribly hard to understand, but Haskell's brevity is growing on me. But did it work? What shape do we see now?

An intersect of the left/right maxima showing the puddle.



Aha! The shape now conforms, mostly, to the shape of the ground. There is one clear exception, though. The puddle in the middle is still filled in. So what is the difference between the shape we see and the shape we want? The ground, of course. If we subtract the ground, we should be left with just the shape of the puddle.

Haskell: water w = zipWith (-) (intersect w) w

Scala: def water (w: List[Int]) = (levels(w), w).zipped map(_-_)

Again with the brevity, here, Haskell. Scala's weird anonymous function syntax crops up a few times, this time with the weird looking operator _-_. For the uninitiated, it means "subtract the 2nd anonymous argument from the 1st anonymous argument." So there.
Subtract the ground to just leave the puddle we wanted.

And that's it! We have the shape of our water. All we need to do is calculate the volume. Easy peasy.

Haskell: sum $ water [ 2, 4, 5, 4, 2, 3, 4, 6, 5, 2 ]

Scala: water(List(2, 4, 5, 4, 2, 3, 4, 6, 5, 2)).sum

Not much in it in terms of brevity, here. And the result of both, as you can probably guess, is 7.

The full listings of the two programs are here:

Haskell:

import System.Environment

main :: IO ()
main = print (sum $ water [2, 4, 5, 4, 2, 3, 4, 6, 5, 2])

maxl w = scanl1 max w
maxr w = scanr1 max w
levels w = zipWith min (maxl w) (maxr w)
water w = zipWith (-) (levels w) w

Scala:

import math._

object Water {

    def maxl(w: List[Int]) = w.scanLeft(0)(max(_,_)).tail
    def maxr(w: List[Int]) = w.scanRight(0)(max(_,_)).init
    def levels(w: List[Int]) = (maxl(w), maxr(w)).zipped map(min(_,_))
    def water(w: List[Int]) = (levels(w), w).zipped map(_-_)

    def main(args: Array[String]) {
        println(water(List(2, 4, 5, 4, 2, 3, 4, 6, 5, 2)).sum)
    }
}

Pretty similar, all in all. A nice, elegant solution that still looks elegant when written down. Arguably Scala's proliferation of types, dots and parentheses looks a bit messier. That all being said, the individual functions are so small in the Haskell version that it's possible to reduce the whole thing to a two-liner:

import System.Environment

main :: IO ()
main = print (sum $ water [2, 4, 5, 4, 2, 3, 4, 6, 5, 2])

water w = zipWith (-) (zipWith min (scanl1 max w) (scanr1 max w)) w

Pretty neat, eh?

Extra bonus content!

For a bit of a bonus, I wondered if it would be possible to not only calculate the volume of the puddle, but use the return value of the water function to actually render the landscape, including water, to the console. Here's a version in Scala that does just that:
 
import math._

object Water {

    def maxl(w: List[Int]) = w.scanLeft(0)(max(_,_)).tail
    def maxr(w: List[Int]) = w.scanRight(0)(max(_,_)).init
    def levels(w: List[Int]) = (maxl(w), maxr(w)).zipped map(min(_,_))
    def water(w: List[Int]) = (levels(w), w).zipped map(_-_)

    def line(g: Int, w: Int, m: Int) = ("#" * g) + ("~" * w) + (" " * (m-w-g))
    def render(g: List[Int], w: List[Int]) = {
        val graph = (g,w).zipped.map(line(_,_,g.max+1))
        graph.transpose.reverse.map(_.mkString(""))
    }

    def main(args: Array[String]) {
        val g = List(2, 4, 5, 4, 2, 3, 4, 6, 5, 2);
        val w = water(g)
        render(g, w) foreach println
        println("\nTotal volume of water: " + w.sum)
    }
}

And the output:

$ scala Water.scala

       #
  #~~~~##
 ###~~###
 ###~####
##########
##########

Total volume of water: 7

I'll leave working out what it does as an exercise for the reader, as well as a modification to allow it to accept a list of integers on the command line.

Thursday, 24 October 2013

Autumn!

It's Autumn! Autumn is awesome. Autumn is the season of dark mornings, dark evenings, dark ... daytimes. Dark, generally. And damp. And generally ick. I love it. It's my favourite season. Not least because taking pictures of the lovely golden autumn light is an absolute delight and being out in the cold, fresh air actually makes me feel alert and awake, unlike the muggy, heavy sluggishness that comes with a hot summer.

The best thing about everything being dark, and damp, and ick, is that mushrooms grow. I've had a long-standing love of photographing mushrooms and other fungi, and this year is no exception. The first of many is right here:

IMG_5231

Lovely. Here are a few more, just for good measure.

IMG_5234 IMG_5235
IMG_5238 IMG_5249

Tuesday, 27 August 2013

Bridge 27

Bank holiday Monday saw us walking around the Shropshire Union Canal. Well, a very small portion of it near the Grindley Brook Staircase Lock, anyway. One of the bridges on that stretch of the canal (bridge 27, if you hadn't guessed, which is actually more of a tunnel) has an unusual architecture in that the brickwork is built into a spiral along the length of the tunnel rather than a more traditional cylinder. The effect of the light hitting the bricks gives the whole thing a wormhole-like appearance, like a swirling vortex to another realm. All very Whovian.

Portal
Looking under the bridge
Bridge 27
The effect of the swirling brickwork inside