% diffEq1 dy=y
y0=1; % start point
% func in form of: dy/dt = f(x,y)
% then the range of solution
% start point
% extra options
solution=ode45(@diffEq1,[0 10],y0)
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
| #!/usr/bin/env python3 | |
| # FARBIK algorithm-based reverse kinematics 2D implementation in pure Python with PyGame display | |
| # Setup: | |
| # pip install pygame | |
| # Usage: | |
| # python -m fabrik_robot.py | |
| import math | |
| import sys |
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 skimage.util import view_as_blocks | |
| def split_to_patches( | |
| img: np.ndarray, patch_size: int, ch_axis: int | None = None | |
| ) -> np.ndarray: | |
| """Split image into rectangular patches. | |
| :param img: Array image 2D grayscale of 3D color | |
| :param patch_size: Size of a rectangular patch. | |
| :param ch_axis: Index of channel axis of the image, if None will treat image as 2D grayscale. |
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 scipy import ndimage | |
| from skimage import registration | |
| def register(reference_img: np.ndarray, moving_img: np.ndarray, scale: int = 100) -> np.ndarray: | |
| shift, error, phasediff = registration.phase_cross_correlation(reference_img, moving_img, upsample_factor=scale) | |
| shifted = ndimage.shift(moving_img, shift) | |
| return shifted |
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
| " https://vi.stackexchange.com/questions/5110/quickfix-support-for-python-tracebacks | |
| if exists("current_compiler") | |
| finish | |
| endif | |
| let current_compiler = "python" | |
| let s:cpo_save = &cpo | |
| set cpo&vim |
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
| \usepackage{caption} | |
| \usepackage{subcaption} |
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
| def downsample(img: np.ndarray, ratio: int, ch_axis: int = 0, start_pos: int = 0) -> np.ndarray: | |
| """Downsample an image by taking every n-th pixel in spatial dimensions. | |
| :param img: 2D (grayscale) or 3D (color) image. | |
| :param ratio: Downsampling ratio; the output image will be ratio-times | |
| smaller. | |
| :param ch_axis: Channel axis of the image, if image is 2D grayscale this | |
| paramter will be ignored. | |
| :returns: Downsampled image. | |
| """ |
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
| [tool.black] | |
| line-length = 100 | |
| skip-string-normalization = true | |
| [tool.isort] | |
| profile = "black" | |
| [[tool.mypy.overrides]] | |
| module = [ | |
| "untyped_module" |
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
| # /dev/md0 | |
| UUID=edb6179d-dccd-4975-a61f-06750a20dab1 /mnt/md0 ext4 defaults 0 0 | |
| # /dev/md1 | |
| UUID=3b396d88-ac44-4a91-9f7f-9ea9e0c5acfa /mnt/md1 ext4 defaults 0 0 |
NewerOlder