Monday, 22 August 2016


So as GSOC comes to an end it’s time to serve dessert. I haven’t been good at keeping this up to date, though I have a couple of non-posted entries but alas the time has come to wrap this up. While I still have some small features which currently lie in two PRs (#4 & #5) to finish developing we are releasing saba 0.1without these.

My PR#5241 to astropy is currently open but I think I have made most of the corrections required. The code within it provides a means of inserting external fitters into the astropy.modeling.fitting namespace. This is achieved by loading entry points which are then tested to check they extend the fitter class before being inserted into fitting.

Saba is name of the package I have developed (help from my mentors), we have just moved the repo into the astropy org (in case I win the lottery or mortally am injured in a car accident - depending on which of my mentors you ask). Saba acts as an interface between Sherpa an x-ray fitting package and Astropy’s modeling subpackage through the use of a fitter which acts as a Bridge between the APIs of the two packages. The documentation can be found here. Documentation…

We we’re intending to make the two sets of models work together however, we decided instead to extend the fitting options to allow the use of sherpa’s MCMC object. So in some ways we exceeded the brief, in others we didn’t.

I’ve learnt a lot during GSOC, having weekly actions gave am something to focus on - short term goals meant that I didn’t wander too far off track but left room for experimentation. The code reviews helped to shape my code into a cleaner structure and made me implement better practices (docstrings - although I still forget sometimes). My use of git has become semi-proficient although sometimes I forget to get off master. I’ve learn’t about continuous integration services and I’ve had my fair share of problems with them. The pypi packaging was pretty easy but I’ve still yet to get conda working.

So although this isn’t really the end as I still have somethings to finish (conda packaging, a couple of pull requests to close and no doubt lots of issues to fix), this projects is going to relegated to breaks from writing my thesis.

A massive thank you to Tom, Omar, Moritz and Doug for their help and insight during the project. They made this an enjoyable experience. Also thanks to my better half for the projects logo which makes Tom want to use the package.

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.

Monday, 25 April 2016

GSOC proposal accepted :)

So beings my exciting adventure with the Google Summer of Code. When I submitted my proposal, I did not expect to be accepted and am relishing in delight that I have been. I can’t wait to start coding and shall be updating Condiments or Code? every two weeks. 

This project will be berry beneficial for me to learn how to code for a larger project than I am used to and I hope that the outcome of this adventure will be something that is useful for the astropy community. I will be working on bringing Sherpa's models, fitting routines and statistics to astropy.modeling and also allowing Sherpa's models to be used as astropy models. This will give the community many more models, optimisers and fit statistics to use and I am excited to be able to do this. 

Ketchup with you next thyme!

P.S Sorry for the puns, It's a spelling mistake that got out of control.