SWAN User Guide for the openUp2U Learning Platform

About SWAN

SWAN (Service for Web based ANalysis) is a platform to perform rich interactive data analysis and experimentation in the cloud. 

SWAN allows users to write and run scientific code with only a web browser, leveraging the widely-adopted Jupyter notebooks interface. The user text, code and execution results can be combined inside a single notebook, which, together with data, lives entirely in the cloud. 

SWAN, therefore, makes it easier to produce and share results and scientific code, access scientific software and produce tutorials and demonstrations. Furthermore, it is also a powerful tool for non-scientific data analytics and a very friendly way to introduce students (and their teachers) to code, since it hides all the installation and configuration complexities.

Advantages of using SWAN in educational practice

Programming is everywhere nowadays, and having some knowledge in this area can prove very useful for future university students and future workers. SWAN can also nurture students’ curiosity by providing a more interactive experience than a plain old static document.

SWAN lowers the entry barrier into programming by providing a ready-to-use system, with powerful languages and libraries – already installed and configured. By using the notebook interface, users write code as if they were writing a document in a word processing software, which should be a familiar interface to them. It also allows the teachers to produce documents with contextual information, interleaved with the code, making it easier to follow and understand. 

The interactivity and rich media integration also allow students to learn code by trial and error, with immediate visible results. 

For this reason, SWAN is central to many of CERN’s education activities.

Every year, more than one hundred university students visit CERN to learn and work in physics-related projects. During this time, they attend courses that include practical exercises. These exercises usually consist of notebooks – a script with unfinished coding blocks that thestudents have to follow and complete. The code that the students are required to complete produces tables, interactive plots and 2d/3d images.

Starting SWAN and creating my first project

Have you already visited CERNBox at least once? If not, the first step is to create your storage space so that SWAN can use it.  To do this access   https://cernbox.up2university.eu

When you first open SWAN, you have to select some configurations (i.e. which software packages, and versions, to use). If you don’t have a specific need, just leave the default configuration and click “Start my session”. The environment will be created for you.

 Then you will be in the Projects view. If it’s your first time using SWAN, this page should be empty.

A project in SWAN is a special type of folder that you can use as a container for your work on a given topic: notebooks, input/output files, other subfolders, etc.

In the Projects tab, you can create a folder by clicking on the + button. You will be asked to name a project and, if you do not provide a name, a default one will be chosen.

Once the project is successfully created, you will be automatically redirected inside the folder so that you can start adding content to it.

Creating and editing a notebook

After creating or browsing a project, you can add content to it. 

One of the most important types of content you can add to a project is a notebook. 

Notebooks are documents that contain live code, equations, visualisations and narrative text. You can even run the code to produce rich interactive content, like plots and graphics.

SWAN allows you to create notebooks in four different languages: Python (2 or 3, depending on the software stack chosen during the session configuration), C++, R and Octave.  Python is a good language to start with.

To know more, please read about Jupyter, the notebook interface used by SWAN. 

In order to create a notebook, click on the + button from inside a project or a regular folder. A list will then appear with the available languages. Once you select one, the notebook interface will open in a new tab.

A notebook is a sequence of cells that can be markdown of two main types:

  • text/markdown – which is a way of writing formatted text (to learn more click here)
  • code – where you can write the code in the language you have selected.

When inside a cell, you can switch the type by clicking on the dropdown in the toolbar. Once you have written your text or code, you need to run the cell. Just click the Run button in the toolbar (between the arrow down and the stop buttons).

If the cell is text/markdown, its contents will be rendered. To edit, double click it.

If the cell is code, the code will be evaluated and the output will appear below. You can re-run it as many times as you want using the same cell; and if your code is wrong, correct it and run it again.

Translate »