Implementing Modern Programming Practices for the MCFOST Radiative Transfer Code

MCFOST, a 3D continuum and line radiative transfer code developed by Christophe Pinte and his collaborators, has been a cornerstone in studying circumstellar environments. Utilising a hybrid Monte Carlo and ray-tracing method, MCFOST demonstrates versatility in addressing diverse astrophysical scenarios. With a growing number of collaborators, however, came a bottleneck in the development workflow of the code. In the absence of continuous integration, ensuring the seamless operation of the latest version became increasingly challenging. With several PhD students concurrently contributing to different aspects of MCFOST, the absence of automated testing and continuous integration became a pressing limitation. Pinte found himself manually validating pull requests, a time-consuming process that grew in complexity with the expanding developer base.

The ADACS team, in collaboration with Pinte, addressed these challenges by introducing modern programming practices to enhance efficiency and reliability in the development of MCFOST.

Streamlining Development with GitHub Actions

GitHub Actions were introduced to the MCFOST repository, providing an automated framework for continuous integration. This entailed defining workflows within the GitHub repository that specified various steps to be executed automatically in response to specific events, such as pull requests or code pushes. This included a set of tests designed to verify the functionality of different aspects of MCFOST running on a range of operating systems and compilers, ensuring that changes to the codebase did not introduce regressions or break existing functionality.

Pinte highlights the transformative impact: “The GitHub Actions are a major improvement in our day-to-day workflow, particularly for myself as the main developer. Since its implementation, I have merged three old branches that I was always reluctant to merge, as I was worried they would break the code. The actions and associated test suite provide invaluable peace of mind.”

The automated testing facilitated by GitHub Actions has proven its worth, as Pinte notes: “The test suite already picked up a bug that we did not see ourselves. This clearly improved the reliability of the code, making sure the master branch is always functional for users.”

Precision in Code Releases

The ADACS team also set up a workflow to automatically create binary releases using GitHub Actions, which has brought precision and reliability to versioning and distribution. Pinte highlights the improvements to the release process: “It is a major simplification of the previous process, which saves me time. I think it is also a reassurance for the users that the release has been fully tested and validated.” Users have responded positively to the improved release process, as Pinte notes that advanced users really appreciate the ability to check the release on GitHub and easily browse through the history of the code change associated with a release. ### Python Package for Analysis In this project, the ADACS team published the code for analysing results as a Python package on the Python Package Index (PyPI). According to Pinte, the primary goal was to streamline the installation process, particularly for students who are just beginning to work with MCFOST. He adds that this initiative has a long-term vision of not only making it easier for new users to get started but also increasing the user base and facilitating future updates.

Positive Collaboration with the ADACS Team

Pinte reflects on the collaborative experience with the ADACS team: “Working with the ADACS team was a fantastic experience. We had almost weekly meetings, and they always delivered on time, explained their design choices well, and discussed various options. Seeing the ADACS team working also changed a bit my outdated view of how to properly develop scientific software. I also appreciated their enthusiasm. I wish they could work full-time on the code” This collaborative effort between the ADACS team and Pinte’s scientific endeavour with MCFOST demonstrates the impact of introducing modern programming practices. Not only do these practices address immediate bottlenecks in workflows, but they also set the stage for future code enhancements that will pave the way for new discoveries.

Categories