Pioneer21/Summaries

From PrattWiki
Revision as of 02:31, 12 July 2021 by DukeEgr93 (talk | contribs)
Jump to navigation Jump to search

This page will provide lecture summaries for the Pioneer Academics Summer 2021 course on Python and Image Processing.

Lecture 01 - 7/11/2021

  • Introductions
  • Overleaf Document Preparation System
    • Once you have your account, you can go to the Learn LaTeX in 30 minutes tutorial on Overleaf!
    • Free document preparation system using $$\LaTeX$$
    • Website: https://www.overleaf.com; sign up for a free account
    • To create the sample document:
      • Create a new blank project in Overleaf and call it whatever you would like (I called mine PioneerDemo); this will move that tab to the project page with a "main.tex" document
      • Open another tab and get the demonstration files in a zip file either on Schoology->.Session 01 Items->Sample LaTeX Docs->PioneerDemo.zip or on the Box drive in the Session 01 LaTeX folder
      • Expand the zip file to get three files: main.tex, MakeSample.py, and SamplePyplot.png
      • Go back to the Overleaf tab for your project.
      • Click the upload icon (third one from the left under the Menu icon at the top left of the screen)
      • Drag the three files into the window or select them. When Overleaf asks if you want to overwrite the main.tex, select Overwrite to replace the default with the sample.
      • On the right-half of the Overleaf window, click the Recompile button to see the sample file
    • The document infrastructure will always be provided; this includes something similar to the following:
      \documentclass{article}
      \usepackage{amsmath}    % loads AMS-Math package
      \usepackage{graphicx}   % bring in graphics
      \usepackage{listings}   % allows lstlisting environment
      \usepackage{hyperref}   % web page links
      \usepackage[letterpaper, margin=1.0in]{geometry}  % set paper size/margins
      \begin{document}
      \begin{center}
      \rule{6.5in}{0.5mm}\\~\\
      \textbf{\large Pioneer - Summer 2021}\\~\\
      \textbf{\huge TITLE}\\~\\
      NAME\\
      \rule{6.5in}{0.5mm}\\
      \end{center}
      \tableofcontents
      \listoffigures
      
      \pagebreak
      % Repeat as needed
      \section{SECTION ONE}
      Stuff
      
      \pagebreak
      \appendix
      \section{Code}
      % Repeat as needed - uncomment the lstinputlisting lines when the codes exists
      \subsection{CODE DESCRIPTION 1}
      %%%\lstinputlisting[language=Python]{code1.py}
      
      \pagebreak
      \section{Figures \label{FigureList}}
      % Repeat as needed - uncomment the lstinputlisting lines when the graphs exists
      \begin{figure}[!h]
      \begin{center}
      %%%\includegraphics[width=5in]{figure1.png}
      \caption{FIGURE 1 CAPTION.}
      \end{center}
      \end{figure}
      \pagebreak
      
      
      \addcontentsline{toc}{section}{References}
      \begin{thebibliography}{9}
      % Repeat as needed
      \bibitem{REFCODE1}
      REFERENCE 1
      \end{thebibliography}
      
      \end{document}
      
    • Some commands from the demonstration document:
      • Document divisions
        • Use \section{NAME} and \subsection{NAME} to divide your document
      • Text styles and sizes - for more info see https://www.overleaf.com/learn/latex/Font_sizes,_families,_and_styles
        • Text can be made bold, italics, or typewriter font with \textbf{WORDS}, \textit{WORDS}, or \texttt{WORDS}
        • Text can be made large or huge with {\large WORDS} or {\huge WORDS}; there are other sizes available
      • Use \begin{center} ... \end{center} to center items such as text, figures, and tables
      • Use $ ... $ to put math-mode items in a sentence - for instance "The hypotenuse $$c$$ or a right triangle with sides $$a$$ and $$b$$ is $$c=\sqrt{a^2+b^2}$$" which was produced by the code The hypotenuse $c$ or a right triangle with sides $a$ and $b$ is $c=\sqrt{a^2+b^2}$. (Note: on Pundit, getting into math mode requires to dollar signs instead of one).
      • Use \begin{align} ... \end{align} for a series of numbered, formal equations and \begin{align} ... \end{align} for a series of unnumbered, formal equations. For example: $$ \begin{align} \begin{bmatrix} A \end{bmatrix} &= \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}\\ D &= \begin{vmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{vmatrix} =a_{11}a_{22}-a_{12}a_{21} \end{align} $$ which was created with
        \begin{align}
        \begin{bmatrix} A \end{bmatrix} &=
        \begin{bmatrix} 
        a_{11} & a_{12} \\
        a_{21} & a_{22}
        \end{bmatrix}\\
        D &= 
        \begin{vmatrix}
        a_{11} & a_{12} \\
        a_{21} & a_{22}
        \end{vmatrix}
        =a_{11}a_{22}-a_{12}a_{21}
        \end{align}
        
      • Superscripts and subscripts are in math mode; if the superscript or subscript is more than one character, the superscript or subscript needs to be enclosed in curly brackets.
      • If you are unsure of the command for a specific symbol, Detexify can be a real help!
      • Some math terms should be in regular type versus italics in math mode; they have command versions like \max. Otherwise, if you need regular text in math mode, use \mbox{WORDS}
      • $$\LaTeX$$ can import text files using \lstinputlisting[OPTION]{FILE} where the main option is to set the language; for example:
        \lstinputlisting[language=Python]{MakeSample.py}
        
      • $$\LaTeX$$ can also import graphics files using \includegraphics[OPTION]{file} where the main option is to set the width or height of the imagel for example:
        \includegraphics[width=5in]{SamplePyplot.png}
        
  • Anaconda and Python
    • Website: Anaconda; download the appropriate version for your operating system.
    • Long way to open Spyder is to start Anaconda Navigator and launch Spyder from there; shortcut on Windows is to go to Start -> Anaconda -> Spyder