When you want to create plots for your journal publications, you often end up with problems like wrong font size, too much space around a figure, or all kind of scaling related issues. This becomes even worse if you try to align multiple plots to each other in a grid, where slight differences in size …
Continue reading Creating Publication-Ready Figures
Category:Python
My Top 10 Tips for Python
I was recently asked what are my top 10 tips for Python. Well, here they are (in no specific order). Use Python 3 (3.9 is the latest, Anaconda is at Python 3.8 at the moment, which is absolutely fine) – Python 2 is outdated and will get no more updates. Also, Python is becoming faster …
Continue reading My Top 10 Tips for Python
Matplotlib Performance
When generating images for ever larger growing data sets, the performance in creating and writing them to the disk is no longer negligible. Imagine a data set with 10,000 astronomical sources, each observed in 10 bands. Just writing out an image for each band would result in 100,000 images – leaving apart any analysis plots. …
Continue reading Matplotlib Performance
Customizing Jupyter Notebooks for Presentations and Reports
Jupyter Notebooks are ideal for data analysis when using Python. They allow you to analyze the data, while at the same time writing documentation. The data processing and report writing become intertwined: while you explore and analyze the data, you already have a draft of your report at hand. Unfortunately, Jupyter Notebooks are not too …
Continue reading Customizing Jupyter Notebooks for Presentations and Reports
Running a Jupyter Notebook remotely in single line
In order to run a Jupyter Notebook on a remote server (here: SERVER), one usually first opens a shell, logs in on the remote server, starts the jupyter notebook server. Then usually you open a new shell, and forward a local port using ssh. And finally you open the notebook webpage in your browser (here: Firefox). …
Continue reading Running a Jupyter Notebook remotely in single line
Using Conda for Python 2.7 vs 3.x switching
Needing a system that allows for easy switching of Python versions or, within one version, switching between different environments, Conda is the easiest way to go. Conda is a package and environment management system, that was exactly developed for this purpose. With Anaconda being a collection of Python packages we are set to go. The …
Continue reading Using Conda for Python 2.7 vs 3.x switching
Creating your personal Python environment using virtualenv
Often you are working on a computer where you do not have the user privileges to install custom Python modules (or software in general). Or you do not want to mess with the operating systems Python environment. Then, sometimes you just want (or have to) install python modules with a specific version, e.g. to get …
Continue reading Creating your personal Python environment using virtualenv
Using Gildas/Class from Python
As many people have been asking me on how to use Gildas/Class from within Python, I’ll try to give a quick tour here. You will need to have Class installed including the Pyclass extension. Before you start the Python script you need to initialize Gildas in the shell. Make also sure it is in your …
Continue reading Using Gildas/Class from Python