Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
joao committed Sep 6, 2024
1 parent 3937a5b commit 399fd02
Show file tree
Hide file tree
Showing 17 changed files with 733 additions and 1,399 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ee8a1eaf
d6e4fb9b
13 changes: 0 additions & 13 deletions howtos/submitPS.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,19 +334,6 @@ <h1 class="title">Problem Set Submissions</h1>
</header>


<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
These requirements are still being finalized. Do not rely on this material yet.
</div>
</div>
<div class="callout-body-container callout-body">

</div>
</div>
<section id="submission-format" class="level2">
<h2 class="anchored" data-anchor-id="submission-format">Submission format</h2>
<p>Problem set solutions should be written in Quarto Markdown (.qmd) source files, interspersing explanatory text with Python (and in some cases bash) code chunks. Please do not use Jupyter notebook (.ipynb) files as your underlying source file for your solutions. In some cases we will ask that you put function definitions for more complicated functions into one or more Python code (.py) file(s) and show us the code in the appendix of your main solution file by using <code>inspect.getsource()</code>.</p>
Expand Down
Binary file modified labs/lab0-setup.pdf
Binary file not shown.
149 changes: 122 additions & 27 deletions data.html → labs/lab1-submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

<meta name="dcterms.date" content="2023-08-21">

<title>Data</title>
<title>Lab 1: Submitting problem set solutions</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
Expand All @@ -23,22 +24,22 @@
</style>


<script src="site_libs/quarto-nav/quarto-nav.js"></script>
<script src="site_libs/quarto-nav/headroom.min.js"></script>
<script src="site_libs/clipboard/clipboard.min.js"></script>
<script src="site_libs/quarto-search/autocomplete.umd.js"></script>
<script src="site_libs/quarto-search/fuse.min.js"></script>
<script src="site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="./">
<script src="site_libs/quarto-html/quarto.js"></script>
<script src="site_libs/quarto-html/popper.min.js"></script>
<script src="site_libs/quarto-html/tippy.umd.min.js"></script>
<script src="site_libs/quarto-html/anchor.min.js"></script>
<link href="site_libs/quarto-html/tippy.css" rel="stylesheet">
<link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="site_libs/bootstrap/bootstrap.min.js"></script>
<link href="site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script src="../site_libs/quarto-nav/quarto-nav.js"></script>
<script src="../site_libs/quarto-nav/headroom.min.js"></script>
<script src="../site_libs/clipboard/clipboard.min.js"></script>
<script src="../site_libs/quarto-search/autocomplete.umd.js"></script>
<script src="../site_libs/quarto-search/fuse.min.js"></script>
<script src="../site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="../">
<script src="../site_libs/quarto-html/quarto.js"></script>
<script src="../site_libs/quarto-html/popper.min.js"></script>
<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
<script src="../site_libs/quarto-html/anchor.min.js"></script>
<link href="../site_libs/quarto-html/tippy.css" rel="stylesheet">
<link href="../site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="../site_libs/bootstrap/bootstrap.min.js"></script>
<link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="../site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script id="quarto-search-options" type="application/json">{
"location": "sidebar",
"copy-button": false,
Expand Down Expand Up @@ -68,7 +69,8 @@
}</script>


<link rel="stylesheet" href="assets/styles.css">
<link rel="stylesheet" href="../assets/styles.css">
<link rel="stylesheet" href="../styles.css">
</head>

<body>
Expand All @@ -83,24 +85,36 @@
<h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#data-1" id="toc-data-1" class="nav-link active" data-scroll-target="#data-1">Data 1</a></li>
<li><a href="#data-2" id="toc-data-2" class="nav-link" data-scroll-target="#data-2">Data 2</a></li>
<li><a href="#submitting-problem-set-solutions-090624" id="toc-submitting-problem-set-solutions-090624" class="nav-link active" data-scroll-target="#submitting-problem-set-solutions-090624">Submitting problem set solutions (09/06/24)</a></li>
<li><a href="#quick-intro-to-git-and-github" id="toc-quick-intro-to-git-and-github" class="nav-link" data-scroll-target="#quick-intro-to-git-and-github">Quick Intro to git and GitHub</a></li>
<li><a href="#lab-submission" id="toc-lab-submission" class="nav-link" data-scroll-target="#lab-submission">Lab Submission</a></li>
<li><a href="#hands-on-lab-instructions---steps" id="toc-hands-on-lab-instructions---steps" class="nav-link" data-scroll-target="#hands-on-lab-instructions---steps">Hands-on Lab Instructions - Steps</a>
<ul class="collapse">
<li><a href="#chunk-options" id="toc-chunk-options" class="nav-link" data-scroll-target="#chunk-options">Chunk options</a></li>
<li><a href="#troubleshooting" id="toc-troubleshooting" class="nav-link" data-scroll-target="#troubleshooting">Troubleshooting</a></li>
</ul></li>
</ul>
</nav>
<div class="quarto-alternate-formats"><h2>Other Formats</h2><ul><li><a href="lab1-submission.pdf"><i class="bi bi-file-pdf"></i>PDF</a></li></ul></div></nav>
</div>
<!-- main -->
<main class="content" id="quarto-document-content">

