Skip to content

Instantly share code, notes, and snippets.

View GiantMolecularCloud's full-sized avatar
📈

Nico Krieger GiantMolecularCloud

📈
View GitHub Profile
@GiantMolecularCloud
GiantMolecularCloud / install_into_casa.md
Last active January 22, 2021 11:26
Installing python packages into CASA (pre CASA 6)

Astropy has a nice description how arbitrary packages can be installed into the bundled version of CASA (all versions before 6): https://docs.astropy.org/en/stable/install.html#installing-astropy-into-casa

This works well but can be a bit annoying to restart CASA multiple times and wait in between. The following simple bash script solves this:

# packages to be installed
####################################################################################################
@GiantMolecularCloud
GiantMolecularCloud / parallel_casa.md
Last active August 21, 2020 14:49
Simple approach to parallelize serial tasks in CASA

How to parallelize CASA with an easy to work with interface

Using CASA can be slow at times. There are many tasks that have to work in a serial way and thus cannot be parallelized. Often, these tasks have to be run for a number of independent files which opens up an opportunity for a manual, kind of brute-force parallelization: just execute multiple instances of CASA and let each do only one specific task. This is quite easy to implement in python. The function run_in_casa in my python_helpers collection is a wrapper to launch CASA and pass commands to it. It takes the approach of passing the commands as a file to execute rather than directly connecting (e.g. to stdin). This is simple but robust and has worked very well for me for years. With this method to execute CASA, parallel instances can be created with the multiprocessing package.