Community Bonding Period

Juan Redondo
May 26 · 4 min read

Hi everyone, my name is Juan, I am a fourth-year physics student at Universidad Complutense de Madrid and I have been selected to work with CTLearn under the Open Astronomy organization for this GSOC edition.

First, I would like to give a brief overview of the scientific and technical background of this project.

What is CTLearn used for?

CTLearn is a Python package under active development that applies Deep Learning to the task of Imaging Atmospheric Cherenkov Telescopes (IACTs) event reconstruction. It can load data from all major current and future arrays of IACTs, including CTA, HESS, MAGIC and VERITAS.

IACTs are able to detect Cherenkov light emitted by extensive atmospheric showers produced when both cosmic rays or gamma rays enters the atmosphere. Showers produced by both sources are quite similar, but cosmic-ray induced events are much more frequent, in a 1000:1 ratio. This is rather unfortunate, because cosmic rays are composed of charged particles, which are deviated by magnetic fields; therefore we cannot study the cosmic rays sources by detecting them. Instead, we need to detect gamma rays, which, according to leading models, are also produced in the regions where cosmic rays are produced. Gamma-rays are high energy photons and thus are not deflected by magnetic fields, allowing us to track back their source in the sky; this way we can know more about gamma rays sources as supernovae, pulsars, blazars, pulsar wind nebulae, etc.

An IACT event reconstruction method must be able to perform each of the following three tasks:

  1. Background rejection: classify IACT events as gamma-ray or cosmic-ray induced.
  2. Direction reconstruction: reconstruct the position of the primary particle that produces the shower.
  3. Energy reconstruction: reconstruct the energy of the primary particle.

Currently, CTLearn can only perform the first of these tasks, but it is expected to be able to carry out the whole event reconstruction process in the near future.

My journey into CTLearn

I started to work on CTLearn after Daniel, who teaches at my Faculty and is one of the main developers of this project, told me about it.

I am not a Computer Science student, so I knew nothing about Deep Learning, althought I have always been interested in Artificial Intelligence and had heard about neural networks and that sort of cool things. So the first thing I did, as recommended by Daniel, was to take the excellent Andrew Ng’s Machine Learning and Deep Learning Courses (free at Coursera). I strongly recommend this courses to anyone who wants to go into these subjects. I already had basic Python skills, since I had use it during my university career.

Then, I asked Daniel about some topic to start working with CTLearn, and he suggested me the hyperparameters optimization. CTLearn is written using Tensorflow and includes three different models for gamma ray/cosmic ray classification. The performance of these neural networks depends on several hyperparameters, as the number and size of filters in the convolutional layers, the learning rate of the model, etc. I began to read papers about the state of the art of hyperparameters optimization (here you can take a look on some interesting ones: , With this information, and doing an exhaustive research of related Stack Overflow topics, I landed on the hyperopt Python package. This library allows to implement a Tree-Parzen-Estimators based Bayesian Optimization algorithm.

After that, I installed Debian, Anaconda and Atom IDE in my laptop, and started coding. First I familiarised myself with the CTLearn package and learned how to configure a run and perform training and prediction runs. Then I wrote some scripts to carry out several tasks, as run a CTLearn network training and get its metrics, modify the CTLearn configuration file, etc. At the end, all this process resulted in the development of a proof of concept framework for optimizing CTLearn models, enabling Tree Parzen Estimator based Bayesian Optimization and Random Search Optimization using hyperopt package.

Finally, I wrote my proposal following the Open Astronomy’s guideline, included all the code I had developed, got feedback from the mentors and added the suggested changes. And I got selected.

My plans for this summer

This summer I plan to accomplish the development of an automated model optimization framework in CTLearn, including the following optimization algorithms:

  • Random Search.
  • Tree Parzen Estimators based Bayesian Optimization.
  • Gaussian Processes based Bayesian Optimization.
  • Genetic algorithm based Bayesian Optimization.
  • Time permitting: Random Forest based Bayesian Optimization, Nelder-Mead procedure, Particle Swarm Optimization and others algorithms.

I have been invited to join the CTLearn weekly video conference meeting, that takes place every Monday at 16:30 CEST. I also have access to the organization’s Slack, where I can get fast feeback from my mentors if needed.

I look forward to the coding period and hope for a productive summer!