Python in Academic Research

Volunteering, Nepal Research and Collaboration Center NRCC, 2022

About Instructor

License

License

Objectives of the Course

  1. To make students understand the use of Python in Research.
  2. To teach the usage of python and its modules like
    • NumPy,
    • Pandas
    • Matplotlib,
    • Seaborn
    • SymPy

Course Syllabus:


1. Python Programming

  • Introduction to Google Colab
  • Python version and pip package manager
  • Python Program
  • Python Arithmatic Operators
  • Using Python as calculators
  • IEEE 754 standard for floating point arithmetic
  • How to define a variable name and Variable Naming convention
  • Operator Precedence
  • Changing and updating variable values in Python
  • Data types in Python
  • Number data type: int, float, complex
    • Number data type with conditionals
    • Anatomy of conditionals: if … else statements
    • Indentation
    • Expression and Comparison operators
    • Nesting and chaining(if… elif… else) of conditionals
    • Logical Operators
  • String data type in Python
    • Single line strings and multi-line strings
    • Indexing and slicing: How to access characters in a string?
    • range() method
    • for loop in python with range() method
    • continue vs break vs pass statements
    • characters vs substrings
    • string methods: .replace(), .lower(), .upper(), .lstrip(), .rstrip(), .strip(), .split()
  • Sequence data type: List
    • Indexing, slicing, for loop with and without range() , while loop, for loop vs while loop
    • Calculating mean of list using loops
    • Negative Indexing
    • Membership operators: in , not in
    • Mutable vs Immutable data type with exmaple
    • List methods: .insert(), .append(), .remove(), .pop(), .sort()
    • List comprehension
  • Sequence data type: Tuple
    • List vs tuple
    • Typecasting data types
    • loop in tuple
    • Unpacking of tuples
  • Sets: unordered, unindexed
    • .remove() , .add() in sets
    • Type conversion
    • Set operation in Python : union, intersection, difference
  • Mapping data type Dictionary
    • Accessing dictionary items and add key value pair
    • keys() and values() method in dictionary
    • Updating dictionary: The update() method
    • `pop()
    • Looping in dictionary
    • Nested Dictionary
  • NoneType data type in Python
    • Identity Operators
  • Python Functions
    • def keyword and function arguments
    • return statement
    • Default arguments and non default arguments
    • Handling multiple return values
    • Recursion and its advantage
  • Object Oriented Programming in Python (OOP)
    • Characterstics of OOP
    • Class and Object –defining class and creating object
    • . operator
    • Instance attribute vs class attribute
    • What is this def __init__(self) ?
    • What is self parameter?
    • __new__() and __init__()
    • Object methods or user defined methods inside user defined class
    • Inheritance in Python
    • super() method
    • Polymorphism and operator overloading
    • Abstraction and Encapsulation
    • limiting behaviour of variables : private, public and protected

2. Numpy

  • Install and check version of the numpy
  • How to import numpy?
  • Vectors, the 1D Arrays
    • What is array and Creating Numpy array: How do you know the shape and size of an array?
    • What’s the difference between a Python list and a NumPy array?
    • Array creation routines: .zeros(), .ones() and .empty()
    • Array initilization using Monotonic sequence : `.arange() , .linspace()
    • Creating random array: np.random.randint(), np.random.rand(), np.random.uniform(), np.random.randn(), np.random.normal()
    • Indexing (fancy indexing) and slicing 1D numpy array
    • Logic Functions: Truth value testing : np.any() vs np.all()
    • Adding, concatenate, and sorting array elements np.append() , np.sort(), np.concatenate()
    • Vector operations i.e. elementwise operations in 1D numpy array
    • Broadcasting and its application in Image Processing
    • Array Operation: np.floor(), np.ceil(), np.round()
    • Statistics using numpy: .max(), .min(), .argmax(), .argmin(), .sum(), .mean(), .std(), .var()
  • Matrices, the 2D Arrays, and 3D arrays + Introduction to Computer vision

    • Creation of 2D numpy array using: list of list and 1D array, .ones(), .zeros(), .full(), .eye(), .reshape()
    • Indexing, slicing and modifying values in 2D array
    • Creating random matrix: np.random.randint(), np.random.rand(), np.random.uniform(), np.random.randn(), np.random.normal()
    • Matrix multiplication: Dot product
    • Cross Product
    • Inverse, Transpose and determinant of matrix using numpy
    • The axis argument in numpy: 2D: axis = 0 vs axis = 1
    • Matrix statistics: .min(), .min(axis = 1), .min(axis = 0), .argmin(), .argmin(axis = 1), .argmin(axis = 0), np.unravel_index(),
    • How morden day images are created? with Example of opencv library.

Links to the Notebooks

Day1: Intro to python programming

Day2: Number dtype with conditionals

Day3: String type

Day4: List and Tuple type

Day5 Part1: Dictionary in python

Day5 Part 2: Set and NoneType

Day6 Part1: Python Function

Day6 Part 2: OOP in Python