< All Topics

Learning Python to help with Muk3D script development

Before you dive into writing scripts, its good to get a decent understanding of the basics of the Python language.

Rather than rehash tutorials that are scattered all around the web, we’ve linked to a few resources here that you can explore. Since Python is widely used for all sorts of applications, some of the online tutorials aren’t really helpful for writing Python code for scientific applications. To this end, it might be necessary to draw knowledge from a range of sources to cover what you’re looking to learn.

What you need to know

Understanding Python Syntax and Basics

Learn the fundamental syntax, data types, control structures (loops and conditionals), and basic concepts like functions and classes.

Understanding Data Structures

Gain knowledge of fundamental data structures (lists, dictionaries, sets, etc.).

Working with Libraries and Modules

Familiarize yourself with Python’s standard library and commonly used third-party libraries for various tasks such as data manipulation (e.g., NumPy, Pandas), and plotting (Matplotlib).

Debugging and Troubleshooting

Learn how to debug Python code effectively using tools like print statements, logging, and debugging tools provided by integrated development environments (IDEs).

Documentation and Code Comments

Practice writing clear and concise documentation for your code, including comments within the code itself to explain its functionality, assumptions, and usage.

Problem-solving using Python Libraries

Gain experience in using Python libraries and frameworks to solve real-world problems. This involves understanding how to leverage existing tools and APIs to streamline development and enhance productivity.

Useful 3rd party libraries


NumPy, short for “Numerical Python,” is a powerful library in Python used primarily for numerical computing. It provides support for multi-dimensional arrays (vectors, matrices, and higher-dimensional arrays) and a wide range of mathematical functions to operate on these arrays efficiently. NumPy forms the foundation for many other libraries in the Python scientific computing ecosystem.

Here are some key features and components of NumPy:

  1. Arrays: NumPy’s main object is the ndarray (N-dimensional array), which is a homogeneous collection of elements of the same data type. These arrays can have any number of dimensions and are more efficient than Python lists for numerical operations.
  2. Mathematical Functions: NumPy provides a comprehensive set of mathematical functions for performing operations such as arithmetic, trigonometric, logarithmic, exponential, and statistical calculations on arrays.
  3. Indexing and Slicing: NumPy provides powerful indexing and slicing capabilities to access and manipulate elements of arrays. This allows for efficient data extraction and manipulation.
  4. Vectorized Operations: NumPy encourages vectorized operations, where functions and operations are applied to entire arrays rather than individual elements. This leads to faster execution times and more concise code.
  5. Linear Algebra: NumPy includes a sub-module for linear algebra operations, such as matrix multiplication, matrix decomposition (e.g., LU, QR, and SVD), solving linear equations, and eigenvalue calculations.
  6. Random Number Generation: NumPy provides functions for generating pseudo-random numbers and sampling from various probability distributions.
  7. Integration with other Libraries: NumPy integrates seamlessly with other Python libraries used in scientific computing, such as SciPy (for advanced mathematical functions), Matplotlib (for data visualization), and pandas (for data manipulation and analysis).

NumPy is widely used in fields such as scientific computing, machine learning, data analysis, and engineering due to its efficiency, flexibility, and extensive capabilities. Its rich functionality and performance optimizations make it an important tool for numerical computing tasks in Python.


SciPy is like a toolbox full of powerful mathematical tools for Python. It provides functions for tasks like optimization, integration, interpolation, and more. Whether you’re solving complex equations or analyzing data, SciPy has got you covered with its wide range of capabilities.


Pandas is a Python library designed to make data manipulation and analysis easy and intuitive. It provides powerful data structures, such as DataFrame and Series, that allow you to work with structured data in a tabular format, similar to spreadsheets. With Pandas, you can perform tasks like reading and writing data from various file formats, cleaning and transforming data, handling missing values, grouping and aggregating data, and performing statistical analysis. It’s widely used in data science, machine learning, and financial analysis for its flexibility, efficiency, and extensive functionality. In essence, Pandas simplifies data handling tasks, making it an essential tool for anyone working with data in Python.


GeoPandas is a Python library that extends the capabilities of Pandas to handle geospatial data effortlessly. It provides tools for working with geographic data structures and performing spatial operations in a tabular format. GeoPandas allows you to read, write, and manipulate geographic data like points, lines, and polygons with ease.

Key features of GeoPandas include:

  1. Integration of geometric objects (points, lines, polygons) with Pandas DataFrames, allowing for seamless manipulation of geospatial data alongside attribute data.
  2. Support for reading and writing various geospatial file formats such as Shapefiles, GeoJSON, and GeoPackage.
  3. Spatial operations like overlay, intersection, and buffer, enabling analysis and manipulation of geographic datasets.
  4. Visualization capabilities using Matplotlib or other plotting libraries, allowing for the creation of maps and visual exploration of geospatial data.

Overall, GeoPandas simplifies the handling and analysis of geospatial data in Python, making it accessible to a wider audience of data scientists, analysts, and researchers.


Matplotlib is a comprehensive Python library for creating static, animated, and interactive visualizations. It provides a wide range of plotting tools and functions to generate high-quality graphs, charts, and figures for data analysis and presentation.

Key features of Matplotlib include:

  1. Support for Various Plot Types: Matplotlib offers support for a variety of plot types, including line plots, scatter plots, bar plots, histogram plots, pie charts, and more. This versatility allows users to visualize different types of data effectively.
  2. Customization Options: Matplotlib provides extensive customization options for plots, allowing users to control aspects such as colours, markers, line styles, labels, titles, axes, and legends. This flexibility enables the creation of visually appealing and informative plots tailored to specific requirements.
  3. Integration with NumPy: Matplotlib seamlessly integrates with NumPy, making it easy to plot data stored in NumPy arrays. This integration allows for efficient and straightforward data visualization within the Python ecosystem.
  4. Publication-Quality Output: Matplotlib produces publication-quality output suitable for scientific publications, reports, presentations, and other professional documents. It supports exporting plots to various file formats, including PNG, PDF, SVG, and more.
  5. Support for Multiple Interfaces: Matplotlib supports multiple interfaces for creating plots, including a MATLAB-like scripting interface (pyplot) and an object-oriented interface. This flexibility accommodates different programming styles and workflows.
  6. Extensive Documentation: Matplotlib offers comprehensive documentation, tutorials, and examples to help users get started and explore its features.

Overall, Matplotlib is a powerful and versatile library that empowers users to create a wide range of visualizations to explore and communicate data effectively in Python.


Dive into Python

“Dive Into Python” is a popular book by Mark Pilgrim that serves as a practical guide to learning Python programming. It covers a wide range of topics, from basic syntax to advanced concepts like regular expressions and web development. With hands-on exercises and accessible writing, it’s suitable for beginners and experienced developers alike.


Python programming and numerical methods

Python Programming and Numerical Methods: A Guide for Engineers and Scientists introduces programming tools and numerical methods to engineering and science students, with the goal of helping the students to develop good computational problem-solving techniques through the use of numerical methods and the Python programming language. Part One introduces fundamental programming concepts, using simple examples to put new concepts quickly into practice. Part Two covers the fundamentals of algorithms and numerical analysis at a level that allows students to quickly apply results in practical settings.


Table of Contents