(Prequel)Second PR to JuliaAstro

PR info.

9th PR on AstroImages.jl(I only submitted 2 PR before getting selected for JuliaAstro although I had other PRs in other Julia related repos). Task: A FITS file can contain both images and/or tables related to an Astronomical image. So my task was to write something to handle cases when there is no image component present in the file. It’s like adding corner cases. Things used: Nothing specific. But many iterations done due to not knowing standard things. (I was still new to Julia)


My first PR was in and I discovered this one accidentally. I got an error while using a FITS file without an image component. Although we can specify our own index but by default AstroImages treated the first index of FITS as image component. But according to me, the system should be intelligent to handle such know situations (also was finding things to make PRs for). It later turned out to be an important observation.

PR evaluation and learnings

This PR started with pointing mistakes I did in the PR. I wasn’t familiar with the concept of Multiple Dispatch then and I mixed development practices of Python too. I was opening the same file several times (in Astronomy it can go to GBs too). I also added internet dependency for downloading files for unit testing. Important learning, it too tempting to just download test files and write unit tests on it but don’t add that dependency unless it is very important. You can always write your own small test files to test behavior.

So I had to learn how to create a FITS file of several types. I borrowed that part from a related package tests. It not wise to spend time on things that can be Googled easily. So trying new things for the first time without understanding it well will come with its own failures. Here I got my very first rigid(tuff) CI failure. I asked for help but I think Mose was too busy to spend time sniffing it. So I decided to do it on my own and yeah in OSS you will get this feeling a lot.

In this PR, I saw my very first inter-platform failure. The tests passed for Linux but failed for Windows. I was thinking “is this even possible, the water here and water miles apart will be H2O only. So, why is this failure?”. I later found that I wasn’t closing files after opening them. In many systems it is done automatically(Linux) but what if your environment doesn’t do this? You need to do this manually. So close the files you open!!

As the tests were failing for Windows (on appveyor) and I had Linux installed, so how could I possibly test it? I can’t just make numerous commits in the same opened PR to find the right combination. It’s bad for your image. So I came to know you can do these tests for your forked repos each time you made a commit to it. You just need to make a free Travis account and enable testing for that repo.

All things went well and this PR too 3 long weeks and finally got merged before GSoC results were out!!