Day 100 – Fin

I’m done. The summer has ended, my project is complete, I’ve turned in my evaluation, and I’m soon to be paid. Looking back, I’m really thankful that I got the opportunity to participate in this year’s Google Summer of Code. I honestly did not imagine how much I would end up learning this summer, nor did I anticipate the understanding of how very little I actually do know.

During these past few months I went from knowing almost nothing about the Python programming language, to completely falling in love with it and it is now my default language to code in. I learned a lot about the values of being self-motivated (not going to lie, it took me a while to reach this understanding). I really have to hand it to Google for leading this amazing program each year, and to give a very special thanks to the folks over at SunPy. You guys have really made this experience awesome, and really are to blame for me learning so much this summer. I would eagerly recommend GSoC to any budding programmer who needs to get some code under their belt and have a great experience doing so. With that, I’m probably going to sign off, I’ll post more in the future as I update my code base, but at the moment I’m done and I’m going to enjoy those fleeting moments of new-found freedom :).

Day 70 – Didn’t pan out

I was originally going to title this post ‘Took a wrong turn…’ but I really, it was less of a mistake, and more of a learning experience. Vague, feel-good banter aside, I should probably elaborate. My current task with SunPy is to write and interface that allows our library to politely talk to the HELIO web-service. My mentor helped me into contact with an individual (Marco) who has already created such an interface, but it was written in another language and with different end goals in mind. After much brow-beating and one rather long Google hangout later, we were able to get the code working on my computer. I was exploring the possibility of interfacing with the Java library that Marco had written. After spending upwards of a week and a half exploring Python modules to interface with jars, browsing Marco’s code, and playing with tests, a severe potential problem emerged: a single point of failure. Though well written, and though it would simply implementation of an interface, relying on a single Java archive, developed by a single individual outside of the SunPy group, presented  a worrisome possibility that should anything happen, there would be little SunPy could do other than scrap the HELIO module and start over from scratch.

It was an attractive option, but the other option shouldn’t be too bad. My new course path will be to connect with HELIO via a RESTful or WSDL interface, which in conjunction to the currently written Java code of a similar nature, I’m sure that I can crank out this module without too much issue. I’ll just finish with a special thanks to my mentor David for helping out and Marco for providing so much help with understanding his code. Now, I’ve got to run to class.

Day 53 – Survived the Midterms

A bit has happened since my last post on here, I really need to get more regular with this blog. Maybe they have fiber for blog writers/programmers…

Nonsense aside, the first major news is that it seems the SunPy organization must like me or something because I successfully survived midterms, got paid, and am still employed. At this point in my internship I’ve successfully written a module. It might not sound impressive and it might have a couple of bugs that I have yet to discover, but for me it’s something that I say with pride. I really didn’t have much experience with software development before GSoC and my knowledge of Python was at best rudimentary. My time during this program has consisted of pouring over tutorials, deciphering the interplay of the existing code in the SunPy project, dueling with Git, and struggling over each line of code in my module. It’s important to understand that I’m not complaining, because I’ve enjoyed every minute of it. I’m halfway through and I’ve learned a ton; I can only imagine what this next half will hold.

My experience with Git almost deserves a post to itself. It reminds me of a silverback mountain gorilla, very fast, tons of raw power, and under no circumstances should you ever attempt to make direct eye contact with it. By learning to proper incantations of ‘add’ and ‘commit’ you can eventually earn the trust of the beast, but approach with caution. Silliness aside, it’s a really power system of version control, and while I’m still mildly terrified of it, I’ll admit that I’ve enjoyed my transition along the steep learning curve of this tool.

On a final and unrelated note, I stumbled across this article and so far, this is probably the clearest and most straight forward explanation of Python decorators that I have come across. If they still confuse you, I recommend that you give this article a read. Kudos to Simeon Franklin for being able to explain it.

That said, I’m going to end this eclectic article. I’ll really try to make my posts more regular. Good night magical ether of the internet, see you again real soon.

Day 37 – First Code Demo Summary

Well, I’ve taken quite a break in between posts, I think it’s about time I remedy this, and for good reason. Recently, a rather big moment (atleast for me) happened in my quest to develop code for SunPy: I built a functioning HEK to VSO translating module. Now it still has room for improvements and already I know of a couple of tweaks that I need to make, but as far as it goes it works and I was able to demo it to my mentors and other members of the SunPy group last Friday. With that said, this post will focus on recapitulating the demo and be a “how to” for using it.

First I would like to start with some background: this module arose from a need to translate the results from a HEK query into a usable data type that can be used in turn to query the VSO web-service. This module successfully performs this operation and returns the eventual VSO results in the form of a list. With that, let me show you how to use this module.

First, make sure you have the most recent copy of my fork which can be found with:

git pull https://github.com/mjm159/sunpy.git master

Next, open a python interpreter, my example will be done with ipython (which if you haven’t tried it yet, it’s awesome and totally worth the time and bandwidth to install).

