Wait for a remote debugging client
import debugpy
debugpy.listen(5678)
print("Waiting for debugger attach")
debugpy.wait_for_client()
print("Debugger attached")
import numpy as np | |
# reduce dimension | |
mapping1 = { | |
(1, 2): 0, | |
(3, 4): 1, | |
(5, 6): 2, | |
} | |
def mapper1(m1, m2): | |
return mapping1.get((m1, m2)) |
from PIL import Image, ImageDraw, ImageFont | |
from pathlib import Path | |
from urllib.request import urlopen | |
def check_and_get_font_path(font_name="roboto_regular") -> Path: | |
if font_name == "roboto_regular": | |
path = Path("font/Roboto-Regular.ttf") | |
if not path.exists(): | |
path.parent.mkdir(parents=True, exist_ok=True) | |
url = "https://github.com/googlefonts/roboto/raw/main/src/hinted/Roboto-Regular.ttf" |
import bpy | |
import mathutils | |
import math | |
# blender rotate in the right hand direction | |
figher = bpy.context.scene.objects['airplane'] | |
figher.location = (0, 0, 0) | |
figher.rotation_euler = (0, 0, 0) |
# Add this file into the root folder of your project | |
# Specify dependencies in requirements.txt and install dependencies with `pip install -e .` | |
# Then, you don't need to specify the `src` directory within PYTHONPATH when you run a python module in your project. | |
# This is an exeperimental/opinionated setting. So any comments are welcome. | |
# references: | |
# - https://stackoverflow.com/a/73600610/1874690 | |
# - https://packaging.python.org/en/latest/guides/writing-pyproject-toml/ | |
[project] | |
name = "my-project-name" |
sudo apt update | |
sudo apt install imagemagick | |
montage abc/* -tile 8x8 -geometry +1+1 grid_abc.png |
The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.
The correct way of creating a private frok by duplicating the repo is documented here.
For this assignment the commands are:
git clone --bare git@github.com:usi-systems/easytrace.git
# grids = [create_grid(generated_batch[j]) for j in range(len(generated_batch))] | |
# save_as_gif_animation(grids, output_animation_path) | |
import math | |
import numpy as np | |
from PIL import Image | |
def create_grid(image_arrays: np.ndarray): | |
batch_size = image_arrays.shape[0] |
class BaseClass: | |
def __init__(self, _id, a, k=None): | |
self.id = _id | |
self.a = a | |
self.k = k | |
def updated(self, **kwargs): | |
kwargs = {"k": self.k, **kwargs} | |
return BaseClass(self.id, self.a, **kwargs) |
import pandas as pd | |
import numpy as np | |
input_csv = "./weather_history_weekly.csv" | |
output_csv_2w = "./weather_history_2w.csv" | |
output_csv_monthly = "./weather_history_monthly.csv" | |
df = pd.read_csv(input_csv) | |
N = len(df) | |
all_columns = df.columns |