<jupyter_start><jupyter_text>Cells Cells are isolated blocks of code that can be run individually. Although the code is sequesterd within a cell, the variables created in a cell can be accessed else were. Manipulating cells in jupyter notebook is easy. A cell is what this is,it is where you will be writing your code.  There are two types of cells in this document, markdown cells and code cells. The type of cell can be changed at the top of the notebook in the dropdown menu that shows either Markdown or code.   Exercise:  Change the type of this cell from markdown to code.Code cells will be used for all excercises in this tutorial. All cell manipulation tools will be found at the top of the notebook.  To add a cell, push the plus symbol. To move a cell, use the arrow buttons.  To delete a cell, click to the left of the cell and enter dd. To a run a cells contents, press shift and enter.  Exercise: Move this cell up one and then down one.  Add an extra cell and then delete it.  Killing Notebooks Notebooks are hosted on the nebula cluster, unless specifically shut down, the job running the jupyter notebook will continue running even if jupyter hub fails. It is important to cancel your jupyter jobs after you are finished.  Select the box next to your notebook in the main jupyter hub tab and click the yellow shutdown button at the top of the page.  Kernels Jupyter kernels are conda environments that can be accessed within a jupyter notebook- Click on 'Kernel' tab in top menu- Go to change 'Change Kernel' and look through the options  Anaconda Environments Anaconda environments are a collection of python packages that are installed into an isolated environment and can be selectively accessed through activation of that environment. They are particularly helpful because various versions of a program or various combinations of programs in isolated environments do not effect those in another environment. For example, ASC internally creates anaconda environments for each new release, and release candidate of the ISIS software. If a user would like to access any particular version of ISIS, they would type `conda activate isisx.y.z`, if later they wanted to access a different version they could `conda deactivate && conda activate isisu.v.w` without worrying about cross containination between the two environments.  Setting up the workshop kernel The default Python 3 kernel that we are using with this notebook does not have all of the software that we will need in it. So, we need to setup a kernel that points to an Anaconda environment with what we will require installed.Run the following cell to write the kernel specification into your home directory. Once it is there, Jupyterhub will automatically pick it up as an option next time you start a notebook.<jupyter_code>from pathlib import Path

kernel_text = """{
 "argv": [
  "/usgs/cpkgs/anaconda3_linux/envs/autocnet_updated/bin/python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "AutoCNet PLIO (workshop)",
 "language": "python"
}
"""

kernel_dir = Path.home() / '.local/share/jupyter/kernels/autocnet_workshop/'
kernel_dir.mkdir(parents=True, exist_ok=True)
kernel_file = kernel_dir / 'kernel.json'

kernel_file.open('w').write(kernel_text)<jupyter_output><empty_output><jupyter_text>You can also run shell commands in a Jupyter notebook by starting the line with "!". Run the following cell to check that your kernel was installed properly. You should see the same text as the kernel_text variable in the cell above.<jupyter_code>!cat ~/.local/share/jupyter/kernels/autocnet_workshop/kernel.json<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.048687089715536105, 'fraction_numerical': 0.0005470459518599562, 'mean_word_length': 4.696261682242991, 'pattern_counts': {'":': 3, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '290961', 'license': 'CC0-1.0', 'n_tokens_mistral': 949, 'n_tokens_neox': 925, 'n_words': 535, 'path': 'docs/users/workshops/FY21_workshop/0_jupyter_basics.ipynb', 'repo_name': 'gsn9/autocnet', 'size': '3656'}