Import the following modules:

from sunpy.net import hek2vso
from sunpy.net import hek
Next I’m creating the variables tstart, tend, and event_type to correspondingly hold the start time of the range, the end time, and the event type of interest:
tstart = '2011/08/09 07:23:56'
tend = '2011/08/09 12:40:29'
event_type = 'FL'
Now I’m creating an instance of the H2VClient():
h2v = hek2vso.H2VClient()
You may have been wondering why I had you import the hek module in conjunction with the hek2vso module, the reason is that the H2VClient() takes HEK style queries and as such I’m using the HEK attributes to form the queries. The results from the full query will be stored in the ‘results’ variable:
results = h2v.query(hek.attrs.Time(tstart, tend), hek.attrs.EventType(event_type))
When you run the query, it will act as a complete transaction between the HEK web-service and the VSO web-service. This process takes a while, and in response to that, when the full query is run a progress bar will appear. All that is simple enough, but there are a few more methods that should be mentioned.
On top of the results being stored in the variable, the instance will also hold a local copy of the HEK results and the VSO results, these can be returned at any time by calling the following methods (h2v being the previously declared instance of H2VClient()):
h2v.return_hek_results()
h2v.return_vso_results()
The instance will also keep track of the number of records returned from the previous query which can be accessed via this method:
h2v.return_num_records()
Finally, should you already have HEK results of your own that you would like to translate into a VSO formatted query, there is a method you can use easily use, which by passing in a list of HEK results, it will return a list of VSO style queries. To utilize, simply follow this form:
vso_formatted_query = h2v.translate_results_to_query(list_of_hek_results)

That’s all for now, following below are a list of intended future improvements:

  • Organize VSO results via the corresponding original HEK query
  • Break up the query stages to give multiple points in the process for the user to influence
  • Include the VSO.get() method

With that, that’s all my demo entailed, updates will come as I tweak the code and implement the desired improvements. If there are any questions in regard to this module, please message me either via wordpress or github.

Thanks everybody I’m calling it a night.

A Small Hiatus…

I really should have posted this earlier, but last week Wednesday (June 26th) I was lucky enough to have my tonsils and adenoids removed. I’ve spent this last miserable week recovering and during that time I really wasn’t in any shape to be working on my GSoC project. That said, I finally feel semi-functional again, and I will return to work tomorrow with little catch-up over the weekend. I realize this now puts me about a week behind, but when planning my schedule, I did include a small buffer period just in case. Anyways, I’m excited to return to coding and with that I’m going to call it a night.

Day 6 – June 24th, 2013

I managed to get a lot done today. Here’s what I achieved:

  • Got hek2vso.HEK2VSOTool.query() method to finally run
  • HEK2VSOTool.query() effectively queries the HEK web-service with passed in HEK style query. 
  • Wrote the HEK2VSOTool.return_hek_result() method which by default returns the unformatted JSON data structure results from HEK, or if the “formatted” argument is set to true it will return the JSON results nicely formatted.
  • Learned that you can pass in lists, dictionaries and tuples to a method as multiple arguments by placing a ‘*’ before the variable name when passing it to the method
    • def foo(self, *args):
          …

      a = [‘xxx’, ‘yyy’, ‘zzz’]
      foo(*a)

  • Was able to successfully test using the VSO module through the hek2vso module.
  • Worked on an old pull request in regards to changing the displayed cursor coordinate system when using the ‘peek()’ method.
    • Found the Map module header information (self._original_header), need to better understand how to manipulate it to get the correct coordinate information from it.

Tomorrow will consist of more work on the Map module coordinate converter and a lot of focus parsing the HEK result JSON data structure and generating VSO queries from that. Anyways, that’s all for now, I’ll keep you posted.

Day 1 – June 17th, 2013

Today I sat through a meeting with the group and got to know the other members of the SunPy team and got some pointers on where to focus my energies in these next early weeks. I researched the HEK system and at first tried to use their IDL library, but after some more searching found their Web based API, which I think will be better suited for the current libraries. After playing with the query structure a little bit, I found that I had the option to have results returned in XML or JSON. After some research, I’m leaning towards JSON for the preferred output filetype. As a whole I’m just starting to get into the groove of things and I think that tomorrow I will be more productive.

 

Resources:

Accepted!

A little more than a day ago I got the incredibly exciting news that I’ve been accepted into the 2013’s summer of code. Now that I’m officially a member of the SunPy team, I get to spend the next 2 weeks learning from and working with the community to get me prepared for the summer ahead. I’ll be sure to keep you posted.

GSoC 2013 (Hopefully)

One of the requirements for the Google Summer of Code to have a blog to document your experiences as a student working on an open source project. I plan on using this blog for those purposes and to use it as a system for feedback and goal checking. Ideally I would like to have weekly updates, checking off completed objectives, sharing insights, and making goals for the upcoming week.