Notes from the CodeRefinery workshop in Gothenburg which covered:

  • version control (github)
  • licenses
  • workflow management tools (snakemake)
  • documentation (read the docs)
  • automated testing (pytest, travis ci)

scripting BIFROST

Wed 15 May 2019 by Luis Velilla Prieto

Observing with the Onsala 20m using scripting and BIFROST

  • The following (abbreviated) script was discussed:
# Define/import global settings
SETUP POINT loops=2 azdist=21 eldist=21 ontime=20 caltime=10 calwhen=3 obsmode=ssw dop=eachcal adjpwr=first rawdata=skip addpol=save backend=SPEa baseline=nobaselines startpos=last apply …
read more

The Python C-API

Wed 03 April 2019 by Michael Olberg

Extending the Python Interpreter with C/C++

The Python interpreter can be extended via C (or C++) code to

  1. make existing python code execute faster by replacing critical sections into compiled code
  2. interface to existing/legacy C (or C++) libraries
  3. make C structures (C++ classes) first class objects within python …
read more

Observation planning with gildas

Wed 06 February 2019 by Luis Velilla Prieto

Context/Motivation

  • Create visibility plots to plan your observations
  • Obtain good quality plots to be enclosed in your proposals

Known tools:

The best starting points for GILDAS tutorials are

read more

Some features of numpy arrays

Wed 06 February 2019 by Franz Kirsten

Installation

  • assuming you have 'pip' installed run the following
pip install numpy
read more

Selection of some useful bash tools

