Б12-514 Беляев Кирилл#171
Conversation
| lhs: np.ndarray, | ||
| rhs: np.ndarray, | ||
| ) -> np.ndarray: ... | ||
| ) -> np.ndarray: |
| azimuth: np.ndarray, | ||
| inclination: np.ndarray, | ||
| ) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ... | ||
| ) -> tuple[np.ndarray, np.ndarray, np.ndarray]: |
| def get_extremum_indices( | ||
| ordinates: np.ndarray, | ||
| ) -> tuple[np.ndarray, np.ndarray]: ... | ||
| ) -> tuple[np.ndarray, np.ndarray]: |
| ) -> np.ndarray: | ||
| # ваш код | ||
| return image | ||
|
|
| blurred_image = np.zeros_like(image) | ||
| image = pad_image(image, kernel_size // 2) | ||
|
|
||
| if len(image.shape) == 3: |
There was a problem hiding this comment.
Можно было использовать .ndim
| blurred_image[i, j] = np.mean( | ||
| image[i : i + kernel_size, j : j + kernel_size], axis=(0, 1) | ||
| ) | ||
| else: |
There was a problem hiding this comment.
Можно было без if, так код был бы проще
| # ваш код | ||
|
|
||
| return 0, 0 | ||
| if threshold < 1: |
| if threshold < 1: | ||
| raise ValueError("threshold must be positive") | ||
|
|
||
| colors = [0] * 256 |
There was a problem hiding this comment.
Лучше было бы 256 вынести в константу, чтобы было сразу понятно, что вы имеете ввиду количество цветов, и еще вы несколько раз используетее это число
| ) | ||
|
|
||
| elif diagram_type == "violin": | ||
| ax_diag_x.violinplot(abscissa, vert=False) |
| before_sum = {} | ||
| after_sum = {} | ||
| for cl in classes: | ||
| mask = before == cl |
There was a problem hiding this comment.
Почему бы не использовать classes.count?
| return before_sum, after_sum | ||
|
|
||
|
|
||
| classes = ["I", "II", "III", "IV"] |
There was a problem hiding this comment.
Лучше было бы писать код в фукнции
| def modulated_signal_math(modulation, fc, t): | ||
| if modulation is None: | ||
| return np.sin(2 * np.pi * fc * t) | ||
| else: |
| from matplotlib.animation import FuncAnimation | ||
|
|
||
|
|
||
| def run_wave(maze: np.ndarray, start: tuple[int, int], end: tuple[int, int]): |
There was a problem hiding this comment.
Не работает с большим лабиринтом (я запускал код, который был на момент дедлайна)
| from matplotlib.animation import FuncAnimation | ||
|
|
||
|
|
||
| def modulated_signal_math(modulation, fc, t): |
| "id": "d7b00711", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "outputs": [ |
There was a problem hiding this comment.
В части 3, как будто можно было сделать циклом и код был бы проще и не было столько повторений одного и того же кода
| "id": "d7b00711", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "outputs": [ |
There was a problem hiding this comment.
В части 10 titanic_data["alone"] == True не имеет смысла, так как равносильно просто titanic_data["alone"] . Вообще если вы пишете == True, то скорее всего вы делаете что-то неправильно
No description provided.