💡 Looking to correlate two 1D arrays (signals, time series, depth series, whatever)? You have lots of options...
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 weights(z, x, m=0): | |
""" | |
Fornberg finite difference weights. | |
F90: https://github.com/bjodah/finitediff/blob/master/src/finitediff_fort.f90 | |
Made this for Advent of Code 2023, Day 9. | |
Arguments: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def has_illegal_chars(string: str, illegal: str = ',;"!+=') -> bool: | |
""" | |
Detect the presence of illegal characters in a string. | |
By default, illegal characters are: `,;"!+=` | |
Args: | |
string: A string of text of any length. | |
illegal: A sequence of characters that are not allowed. | |
Returns: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
""" | |
Given a 4D array of shape (n, h, w, c) representing n images of shape (h, w, c), | |
make a single image consisting of a regular grid of smaller images. | |
License: MIT No attribution | |
""" | |
import numpy as np | |
def reshape(arr, rows, cols, pixels=False): | |
"""Reshapes a 4D array into a grid of images. |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Properties of the scaled standard deviational hyperellipsoid. | |
# | |
# Author: Matt Hall, kwinkunks@gmail.com | |
# Copyright: 2022, Matt Hall | |
# Licence: Apache 2.0, https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# These small functions implement n-dimensional lookup of the beta-distribution | |
# approximation to this problem. They answer the questions, "What proportion | |
# of a multivariate Gaussian distribution is contained by `r` standard | |
# deviations?" and "How many standard deviations contain a proportion `p` of |
NewerOlder