GSoC Blog#2
The first half of the coding period is almost done, and here I am with the updates! As stated at the end of the last blog, I started the 3rd week by improving the second PR. I performed pretty intensive memory and performance analysis on the functions in fourier.jl, using BenchmarkTools and .mem files to analyze bottlenecks in the program. With my mentors’ help, I removed many allocation and type-stability related issues during that time. I also had some problems with non-idiomatic code, like I could use multiple-dispatch or dot broadcast in functions, some of which I solved, and some are due for refactoring after the mid-evaluation. After finishing the improvements and getting my second PR merged, I planned to work on LightCurves and implement periodograms and other APIs so that users can easily manipulate photon count data. But my mentor suggested I implement file reading and mechanisms to manage the GTIs (Good Time Intervals) obtained from these files.
Working out the GTI mechanisms
I had learned a lot from the previous PR, and one of the things was I should try to implement some of the methods in my way rather than using the python algorithms with an idiomatic Julian code in mind. I started the 4th week with methods for reading GTIs from a FITS file (For those unfamiliar, it is a file format for storing, processing, and transmitting scientific data, especially images). I used the FITSIO.jl package, and experimenting on the terminal led me to manipulate HDUs and their data. One thing I thoroughly thought of was the appropriate data structure of the GTIs. Should I use Intervals from the Intervals.jl package? Or a vector of vector like the python library does? I finally decided to use what I was using in the fourier.jl, an AbstractMatrix of Reals. It was easy to access data from them, and you could use slices to get a list of start and end times. For the operations, I had to convert among matrix, intervals frequently, and vectors as the Intervals.jl provided many ways to manipulate GTIs like union or intersection or getting its complement, i.e., Bad Time Intervals. With some more methods like creating masks and GTIs from conditions and implementing Tests for all of these functions, I was finished with the gti.jl file. A little performance analysis told me that the code was efficient. After some refactoring, like removing code duplication by merging union and intersection in the same function, I was done with the PR. It has some minor changes currently to be made before it gets merged.
Working on the documentation
As the mid evaluations have begun this week, I will be taking some time to write the docstring and deploy them on GitHub. The stingray python docs are pretty good, so I will mostly use them as a Base and tweak them as necessary (when there is a different function signature or the Julian way of doing things is different). Documenter.jl will be the package I would be using for this. The complete documentation will be a milestone for the end of the program, where I, along with my mentors, will try to write notebook tutorials for the package and host them.
For the second phase
I hope to qualify for the mid-evals, after which the second phase will begin. The core implementation is done; users can now use the library and its different methods to read from a file, process the data, and create periodograms. The main motive now will be to ease its access and implement other helpful features, a major one of which will be plotting the periodograms. I initially proposed working with these APIs before mid-evals, but who knows about the future? I have done some things meant for the other half, so I guess it’s okay. As an end note, I am pretty much excited for the other half of this program, it has made me learn a lot, and the workings of Julia awe-inspire me as I explore it side by side. Goodbye for now!