<jupyter_start><jupyter_text>Getting StartedThe document you are reading is a  [Jupyter notebook](https://jupyter.org/), provided by [binder](https://mybinder.org) and running on [Google Cloud](https://cloud.google.com). It is not a static page, but an interactive environment that lets you write and execute code in Python and other languages. We will be using this for the exercises of the Chemometrics course. For example, here is a **code cell** with a short Python script that computes a value, stores it in a variable, and prints the result:<jupyter_code>seconds_in_a_day = 24 * 60 * 60
print(seconds_in_a_day)<jupyter_output><empty_output><jupyter_text>To execute the code in the above cell, select it with a click and then either press the **Run** button at the top, or use the keyboard shortcut:"Command/Ctrl+Enter". (Or Shift+Enter to execute the current cell and move to the cell below)All cells modify the same global state, so variables that you define by executing a cell can be used in other cells:<jupyter_code>seconds_in_a_week = 7 * seconds_in_a_day
print(seconds_in_a_week)<jupyter_output><empty_output><jupyter_text>Saving your workDue to hosting this through Binder, any changes that you make to the notebooks or filesystem will **not** be stored when you close all the browser windows or press the *Quit* button on the file selection screen. If you want to keep your answers and alterations of the notebook you are working in, please click *File* -> *Download as* -> *Your preferred file format*.With recent binder, they have added an option to save a notebook to your browser cache:at the top, next to the "download" button, there is a "save to browser cache" and "restore from browser cache" buttons (with the cloud symbol). This will save or restore the current notebook to/from your browser cookies. It even works after losing connection to the binder instance after you clicked the cross or `OK` on that error message.If you use the save/restore function, keep in mind that it only stores the current code/text but not any active calculations, so you will have to rerun the code cells after restoring.  Making plotsPlots are a nice way of visualizing data. In Python we use a package called `matplotlib` for that. and for fast math and array operations we will use `numpy`. We will now show an example on how to plot the cosine of 360 degrees.First we will import the packages we will be using:<jupyter_code>import numpy as np  # This will import numpy and rename it to 'np'.
import matplotlib.pyplot as plt # This will import matplotlib.pyplot and rename it to 'plt'.<jupyter_output><empty_output><jupyter_text>Next we will make a list of all numbers from 0 till 359 devide it by 360 and multiply it by $2\pi$. (These text cells can handle Latex math code as well)<jupyter_code>degree = np.arange(360) 
rad = degree/360*2*np.pi
print(degree[:20]) # Print the first 20 items of the degree list
print(rad[:20]) # Print the first 20 items of the rad list<jupyter_output><empty_output><jupyter_text>**Note:**If you want to know more about a function that we are using, like `numpy.arrange()`, you can click to place the cursor inside the function parentheses and press "Shift+Tab" (press more than once for more info) Now we calculate the sine and plot it:<jupyter_code>y = np.sin(rad)
fig, ax = plt.subplots(nrows=1, ncols=1)  # Create a figure and axes
ax.plot(rad, y, label='sin') # Plot x, y
ax.legend()  # Plot the legends
ax.set(xlabel='x', ylabel='y')  # Set the label for the x-axis and y-axis<jupyter_output><empty_output><jupyter_text>Saving plotsIn order to save this plot as a .png you can run `fig.savefig('name.png')`.It will then show up on the file selection screen (`File -> Open...`), where you can select it and press the *Download* button to download it.<jupyter_code>fig.savefig('test.png')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07529107373868046, 'fraction_numerical': 0.009055627425614488, 'mean_word_length': 5.040625, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 28, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '425044', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1077, 'n_words': 554, 'path': 'exercises_2020/00_jupyter_introduction.ipynb', 'repo_name': 'sroet/chemometrics', 'size': '3865'}