<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">Data</h1>
<h1 class="title">Lab 1: Submitting problem set solutions</h1>
</div>



<div class="quarto-title-meta">


<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">August 21, 2023</p>
</div>
</div>


</div>
Expand All @@ -110,14 +124,95 @@ <h1 class="title">Data</h1>
</header>


<p>We’ll use data from several real world situations in class.</p>
<section id="data-1" class="level2">
<h2 class="anchored" data-anchor-id="data-1">Data 1</h2>
<section id="submitting-problem-set-solutions-090624" class="level2">
<h2 class="anchored" data-anchor-id="submitting-problem-set-solutions-090624">Submitting problem set solutions (09/06/24)</h2>
<p>By now you should already have access to the following 5 basic tools:</p>
<ol type="1">
<li><a href="../howtos/accessingUnixCommandLine.md">Unix shell</a></li>
<li><a href="../howtos/gitInstall.md">Git</a></li>
<li><a href="../howtos/quartoInstall.md">Quarto</a></li>
<li><a href="../howtos/accessingPython.md">Python</a></li>
<li>A text editor of your choice</li>
</ol>
<p>Today we will use all these tools together to submit a solution for Problem Set 0 (not a real problem set) to make sure you know how to submit solutions to upcoming (real) problem sets.</p>
<p>Here is a selection of some basic reference tutorials and documentation for <a href="https://berkeley-scf.github.io/tutorial-unix-basics/">unix</a>, <a href="https://berkeley-scf.github.io/tutorial-using-bash/">bash</a> and <a href="https://www.unixtutorial.org/basic-unix-commands">unix commands</a>, <a href="https://htmlpreview.github.io/?https://github.com/berkeley-scf/tutorial-git-basics/blob/master/git-intro.html">git &amp; GitHub</a>, <a href="https://quarto.org/docs/get-started/hello/text-editor.html">quarto</a>, <a href="https://docs.python.org/3/tutorial/index.html">python</a> and <a href="https://code.visualstudio.com/docs">VS Code</a></p>
<p>Some books to <a href="https://www.amazon.com/Learning-UNIX-Operating-System-Fifth/dp/0596002610/">learn</a> <a href="https://www.amazon.com/Unix-Nutshell-Fourth-Arnold-Robbins/dp/0596100299">more</a> about <a href="https://www.amazon.com/Unix-Programming-Environment-Prentice-Hall-Software/dp/013937681X">Unix</a>.</p>
</section>
<section id="quick-intro-to-git-and-github" class="level2">
<h2 class="anchored" data-anchor-id="quick-intro-to-git-and-github">Quick Intro to <a href="https://htmlpreview.github.io/?https://github.com/berkeley-scf/tutorial-git-basics/blob/master/git-intro.html">git and GitHub</a></h2>
<ol start="0" type="1">
<li>Creating a enw repository</li>
<li>Making changes</li>
</ol>
<ul>
<li>Editing and saving files</li>
<li>Staging changes</li>
<li>Committing changes locally</li>
<li>Pushing changes to remote repository</li>
</ul>
<ol start="2" type="1">
<li>Undoing changes:</li>
</ol>
<ul>
<li>Local changes</li>
<li>Local staged changes</li>
<li>Local commited changes</li>
<li>Pushed changes</li>
</ul>
<ol start="3" type="1">
<li>Merging divergent versions</li>
<li>Working with branches</li>
<li>GUI options (<a href="https://www.sourcetreeapp.com/">sourcetree</a>)</li>
<li>Getting help</li>
</ol>
<p><strong>Discussion:</strong> - Why is git so damn complicated? - What do you need to remember when working with collaborators on the same repository?</p>
</section>
<section id="lab-submission" class="level2">
<h2 class="anchored" data-anchor-id="lab-submission">Lab Submission</h2>
<p>Refer to <a href="../howtos/submitPS.html">this guide</a> and please ask questions if something is not clear.</p>
</section>
<section id="hands-on-lab-instructions---steps" class="level2">
<h2 class="anchored" data-anchor-id="hands-on-lab-instructions---steps">Hands-on Lab Instructions - Steps</h2>
<ol start="0" type="1">
<li>Clone your github repository to your development environment</li>
<li>Create a subdirectory in your github repository with the name ps0</li>
<li>In that subdirectory, create a quarto document (ps0.qmd) that has some simple code that creates a simple plot (you can follow this example/tutorial <a href="https://quarto.org/docs/get-started/hello/text-editor.html">here</a>)</li>
<li>Use the quarto command line to render it into a pdf document (quarto render FILE –to pdf)</li>
<li>Commit the changes to your repository (git add FILES; git commit -m MESSAGE; git push)</li>
<li>Add another section to your quarto document (use your imagination), then preview and commit the changes</li>
<li>Use the quarto command line to render the updated document into a pdf document</li>
<li>Add the pdf document to the repository as well</li>
<li>Make sure that you can log into <a href="https://www.gradescope.com/">gradescope</a> and upload a pdf document</li>
<li>[optional] Undo your last set of changes and regenerate the pdf file</li>
</ol>
<p>If we finish early, We will also take today’s lab as an opportunity to get familiar with the basic use of all the 5 basic tools listed above.</p>
<p>For git and quarto, very basic knowledge should be sufficient for now, but for unix commands and python, the more you learn the more effective you will be at solving the problem sets (and at any computational task you take on after that). You will need to learn more advanced use of git and github towards the end of the semester when you start working with other team members on the same project.</p>
<section id="chunk-options" class="level3">
<h3 class="anchored" data-anchor-id="chunk-options">Chunk options</h3>
<p>Like RMarkdown, quarto allows for several <a href="https://quarto.org/docs/computations/execution-options.html">execution options</a> to be set per document and per chunk. Spend some time getting familiar with the various options, and keep this link handy when you are working on the first few problem sets.</p>
<p>Depending on what’s required in the problem sets, you may need to set <strong>eval to false</strong> (just print out code) or <strong>error to true</strong> (print errors and don’t halt rendering of the document). Some of the other options may be useful for controlling how the code gets printed.</p>
</section>
<section id="data-2" class="level2">
<h2 class="anchored" data-anchor-id="data-2">Data 2</h2>
<section id="troubleshooting" class="level3">
<h3 class="anchored" data-anchor-id="troubleshooting">Troubleshooting</h3>
<section id="quarto-succeeds-in-rendering-html-but-fails-at-rendering-pdf" class="level5">
<h5 class="anchored" data-anchor-id="quarto-succeeds-in-rendering-html-but-fails-at-rendering-pdf">Quarto succeeds in rendering html but fails at rendering pdf</h5>
<p>Install tinytex via <code>quarto install tinytex</code></p>
</section>
<section id="problems-running-and-rendering-bash-commands-in-quarto" class="level5">
<h5 class="anchored" data-anchor-id="problems-running-and-rendering-bash-commands-in-quarto">Problems running and rendering bash commands in quarto</h5>
<p>If you are using the knitr engine, you should be able to tag your code chunks in quarto with <code>{bash}</code> and use verbatim bash commands. If you are using the Jupyter engine, the <code>{python}</code> tag should be used instead and every line containing a bash command should be prefixed with an exclamation mark (!).</p>
</section>
<section id="quarto-rendering-or-python-execution-works-from-the-terminal-but-not-from-the-ide" class="level5">
<h5 class="anchored" data-anchor-id="quarto-rendering-or-python-execution-works-from-the-terminal-but-not-from-the-ide">Quarto rendering (or python execution) works from the terminal but not from the IDE</h5>
<p>You can go to the settings in your IDE and point it to the specific python installation that you find when you execute which python in the terminal.</p>
</section>
<section id="quarto-rendering-or-python-execution-works-from-the-ide-but-not-from-the-terminal" class="level5">
<h5 class="anchored" data-anchor-id="quarto-rendering-or-python-execution-works-from-the-ide-but-not-from-the-terminal">Quarto rendering (or python execution) works from the IDE but not from the terminal</h5>
<p>you can fix the quarto configuration by setting the environment variable <code>QUARTO_PYTHON</code> to the correct python path or by running <code>quarto check</code>. Restarting the IDE may also help if you had just installed something in the other environment.</p>