Wed 09 January 2019 by Franz Kirsten
  • Sometimes it is quicker to write a short bash script to 'get the job done' instead of doing it in python or something else
  • bash comes with a load of very useful little programmes that allow you to modify files on the fly
  • if you 'pipe' things together (with the …
read more

pandas

Wed 12 December 2018 by Chiara Ceccobello

pandas: powerful Python data analysis toolkit

Useful links:

A tip: Whenever you are using pandas in your own code, try and stick to the following convention:

import pandas as pd

This will make it easier for other people to understand your …

read more

OCR and digitization of plots

Wed 28 November 2018 by Michael Olberg

Optical character recognition

The tool of choice on Linux and MacOS is tesseract, an open source tool originally developed by HP.

Installation

On Linux (with apt package manager)

    sudo apt install imagemagick
    sudo apt install tesseract-ocr

and then install individual language packages

    apt-cache search --names-only tesseract-ocr
    sudo apt install tesseract-ocr-XXX …
read more

astropy - the python astronomy package

Wed 14 November 2018 by Franz Kirsten
  • get it from here
  • there are a number of great examples to get you started (the examples I showed in the seminar came from here)
  • and further tutorials
  • also check out the astropy-page on the WCS

What it can be used for (biased, certainly not complete list)

  • reading+writing standard …
read more

Writing R extensions

Mon 16 April 2018 by Michael Olberg

Overview

  • R makes it easy to use legacy C and Fortran code
  • comes with beautiful graphics and powerful statistical tools
  • 10000 packages on CRAN

  • packages follow high standards for documentation
  • think of R as python with built-in matplotlib and pandas

Take this simple Fortran subroutine:

      subroutine facto(n, answer)
C …
read more

Emacs

Wed 04 April 2018 by Michael Olberg and Franz Kirsten

Emacs

A short introduction to emacs given as part of the tech talk series.

"Emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish." -Neal Stephenson, "In the Beginning …

read more

Coding in python in a Jupyter Notebook

Thu 22 March 2018 by Franz Kirsten
read more

Anaconda

Thu 15 March 2018 by Magnus Persson

The Anaconda distribution for Python

  • The slides are in this anaconda.pdf

  • Anaconda is a distribution for python which

    • comes with pre-built and pre-configured collection of packages
    • package manager (conda)
    • version management
    • ... and more
  • Freemium software from Continuum Analytics

  • Works basically the same on Win, Mac and Linux
  • Self-contained, install …
read more

Emacs org-mode

Thu 01 March 2018 by Michael Olberg

Org mode

Here is the document I presented, with some comments and keyboard shortcuts added: (S stands for Shift, C stands for Ctrl, M stands for meta (either Esc or Alt). For example M-g would mean, press the Esc key first then press the g key, alternatively press Alt and …

read more

Containers

Thu 22 February 2018 by Stephen Bourke

What is a container?

  • It’s a file system image (eg. tar archive) that gets used instead of the local file system
  • An application to set things up (eg. singularity, docker)
  • When you run an application via a container that application is isolated from the rest of the OS
  • Made …
read more

Rsync and Cron jobs

Wed 21 February 2018 by Franz Kirsten
  • The slides I showed are in this rsync-cronjobs.pdf
  • in a nutshell rsync is a fancy way to copy data
  • instead of copying everything it will syncronise source and sinc by comparing time tags and/or sizes of files
  • can be used like scp to sync different machines in a …
read more

Gimp -- The GNU Image Manipulation program

Mon 29 January 2018 by Franz Kirsten

What is it?

Wikipedia

(GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image retouching and editing, free-form drawing, converting between different image formats, and more specialized tasks.

Gimp - what I …

read more

Inkscape -- A powerful, free design tool

Mon 29 January 2018 by Stephen Bourke
  • Also check out the notes on gimp

What is it?

Wikipedia

Inkscape is a free and open-source vector graphics editor; it can be used to create or edit vector graphics such as illustrations, diagrams, line arts, charts, logos and complex paintings. Inkscape's primary vector graphics format is Scalable Vector Graphics …

read more

Virtualization -- About virtual machines and containers

Mon 29 January 2018 by Michael Olberg

What is this about

The problems we are trying to solve:

  • run software not supported by our operating system
  • run software in well defined environments

Assume that you are asked to deploy a web application which stores and retrieves data from an SQL database engine. For security, reliability and scalability …

read more

Tmux - a terminal multiplexer

Mon 15 January 2018 by Franz Kirsten

What is it?

Wikipedia

tmux is a software application that can be used to multiplex several virtual consoles, allowing a user to …

read more

Git version control system

Mon 11 December 2017 by Michael Olberg

The Abomination

foo.txt
foo1.txt
foo1_john.txt
foo2_jane_feb12.txt
foo2_jane_feb12_with_additional_comments_by_john.txt

Please. don't. do. this!

History

The competition

  • rcs revision control system
  • cvs concurrent versions system
  • svn subversion
  • hg mercurial

... and the winner is:

  • git developed in 2005 by Linus Torvalds, used for the development of the Linux kernel …
read more

Lyx

Mon 04 December 2017 by Franz Kirsten

Lyx - document editor based on latex

Overview

  • encourages writing based on the idea of what-you-see-is-what-you-mean WYSIWYM
  • find it at Lyx
  • the Documentation/Wiki is great
  • allows you to write a LaTeX document without ever having to remember latex-commands

Features

  • import of LaTeX files
  • export of Lyx-files to LaTeX
  • vast amount …
read more

Overleaf

Mon 04 December 2017 by Michael Olberg

Overleaf - collaborative Writing and Publishing

Overview

  • a merge between former WriteLaTeX and ShareLaTeX
  • find it at Overleaf
  • watch the introductory movie and follow the tutorial, by clicking on the ``?'' in the toolbar.

Features

  • platform for collaboration on LaTeX documents
  • comfortable editor with template completion
  • version control with powerful comparison feature …
read more

ssh-agent

Mon 27 November 2017 by Stephen Bourke

ssh-agent

What is it?

  • A separate program that loads your keys and passes them to ssh
  • ssh will see if ssh-agent is running and if so will ask it for your keys

What's the point?

  • To decrypt your keys temporarily
  • Stores them in …
read more

Using ssh and friends

Mon 20 November 2017 by Franz Kirsten

Using ssh and friends

# we spoke about the following tools:
ssh          # utility to access remote machine
ssh-keygen   # used to generate key-pairs (to access machines without a password)
ssh-copy-id  # to copy the public key to the remote machine
scp          # 'secure copy', to copy files …
read more