Sunday, 5 June 2016

Dinner Party For 4.5

I have three half-written posts in my drafts so, of course, I decided to start another. I wanted to reflect on the community bonding period and the first two weeks of GSOC.

The Prelude

The community bonding period felt strange to me as it felt like I was in limbo, being so close and yet, so far from starting.

I set out to understand the inner workings of sherpa. I ended up elbows deep in the git repo, completely bewildered and I realised, I'm not going understand the code unless I try and use it.

I need to get a feel for the code, I can't just read source (some people may be able to but I'm a bit more tactile, yeah tactile ... I can touch code apparently -  maybe a I have a superpower after all).

I set about writing a lower level version of the proof of concept for the project which, my one of my mentors wrote. After a bit of time spent looking at docstrings and call signatures (thank you ipython; looking back on it I now, realise how important they are, good docstrings will save a user from a world of hurt) I managed to cobble something together and I sent it off to my mentors.

This started off a discussion of workflow, code sharing and, development environment setup. They suggested gists and ipython/jupyter notebooks would be a good way to share and document the code that I will write as I develop the astropy-sherpa bridge. The aim is to turn these into proper documentation and unit tests later.

I setup my virtual-env (I had to write a small shell script to source the conda eviroment as I use tcsh) then installed the source for the two projects and installed pep8 into my editor. All set and ready to go!

It Begins!

Week 1 hits! I continue to develop on my code to make it more general (allowing 2D data and error bars) and include sherpa's confidence interval estimation. This image sums that up petty well.

Initial Contact

I continue though the week and we get to the first mentor meeting. I can't find a parking space. Typical! I manage to get setup and logged in 5 mins before the meeting. We have a chat and discuss the direction of the project.
We decided that documenting the two API's similarities, differences and clashes would be useful. Once again a picture says 1000 words right? So this one seems to sum up the gist (pun kind of intended) of the meeting.

Week two rolls around and I set off to turn the extend proof of concept code into something more concrete that is part of astropy instead of just using it. I also wrote some informative docstrings not just "function to convert astropy models into sherpa models" which, is what it does (but it's not very useful for someone who want's to know what to put into it).

I decide to refactor the code to better match how astropy's current fitting routines are written. I then delve into the APIs. I write an email to my mentors about mid week, explaining the what I found and my thoughts on how to implement the linking of parameters across models during the fitting; an idea which we had come up with during the first meeting. I then set about writing more proof of concept code for the three solutions I came up with so that we could decide what to do.

The Return Of The Mentors (And Some New Ones)

I didn't manage to get them all finished in time for the second meeting. I met some more of my mentors (I have 3.5) that couldn't make it to the first meeting. After a few technical difficulties with microphone settings, we discussed a better time frame for me to send them code and I also need to email them to tell them where it is!

It's certainly a learning experience, as normally I only write code for myself and a few people within my research group so, this is completely new to me but its certainly enjoyable! We also came up with a plan for the weeks leading up to the mid-term. Wow! The time is flying by!

Thanks for reading and thanks to my better half for editing this for me so it makes sense.


  1. Michele!! amazing post!! keep writing them!! How much true are in these memes you posted and in all you said. I am happy to know that you can touch code! now you have also to learn how to shape it in such a collaborative community like astropy and I see you are going in the right direction! Great!

    Only one thing... why? WHY?? WWWHHHYYYY?? you hurt yourself using tcsh? I know it's a thing that's in the core of many astrophysicists' (mostly solar physicsists) computers... but you don't need to!!
    Take a look to a post I wrote a while ago: and feel free to give me comments to improve it or write one yourself so astro people can also get a better live*.

    * zsh has a lot of fancy stuff which improves your live even more!

    1. Thanks It's been alot of fun so far :)

      About tcsh be honest I don't know...habit? The first shell I used day to day was in astrophysics department and the default was tcsh. I since became used to it's "quirks" and there now ingrained into my muscle memory.

      I've been thinking I probably should switch at some point but just haven't gotten round to it. A former colleague was telling me about the git integration of zsh which does sound very appealing.

      I recently watched a video from pycon 2016 and xonsh looks interesting so I might check that out as it's a superset of python so that's already in my muscle memory.