# check the python path for blender
blender --background --python-expr "import sys; print(sys.executable)"
# install debugpy
blender-4.2.1-linux-x64/4.2/python/bin/python3.11 -m pip install debugpy
This file contains hidden or 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 | |
# reduce dimension | |
mapping1 = { | |
(1, 2): 0, | |
(3, 4): 1, | |
(5, 6): 2, | |
} | |
def mapper1(m1, m2): | |
return mapping1.get((m1, m2)) |
This file contains hidden or 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
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" |
This file contains hidden or 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 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) |
This file contains hidden or 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
# 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" |
This file contains hidden or 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
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:
- Create a bare clone of the repository.
(This is temporary and will be removed so just do it wherever.)
git clone --bare [email protected]:usi-systems/easytrace.git
This file contains hidden or 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
# 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] |
This file contains hidden or 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
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) |
This file contains hidden or 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 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 |
NewerOlder