Wiki source code of Tutorial

Last modified by chaney08 on 2021/07/20 19:20

Hide last authors
chaney08 2.1 1 == Purpose ==
2
mmorgan 30.1 3 The purpose of the Lab tutorial is to teach you how to create and use your first notebook as well as to explain the basic principles to allow you to continue beyond the scope of the tutorial in developing your own notebooks.
chaney08 2.1 4
chaney08 25.1 5 == How to get to the Lab ==
chaney08 2.1 6
7 (% class="wikigeneratedid" id="HYoucanalsoaddimages" %)
mmorgan 30.1 8 To get to the Lab, simply go to a Collab that you are a member of and where you want to work and click on the "Lab" navigation element in the left pane, as shown in the following screenshot:
chaney08 2.1 9
chaney08 28.1 10 (% class="wikigeneratedid" %)
11 [[image:1622123755771-230.png||height="227" width="190"]]
12
mmorgan 30.1 13 (% class="wikigeneratedid" %)
14 Note: the "The Collaboratory" collab is visible to you because it is public but you are likely not a member so you won't see a Lab navigation element in that collab.
15
chaney08 25.1 16 == How to create a notebook ==
chaney08 2.1 17
mmorgan 30.1 18 Upon entering the Lab, you see menus across the top, and tabs down the left edge. The top-most tab on the left edge (folder icon) displays the content of the selected folder in the Collaboratory.Drive. The default folder is the top folder of the Drive of the collab from where you opened the Lab. Among the files visible in this folder tab, you might have existing notebook files (the ones with the ***.ipynb** extension). You can open and run these notebooks. You can only save edits and/or the log of your own execution output if you have write permission in that collab. Or you can save the notebook to another collab's Drive from the top menu with File > Save As.
chaney08 7.1 19
mmorgan 30.1 20 On the right-hand side, you will see your "Launcher;" this is where you can create a new notebook.
21
chaney08 14.1 22 [[image:1622125349931-642.png]]
chaney08 16.1 23
mmorgan 30.1 24 If you click on the "Python 3" button underneath the "Notebook" heading, it will create a new notebook called "Untitled" in the folder pane and open it as a new tab in the right-hand pane. You can give this notebook an appropriate name by right-clicking on the file in the folder pane and clicking "Rename." It will also change the file name in the right-hand notebook viewer.
chaney08 16.1 25
mmorgan 30.1 26 Clicking the tabs along the left edge will minimize the left-hand pane.
27
chaney08 25.1 28 == How to develop/run a notebook ==
chaney08 16.1 29
mmorgan 30.1 30 Notebooks support the Python 3 programming language and other languages may be added in the future. For now, any code you type into these notebooks should be in the Python 3 syntax. Notebooks are divided into "Cells". You can execute the code in each cell, one cell after another, or sequentially. All cells in a notebook share the same environment; therefore importing a Python package/library in one cell will allow it to be used in another cell. Variables set in one cell are accessible in other cells. Cells help organise your code. An example of this can be seen below.
chaney08 16.1 31
chaney08 19.1 32 [[image:1622127087243-656.png]]
33
mmorgan 30.1 34 In the above example, you see a red highlight and a green highlight. The red highlight shows the button you press to add a new cell to the notebook. The green highlight shows the button you press to run the selected cell. The selected cell is shown by a blue bar to the left of the cells. In the above image, you can see that the third cell is currently selected. This process allows you to develop a full program using Python with your notebooks.
chaney08 20.1 35
mmorgan 30.1 36 The results of executing each cell are shown in the white space between cells. These results are stored in the ipynb file for the next time you open the notebook.
chaney08 20.1 37
chaney08 25.1 38 == Sharing a link to your notebook ==
chaney08 22.1 39
mmorgan 30.1 40 Sharing a link to your notebook is as simple as right-clicking on the file you want to share (in the folder tab) and choosing "Copy Shareable Link" from the context menu. The URL is copied to your browser's copy/paste buffer. You can send the link to anyone you want to view the notebook; the users will need to have read access to the corresponding collab. You can also use this link to create navigation elements inside collabs that will link directly this notebook.
chaney08 22.1 41
42 [[image:1622128734293-231.png||height="360" width="400"]]
43
chaney08 28.1 44 == Calling the Drive from a notebook ==
chaney08 22.1 45
mmorgan 30.1 46 To see how to retrieve and edit files from the Drive, please have a look at our notebook which you can access by following this link: [[https:~~/~~/lab.ebrains.eu/user-redirect/lab/tree/shared/The%20Collaboratory/Tutorial/Drive_Mounted_fileSystem.ipynb>>https://lab.ebrains.eu/user-redirect/lab/tree/shared/The%20Collaboratory/Tutorial/Drive_Mounted_fileSystem.ipynb]]
chaney08 22.1 47
chaney08 23.1 48
chaney08 28.1 49 == Calling the Bucket from a notebook ==
chaney08 24.1 50
chaney08 31.1 51 You can find an example on how to call the Bucket storage from a notebook using the following notebook: [[https:~~/~~/lab.ebrains.eu/user-redirect/lab/tree/shared/Data%20Proxy/Example%20Buckets%20Programmatic.ipynb>>https://lab.ebrains.eu/user-redirect/lab/tree/shared/Data%20Proxy/Example%20Buckets%20Programmatic.ipynb]]
chaney08 24.1 52
chaney08 26.1 53 == Conclusion ==
chaney08 24.1 54
chaney08 28.1 55 Now that you have finished this tutorial, you know the fundamentals to using the Lab, and you can now develop your own notebooks going forward.