Astronomical Python :an introduction to modern scientific programming /
"Version: 20240501"--Title page verso.Includes bibliographical references.1. Introduction -- 1.1. How to use this book? -- 1.2. Data availabilitypart I. Unix and basic Python. 2. Essential Unix skills -- 2.1. Operating systems -- 2.2. Anatomy of the terminal -- 2.3. Common UNIX commands -- 2.4. Cancelling commands -- 2.5. Tab complete -- 2.6. Intermediate shell commands -- 2.7. SSH and servers -- 2.8. Profiles -- 2.9. Summary3. Installing Python and the astronomy stack -- 3.1. Prerequisites -- 3.2. Python environments -- 3.3. Editors -- 3.4. Summary4. Introduction to Python -- 4.1. Variables -- 4.2. Importing external libraries -- 4.3. Comments -- 4.4. Data types -- 4.5. Indexing -- 4.6. Slicing -- 4.7. Operations -- 4.8. Reserved words -- 4.9. Filtering and masking -- 4.10. Conditional statements -- 4.11. Loops and iterators -- 4.12. Cancelling code execution -- 4.13. Shell and shell-like commands in Python -- 4.14. Interpreting error messages -- 4.15. Handling exceptions -- 4.16. Summarypart II. Core research libraries. 5. Visualization with Matplotlib -- 5.1. Introduction -- 5.2. A simple plot -- 5.3. Figures and axes -- 5.4. Subplots -- 5.5. Adjusting marker properties -- 5.6. Adjusting ticks -- 5.7. Adjusting fonts and fontsizes -- 5.8. Multiple subplots -- 5.9. Subplot mosaic -- 5.10. Research example : displaying a best fit -- 5.11. Errorbars -- 5.12. Plotting n-dimensional data -- 5.13. Colorbars -- 5.14. Summary6. Numpy -- 6.1. Introduction -- 6.2. The array -- 6.3. Precision -- 6.4. Key library functions -- 6.5. Research example : an exoplanet transit -- 6.6. Summary7. SciPy -- 7.1. Introduction -- 7.2. Numerical integration -- 7.3. Optimization -- 7.4. Statistics -- 7.5. Summary8. Astropy and associated packages -- 8.1. Introduction -- 8.2. Units and constants -- 8.3. Cosmological calculations -- 8.4. Coordinates -- 8.5. Astroquery -- 8.6. Research example : automatic offsets -- 8.7. Research example : handling astronomical images -- 8.8. Summarypart III. Intermediate applications and patterns. 9. Functions and functional programming -- 9.1. Introduction -- 9.2. Defining functions -- 9.3. Writing documentation -- 9.4. Checking function inputs -- 9.5. Local scope and global scope -- 9.6. Chaining functions together -- 9.7. The concept of main() -- 9.8. Keyword (optional) arguments -- 9.9. Packing and unpacking function arguments -- 9.10. Testing function outputs : unit testing -- 9.11. Type-hinting -- 9.12. Summary10. Classes and object oriented programming -- 10.1. Introduction -- 10.2. Defining classes -- 10.3. Setters and getters -- 10.4. Representation -- 10.5. Subclasses (and superclasses) -- 10.6. Static methods -- 10.7. Abstract base classes -- 10.8. Summary11. Data science with astronomical catalogs -- 11.1. Introduction -- 11.2. Filetypes and reading in data -- 11.3. Working with tabular data in pandas -- 11.4. Research example : analysis with 3DHST -- 11.5. Summary12. Vectorization and runtime improvements -- 12.1. Introduction -- 12.2. Identifying bottlenecks -- 12.3. Fast array operations with Numpy -- 12.4. Jax -- 12.5. Summary13. Astronomical inference -- 13.1. Introduction -- 13.2. Fitting a line to data -- 13.3. X 2 fitting -- 13.4. Bayesian inference -- 13.5. Summary14. Software development -- 14.1. Introduction -- 14.2. Why (and when) to make a Python package a Python package -- 14.3. Organizing packages : modules and submodules -- 14.4. Custom exceptions and warnings -- 14.5. Installation and development -- 14.6. Github and version control -- 14.7. Summary15. Concluding remarks -- 15.1. Concluding remarks.Full-text restricted to subscribers or individual document purchasers.Over the past two decades, Python has become the de facto standard language of data science both in industry and astronomy (with the exception of simulations and other extreme scale computing problems). This course text is a full introduction to programming in Python with an explicit focus on astrophysical applications. The book covers the fundamentals of Python, including the native data types and operations, and how the language, interpreter, and operating system work together. Leaning heavily on standard packages used in astronomy, the book covers the installation and basic structure of the language and libraries; script writing, conditional statements, loops, and other code structures that allow for complex outcome management; the creation and use of functions and classes within Python; the creation of packages and the methods for re-using, importing, and otherwise standardizing code; and plotting. Finally, the book contains several higher level chapters that carry students from the beginner stage of programming into the intermediate.Undergraduate astrophysics-track students.Also available in print.Mode of access: World Wide Web.System requirements: Adobe Acrobat Reader, EPUB reader, or Kindle reader.Imad Pasha is an NSF Graduate Research Fellow and PhD candidate at Yale University. Before Yale, he earned Bachelors degrees in Physics and Astrophysics from University of California, Berkeley, as well as a minor in Creative Writing. He worked as a reporter, senior editor, and photographer at The Daily Californian, the newspaper of record in Berkeley, CA. At Yale, his research has focused broadly on the processes driving galaxy evolution. He is interested in particular in how gas is accreted onto galaxies from the cosmic web, processed into stars, and (partially) expelled back out into the intergalactic medium, to be potentially later re-accreted.Title from PDF title page (viewed on June 1, 2024).
No copy data
No other version available