</section>
</section>
</section>

</main> <!-- /main -->
Expand Down
Binary file added labs/lab1-submission.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions ps/ps1.html
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ <h2 class="anchored" data-anchor-id="problems">Problems</h2>
<ol type="a">
<li><p>Generate a numpy array (named <code>x</code>) of random numbers from a standard normal distribution with 20 columns and as many rows as needed so that the data take up about 16 MB (megabytes) in size. As part of your answer, show the arithmetic (formatted using LaTeX math syntax) you did to determine the number of rows.</p></li>
<li><p>Explain the sizes of the two files created below. In discussing the CSV text file, how many characters do you expect to be in the file (i.e., you should be able to estimate this reasonably accurately from first principles without using <code>wc</code> or any explicit program that counts characters). Hint: what do we know about numbers drawn from a standard normal distribution?</p>
<div id="29ca7484" class="cell" data-execution_count="2">
<div id="dc82915c" class="cell" data-execution_count="2">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> os</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> pandas <span class="im">as</span> pd</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>x <span class="op">=</span> x.<span class="bu">round</span>(decimals <span class="op">=</span> <span class="dv">12</span>)</span>
Expand All @@ -358,7 +358,7 @@ <h2 class="anchored" data-anchor-id="problems">Problems</h2>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>pd.DataFrame(x).to_pickle(<span class="st">'x.pkl'</span>, compression <span class="op">=</span> <span class="va">None</span>) </span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(<span class="ss">f"</span><span class="sc">{</span><span class="bu">str</span>(os.path.getsize(<span class="st">'x.pkl'</span>)<span class="op">/</span><span class="fl">1e6</span>)<span class="sc">}</span><span class="ss"> MB"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>30.777135 MB
<pre><code>30.778352 MB
16.000572 MB</code></pre>
</div>
</div>
Expand Down
Binary file modified ps/ps1.pdf
Binary file not shown.
Loading

0 comments on commit 399fd02

Please sign in to comment.