summaryrefslogtreecommitdiff
path: root/book/module1/spyder_getting_started.tex
blob: 3133b151a8585ed0762cc4132d6456df7520f5bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
\section{Getting started with Spyder}\label{getting-started-with-spyder}

In this tutorial we will cover the basics of using the Spyder IDE
(Interactive Development Environment). If you've ever worked with MATLAB
before, then this will feel familiar. Spyder is a program that allows
you to write, run and de-bug code.

\subsection{Launching Spyder}\label{launching-spyder}

Using Anaconda we will select the environment we created earlier
\emph{spyder-dev} and then we can launch spyder from the Home page.

\subsection{Spyder Interface}\label{spyder-interface}

\begin{figure}
\centering
\includegraphics{figures/spyder_interface.png}
\caption{Spyder Interface}
\end{figure}

Once you open up Spyder in it's default configuration, you'll see three
sections; the editor IPython Console, Help viewer. You can customize the
interface to suit your prefference and needs some of which include,
rearrange, undock, hide panes. Feel free to set up Spyder as you like.

\subsubsection{Editor}\label{editor}

This pane is used to write your scripts. The

\begin{figure}
\centering
\includegraphics{figures/editor_key_components.png}
\caption{Editor key components}
\end{figure}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
  The left sidebar shows line numbers and displays any code analysis
  warnings that exist in the current file. Clicking a line number
  selects the text on that line, and clicking to the right of it sets a
  \href{https://docs.spyder-ide.org/5/panes/debugging.html\#debugging-breakpoints}{breakpoint}.
\item
  The scrollbars allow vertical and horizontal navigation in a file.
\item
  The context (right-click) menu displays actions relevant to whatever
  was clicked.
\item
  The options menu (``Hamburger'' icon at top right) includes useful
  settings and actions relevant to the Editor.
\item
  The location bar at the top of the Editor pane shows the full path of
  the current file.
\item
  The tab bar displays the names of all opened files. It also has a
  Browse tabs button (at left) to show every open tab and switch between
  them---which comes in handy if many are open.
\end{enumerate}

\subsubsection{IPython Console}\label{ipython-console}

This pane allows you to interactively run functions, do math
computations, assign and modify variables.

\begin{figure}
\centering
\includegraphics{figures/spyder_ipython_console.png}
\caption{IPython Console}
\end{figure}

\begin{itemize}
\tightlist
\item
  Automatic code completion
\item
  Real-time function calltips
\item
  Full GUI integration with the enhanced Spyder
  \href{https://docs.spyder-ide.org/5/panes/debugging.html}{Debugger}.
\item
  The
  \href{https://docs.spyder-ide.org/5/panes/variableexplorer.html}{Variable
  Explorer}, with GUI-based editors for many built-in and third-party
  Python objects.
\item
  Display of Matplotlib graphics in Spyder's
  \href{https://docs.spyder-ide.org/5/panes/plots.html}{Plots} pane, if
  the Inline backend is selected under \texttt{Preferences}
  \textgreater{} \texttt{IPython\ console} \textgreater{}
  \texttt{Graphics} \textgreater{} \texttt{Graphics\ backend}, and
  inline in the console if Mute inline plotting is unchecked under the
  Plots pane's options menu.
\end{itemize}

\subsubsection{Variable Explorer}\label{variable-explorer}

This pane shows all the defined variables (objects) stored. This can be
used to identify the data type of variables, the size and inspect larger
arrays. Double clicking the value cell opens up a window which allowing
you to inspect the data in a spreadsheet like view.

\begin{figure}
\centering
\includegraphics{figures/spyder_variable_explorer.png}
\caption{Variable Explorer}
\end{figure}