Tuesday 19 July 2016

OOP and ABMs in Arizona


The PhD continues! It's been a while since my last update, but in the meantime, I've been busy; making small mammals run around things, extracting data from a ton of video footage, running preliminary statistical analyses, and all the other things that make up the life of an ecological PhD student.

Saguaros in the desert at sunset. Tempe, AZ.

I was also lucky enough to get sent back up to Arizona State! For two months this autumn, I got to build models with and learn an insane amount from Prof. Ted Pavlic from the School of Computing, Informatics, and Decision Systems Engineering at ASU's Tempe campus.

This was the first time I'd been over there in the American spring, and all the cacti were flowering.

In a previous post, I wrote about my first trip to ASU and why I'm excited about mathematical modelling. This enthusiasm has been completely cemented by my recent experience, where (with some help!) I was able to apply a modelling approach to some of the questions my PhD is aiming to address.

An Arizona bark scorpion (Centruroides sculpturatus) I found in the yard at Robbie's house.

Specifically, I got to work with Ted, Robbie and Dr. Ofir Levy on two models that examine how animals balance the performance trade-off between speed and agility. I won't give too much away, but both are based around the idea that using the fastest possible running speed will not always give an animal its best chance of escaping a predator (or capturing prey). This is because it becomes much harder to change direction at faster speeds and not go tumbling head over heels – meaning animals are often less agile at higher speeds.

An Arizona desert hairy scorpion (Hadrurus arizonensis). I was pretty stoked to see this handsome fella in the desert at night while I tagged along on an ant-scouting expedition with Jessie Ebie from the Liebig lab.

Now, anybody who has watched enough David Attenborough docos will know that animals rarely run in a straight line during a predator pursuit situation (here is a non-cheetah related example, just to mix things up). We think this is often because the predator can run faster than the prey, so the prey will attempt to out-manouvre the predator rather than outrun it. But how should animals decide how fast to run, or how sharply to turn? That's what our models are trying to figure out.

He looked even cooler under the black light!

In the process of building our models, I learned about object-oriented programming (OOP) and how to implement it in python (and the super cool jupyter interface), and how to build an agent-based model (ABM) in NetLogo. I've learned to love both of these programs, partly because they're free (and free software is awesome!), but also because there is a huge amount of information online to help you navigate through the technical jargon and different coding syntaxes. Not to mention errors – one extra tidbit this trip has taught me is that when you have a coding error crop up, no matter how seemingly obscure it may be, you can bet that someone else will have had it before and will have posted it up online to get help.

We also saw a dead tarantula hawk wasp being carried off by our target species of ant, Novomessor cockerelli. Those little gals are strong!

The modelling process can be challenging, but I've also found it to be an incredibly rewarding approach to tackling ecological questions. As somebody who usually works on wild-caught animals, it's a nice change to work on something you have complete control over and will do whatever you tell it to (even if it does take a while to figure out how!). It also allows us to make predictions about specific situations, which we can test. Through that testing, we can assess both our model, and our understanding of how certain ecological scenarios play out. 

Nothing reminds you that you're in the USA more than bullet hole ridden sheets of metal in the desert!

Except maybe lantana being grown as a cute little ornamental.

As always, I'd like to thank my awesome supervisor for sending me over there – I am exceptionally lucky to be given such fantastic opportunities, and I am extremely grateful for them. I also want to say a massive thank you to Ted for hosting me – the amount I learned from this trip exceeded my wildest expectations, and I was expecting to learn a lot! - and to Ofir for our many brainstorming coffees. I'm really excited to finish up debugging my code, and get some simulations running so I can share our results! 

A spring sunset in the desert.

All images by Rebecca Wheatley unless otherwise credited.