This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from loguru import logger | |
from more_loguru import logger_wraps | |
logger.add('test.log', mode='w') | |
@logger_wraps(debug_io=True) | |
def my_func(a, b, c=1, d="Text"): | |
"""A test function""" | |
time.sleep(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from datetime import datetime | |
from pathlib import Path | |
import functools | |
from pprint import pformat | |
def get_func_name(func): | |
"""Return the name of the given function including module name""" | |
if func.__class__.__module__ == "builtins": | |
mod_name = func.__module__ if hasattr(func, '__module__') and \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def find_local_min_max(poly_coefs: np.ndarray, atol: float | None = 1e-6): | |
""" | |
Find the local minima and maxima of a polynomial function. | |
Parameters | |
---------- | |
poly_coefs : np.ndarray | |
The coefficients of the polynomial, ordered from lowest degree to highest. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.interpolate import griddata | |
def interp_nan(data, **griddata_kwargs): | |
""" | |
Interpolate NaN values in ND array. | |
Parameters | |
---------- | |
data : np.ndarray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
3D Body Motion Rotation Matrix and the Angular Velocity. | |
Author: Chaitanya Kesanapalli | |
""" | |
import sympy | |
# ============================================================================= | |
# Define the symbols | |
# ============================================================================= |