forked from prappleizer/prappleizer.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
343 lines (313 loc) · 22.4 KB
/
index.html
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<!DOCTYPE HTML>
<!--
Editorial by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MN8CDW5');</script>
<!-- End Google Tag Manager -->
<title>Python for Astronomers</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
<!-- Global site tag (gtag.js) - Google Analytics -->
</head>
<body class="is-preload">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MN8CDW5"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<!-- Wrapper -->
<div id="wrapper">
<!-- Main -->
<div id="main">
<div class="inner">
<!-- Header -->
<header id="header">
<a href="index.html" class="logo"><strong>Python</strong> for Astronomers</a>
<ul class="icons">
<li><a href="#" class="icon brands fa-github"><span class="label">Github</span></a></li>
</ul>
</header>
<!-- Banner -->
<section id="banner">
<div class="content">
<span class="image right" height="400">
<a href='textbook.pdf' target='_blank'> <img src="img/mwcover.jpg" alt="A photo I took of the Milky Way in Maine" height="400" /> </a>
</span>
<header>
<h1>Python for<br />Astronomers</h1>
<p>A free textbook + interactive tutorials and guides for learning scientific computing</p>
<a href="https://zenodo.org/badge/latestdoi/66323956" target="_blank"><img src="https://zenodo.org/badge/66323956.svg" alt="DOI"></a>
</header>
<p></p>
<p>Welcome! You've reached the home of a collection of Python resources (and a textbook), aimed towards those just starting out with coding in an astrophysical research context (though there may be a few useful things below even for more experienced programmers).</p><p> The original inception of these materials was driven by the fact that I was tasked with teaching an introductory programming class to incoming astro majors at UC Berkeley. Looking around online, I found lots of great resources for learning basic Python, (and some advanced techniques for using python in astronomy) but no text which focused on the specific basic skills a student needs to pick up quickly to get up and running with research. So I wrote one! And I've since continued to add more and more tutorials and guides, usually in the form of Jupyter notebooks you can view in a browser or download and interact with. I hope you find this site useful, and I'm always open to feedback, input, requests, or clarifications. If there's something you'd like to see explained in a tutorial or guide, let me know with the suggestion form below. Cheers. </p><p>-Imad Pasha</p>
<p>If you'd like to support the creation of these resources, thank you! You can donate a few bucks over at <a href="https://ko-fi.com/imadpasha">My Ko-fi.</a></p>
<ul class="actions">
<li><a href="textbook.pdf" target="_blank" class="button big">Access the Textbook</a></li>
<li><a href="https://forms.gle/3X7gcwU8fb8kNLWa9" target="_blank" class="button big">Make a Suggestion</a></li>
</ul>
<h2>Updated Content: Revised Book Chapters</h2>
<p>As part of an effort to overhaul this textbook for an upcoming class, I'm releasing individual chapters of the new book on various subjects as I complete them! The Chapters below represent my newest, best coverage of said topic, and I hope they can be a useful addendum (and eventual replacement) of the textbook above.</p>
<ul class="actions">
<li><a href="Tutorials/FunctionalProgramming/FunctionalProgramming_web.html" target="_blank" class="button big">New Chapter! Functional Programming</a></li>
</ul>
<h2>New Resources: Astronomy 330 (Scientific Computing in Astrophysics)</h2>
<p>In Fall 2021, I taught a research/programming methods course at Yale University. This course is geared toward undergrads with basic python proficiency who are looking to prepare for research, or supplant their research skillbase. The lectures, labs, and solutions for this course are all open source and free to peruse; they live at <a href="http://Astro-330.github.io"target="_blank">Astro-330.github.io</a>.</p>
</div>
</section>
<!-- Section -->
<section>
<header class="major" id='tutorials'>
<h2>Interactive Tutorials</h2>
</header>
<div class="posts" >
<article>
<a href="Tutorials/Day1/first_day_tutorial_part_1.html" class="image"><img src="Tutorials/Day1/day1.png" alt="" /></a>
<h5>Tutorial | Easy</h5>
<h3>Python Bootcamp: Day 1</h3>
<p>We all have to start somewhere! Start with this bootcamp if you've never used Python before, and want a crash-course ride through the basics.</p>
<ul class="actions fit small">
<li><a href="Tutorials/Day1/first_day_tutorial_part_1.ipynb" target="_blank" class="button fit small">Tutorial (ipynb)</a></li>
<li><a href="Tutorials/Day1/first_day_tutorial_part_1.html" target="_blank" class="button fit small">Tutorial (html)</a></li>
</ul>
<ul class="actions fit small">
<li><a href="Tutorials/Day1/tutorial_first_day_solns.ipynb" target="_blank" class="button fit small">Solution (ipynb)</a></li>
<li><a href="Tutorials/Day1/tutorial_first_day_solns.html" target="_blank" class="button fit small">Solution (html)</a></li>
</ul>
</article>
<article>
<a href="Tutorials/Day1/day1_tutorial_part2.html" class="image"><img src="Tutorials/Day1/day2.png" alt="" /></a>
<h5>Tutorial | Easy</h5>
<h3>Python Bootcamp: Day 2</h3>
<p>A continuation of the Day 1 Bootcamp, here we use some of the concepts covered before and begin digging into Python as a language. You'll need to download <a href="Tutorials/Day1/quantum_mechanics.grades">this dataset</a>.</p>
<ul class="actions fit small">
<li><a href="Tutorials/Day1/day1_tutorial_part2.ipynb" target="_blank" class="button fit small">Tutorial (ipynb)</a></li>
<li><a href="Tutorials/Day1/day1_tutorial_part2.html" target="_blank" class="button fit small">Tutorial (html)</a></li>
</ul>
<ul class="actions fit small">
<li><a href="Tutorials/Day1/day1_tutorial_part2_soln.ipynb" target="_blank" class="button fit small">Solution (ipynb)</a></li>
<li><a href="Tutorials/Day1/day1_tutorial_part2_soln.html" target="_blank" class="button fit small">Solution (html)</a></li>
</ul>
</article>
<article>
<a href="Tutorials/Centroiding/centroiding_tutorial.html" class="image"><img src="Tutorials/Centroiding/centroiding.png" alt="" /></a>
<h5>Tutorial | Easy </h5>
<h3>Loops and Conditionals: Centroiding Spectra</h3>
<p>A basic task in astronomy is wavelength calibration -- and a basic coding practice is writing the for-loop, while-loop, and conditional statements. Let's practice! You'll need <a href="Tutorials/Centroiding/neon.txt">this dataset</a>. </p>
<ul class="actions fit small">
<li><a href="Tutorials/Centroiding/centroiding_tutorial.ipynb" target="_blank" class="button fit small">Tutorial (ipynb)</a></li>
<li><a href="Tutorials/Centroiding/centroiding_tutorial.html" target="_blank" class="button fit small">Tutorial (html)</a></li>
</ul>
<ul class="actions fit small">
<li><a href="Tutorials/Centroiding/Centroiding_solns.ipynb" target="_blank" class="button fit small">Solution (ipynb)</a></li>
<li><a href="Tutorials/Centroiding/Centroiding_solns.html" target="_blank" class="button fit small">Solution (html)</a></li>
</ul>
</article>
<article>
<a href="Tutorials/Linear_Regression/Linear_Regression.html" class="image"><img src="Tutorials/Linear_Regression/lin_reg.png" alt="" /></a>
<h5>Tutorial | Intermediate</h5>
<h3>Linear Regression: Fitting a line to data</h3>
<p>MUCH has been said on this topic; in fact, it can get (surprisingly) mind-bogglingly advanced. But for now, let's focus on the basics: How does one fit a line (or any polynomial) to some data in Python? And how do we know if our "fit" is any good? You'll need <a href='Tutorials/Linear_Regression/data.txt'>this dataset</a>. </p>
<ul class="actions fit small">
<li><a href="Tutorials/Linear_Regression/Linear_Regression.ipynb" target="_blank" class="button fit small">Tutorial (ipynb)</a></li>
<li><a href="Tutorials/Linear_Regression/Linear_Regression.html" target="_blank" class="button fit small">Tutorial (html)</a></li>
</ul>
<ul class="actions fit small">
<li><a href="Tutorials/Linear_Regression/Linear_Regression_Solution.ipynb" target="_blank" class="button fit small">Solution (ipynb)</a></li>
<li><a href="Tutorials/Linear_Regression/Linear_Regression_Solution.html" target="_blank" class="button fit small">Solution (html)</a></li>
</ul>
</article>
<article>
<a href="Tutorials/SDSS/sdss_tutorial.html" class="image"><img src="Tutorials/SDSS/sdss.png" alt="" /></a>
<h5>Tutorial | Intermediate</h5>
<h3>Data I/O: Working with SDSS Data</h3>
<p>I/O (input/output) refers to the task of getting data (in its various stored means) into our code to do analysis with. Here, we'll be reading in several catalogs from SDSS and combining them to learn something about galaxy scaling relations! Here's <a href="Tutorials/SDSS/SDSS_DR7.tar">The SDSS DR7 Catalog</a>.</p>
<ul class="actions fit small">
<li><a href="Tutorials/SDSS/sdss_tutorial.ipynb" target="_blank" class="button fit small">Tutorial (ipynb)</a></li>
<li><a href="Tutorials/SDSS/sdss_tutorial.html" target="_blank" class="button fit small">Tutorial (html)</a></li>
</ul>
<ul class="actions fit small">
<li><a href="Tutorials/SDSS/sdss_tutorial_solns.ipynb" target="_blank" class="button fit small">Solution (ipynb)</a></li>
<li><a href="Tutorials/SDSS/sdss_tutorial_solns.html" target="_blank" class="button fit small">Solution (html)</a></li>
</ul>
</article>
<article>
<a href="Tutorials/MCMC/MCMC_Tutorial.html" class="image"><img src="Tutorials/MCMC/mcmc.png" alt="" /></a>
<h5>Tutorial | Intermediate</h5>
<h3>Markov Chain Monte Carlo: An Introduction using Ice Core Data</h3>
<p>MCMC is a powerful tool for many aspects of astronomy. In this tutorial, we'll cover when one might want to use an MCMC, and then setup and run one on some historical ice core data to fit the Earth's Milankovich Cycles! Here's the <a href='Tutorials/MCMC/ice_core_data.txt'>Ice Core Data File</a>.</p>
<ul class="actions fit small">
<li><a href="Tutorials/MCMC/MCMC_Tutorial.html" target="_blank" class="button fit small">Tutorial (html)</a></li>
<li><a href="Tutorials/MCMC/MCMC_Tutorial_Solution.html" target="_blank" class="button fit small">Solution (html)</a></li>
</ul>
</article>
<article>
<a href="Tutorials/RK4/RK4_Tutorial.html" class="image"><img src="Tutorials/RK4/icon.png" alt="" /></a>
<h5>Tutorial | Intermediate - Advanced</h5>
<h3>Building an RK4 Orbit Integrator <br> Part 1 of 2</h3>
<p>In this tutorial, I cover the classic N-body orbit integration problem in detail, showing you how to use classes and a 4th order integrator.</p>
<ul class="actions fit small">
<li><a href="Tutorials/RK4/RK4_Tutorial.html" target="_blank" class="button fit small">Tutorial (html)</a></li>
<li><a href="Tutorials/RK4/RK4_Tutorial_Solutions.html" target="_blank" class="button fit small">Solution (html)</a></li>
</ul>
</article>
<article>
<a href="" class="image"><img src="Tutorials/RK4/icon2.png" alt="" /></a>
<h5>Tutorial | Intermediate - Advanced</h5>
<h3>Building an RK4 Orbit Integrator <br> Part 2 of 2</h3>
<p>In Part 2, we adjust our RK4 orbital N-body integrator from last tutorial to integrate particles in potentials as well. </p>
<ul class="actions fit small">
<li><a href="" target="_blank" class="button fit small">Coming Soon</a></li>
<li><a href="" target="_blank" class="button fit small">Coming Soon</a></li>
</ul>
</article>
<article>
<a href="" class="image"><img src="Tutorials/MetropolisHastings/pi_more_samples.png" alt="" /></a>
<h5>Tutorial | Intermediate</h5>
<h3>Writing a Metropolis-Hastings Sampler</h3>
<p>In this tutorial we learn some of the statistics underlying MCMC and then write our own sampler using classes! </p>
<ul class="actions fit small">
<li><a href="Tutorials/MetropolisHastings/MetropolisHastings_Tutorial.html" target="_blank" class="button fit small">Tutorial</a></li>
<li><a href="" target="_blank" class="button fit small">Solns: Coming Soon</a></li>
</ul>
</article>
</div>
</section>
<section>
<header class="major" id='guides'>
<h2>Python Guides</h2>
</header>
<div class="posts">
<article>
<a href="Tutorials/Ploting/Plotting.html" target="_blank" class="image"><img src="Tutorials/Plotting/plotting.png" alt="" /></a>
<h5>Guide</h5>
<h3>Intermediate matplotlib: Towards Publication-Ready Plots</h3>
<p>The easiest way to start plotting things in Python (plt.plot) is just not good enough to make real research grade plots. Here, I'll talk about the first steps you'll want to take in controlling every detail of your figures.</p>
<ul class="actions fit small">
<li><a href="Tutorials/Plotting/Plotting.html" class="button fit small">Open Guide (HTML)</a></li>
<li><a href="Tutorials/Plotting/Plotting.ipynb" class="button fit small">Download Guide (IPYNB)</a></li>
</ul>
</article>
<article>
<a href="Tutorials/OOP/OOP_and_Classes.html" target="_blank" class="image"><img src="Tutorials/OOP/oop.png" alt="" /></a>
<h5>Guide</h5>
<h3>Object Oriented Python: Building a Pipeline</h3>
<p>Python is inherently an "object-oriented" language -- often, we don't have to write our codes that way, but it can actually make things better sometimes! Here, I'll attempt to explain why classes are useful, via the example of a data reduction pipeline.</p>
<ul class="actions fit">
<li><a href="Tutorials/OOP/OOP_and_classes.html" target="_blank" class="button fit">Open Guide (HTML)</a></li>
</ul>
</article>
</div>
</section>
<!-- Section -->
<section>
<header class="major" id='license'>
<h2>License and Usage</h2>
</header>
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dct:title" rel="dct:type">Python for Astronomers: An Introduction to Scientific Computing</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://prappleizer.github.io" property="cc:attributionName" rel="cc:attributionURL">Imad Pasha & Christopher Agostino</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>
<p></p>
<p>What does all that mean?</p>
<div class="features">
<article>
<span class="icon solid fa-download"></span>
<div class="content">
<h3>Personal Use</h3>
<p>You are always free to download, keep, and reference any of the materials posted here for your own personal use. </p>
</div>
</article>
<article>
<span class="icon solid fa-edit"></span>
<div class="content">
<h3>Modification</h3>
<p>You are free to modify and/or use any aspect of these materials in your own teaching, as long as you cite this website as a source -- I even have a DOI to make it handy (see below)! You are not allowed to use re-mixed or re-purposed versions of these materials for any commerical purpose. If you make modified versions of these materials available for free, you must do so under the this license.</p>
</div>
</article>
<article>
<span class="icon solid fa-share-alt"></span>
<div class="content">
<h3>Sharing and Dissemination</h3>
<p>Feel free to share the textbook / materials with anyone who'd find them useful! I recommend sharing links rather than downloaded versions, as I update things regularly. You are not allowed to sell or otherwise use these materials for any commercial purpose, even with attribution.</p>
</div>
</article>
<article>
<span class="icon solid fa-balance-scale-right"></span>
<div class="content">
<h3>Citing Usage</h3>
<p>If you use or modify and use materials from this site, please just cite us using our DOI: <a href="https://zenodo.org/badge/latestdoi/66323956"><img src="https://zenodo.org/badge/66323956.svg" alt="DOI"></a> </p>
</div>
</article>
</div>
</section>
</div>
</div>
<!-- Sidebar -->
<div id="sidebar">
<div class="inner">
<!-- Search -->
<section id="search" class="alt">
<form method="post" action="#">
<input type="text" name="query" id="query" placeholder="Search" />
</form>
</section>
<!-- Menu -->
<nav id="menu">
<header class="major">
<h2>Menu</h2>
</header>
<ul>
<li><a href="index.html">Homepage</a></li>
<li><a href="textbook.pdf" target='_blank'>Textbook</a></li>
<li><a href="#tutorials">Tutorials</a></li>
<li><a href="#guides">Guides</a></li>
<li>
<span class="opener">Other Resources</span>
<ul>
<li><a href="vim_guide.pdf" target="_blank">VIM Cheat Sheet</a></li>
<li><a href="unix_full.pdf" target="_blank">UNIX Cheat Sheet</a></li>
</ul>
</li>
<li><a href="advice.html">NSF/Grad App Advice</a></li>
<li><a href="https://forms.gle/3X7gcwU8fb8kNLWa9" target="_blank">Suggestions and Comments</a></li>
<li><a href="#license">License and Usage</a></li>
</ul>
</nav>
<!-- Section -->
<section>
<header class="major">
<h2>About Me</h2>
</header>
<p>I am now a graduate student at Yale University. Despite no longer teaching the Berkeley intro astro computing course, I still like to update my textbook and tutorials, and am always open to input and feedback!</p>
<p>You can learn more about my research at my personal website: <a href="http://www.astro.yale.edu/ipasha" target='_blank'>www.astro.yale.edu/ipasha</a><br />and you can contact me at the links below.</p>
<p>If you'd like to support the creation of these resources, thank you! You can donate a few bucks over at <a href="https://ko-fi.com/imadpasha">My Ko-fi.</a></p>
<ul class="contact">
<li class="icon brands fa-github"><a href="http://github.com/prappleizer" target="_blank">github.com/prappleizer</a></li>
<li class="icon solid fa-envelope"><a href="mailto:[email protected]">imad.pasha[at]yale.edu</a></li>
<li class="icon solid fa-home">52 Hillhouse Ave<br />
Steinbach Hall<br />New Haven, CT 06511</li>
</ul>
</section>
<!-- Footer -->
<footer id="footer">
<a span rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dct:title" rel="dct:type">Python for Astronomers: An Introduction to Scientific Computing</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://prappleizer.github.io" property="cc:attributionName" rel="cc:attributionURL">Imad Pasha & Christopher Agostino</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.
<p></p>
<p class="copyright">© Imad Pasha 2019. All rights reserved.<br />Design: <a href="https://html5up.net">HTML5 UP</a>.</p>
</footer>
</div>
</div>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>