Implementation of three functions used in data transformation: matrix transpose, time series windowing and cross-correlation.
Project description
Data Trans Functions
Description
The data-trans-functions
package provides utility functions to perform operations on 2D matrices
and 1D arrays. With features like 2D matrix transposition, 1D windowing, and 2D convolution, it
simplifies common operations while ensuring type safety.
Features
- transpose2d: Transposes a 2D matrix, effectively switching its axes.
- window1d: Generates a series of 1D sliding windows from an input array.
- convolution2d: Computes the 2D convolution of an input matrix using a given kernel.
Installation
To install the package via pip
, run:
pip install data-trans-functions
Usage
Here are brief examples for each function:
from data_trans_functions import transpose2d, window1d, convolution2d
import numpy as np
# Using transpose2d:
matrix = [[1, 2, 3], [4, 5, 6]]
print(transpose2d(matrix)) # Returns: [[1, 4], [2, 5], [3, 6]]
# Using window1d:
arr = [1, 2, 3, 4]
print(window1d(arr, 2, shift=2)) # Returns: [[1, 2], [3, 4]]
# Using convolution2d:
input_matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
kernel = np.array([[1, 0], [0, -1]])
print(convolution2d(input_matrix, kernel)) # Returns: [[3, 2], [3, 2]]
Recommendations
It's recommended to use these functions in combination with a type checker like mypy for safer usage.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for data_trans_functions-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bd044003dc9c6175d3a2b11fe1f6fad752d302c0bee60a4f5ff8293583fa76b |
|
MD5 | f0e5c0604d4c0a74c3aac0cf63b5b32e |
|
BLAKE2b-256 | 863824485fcf3b56911bacd2a29edff6470696a807fe6d4e5cd1ea24a39800b4 |
Close
Hashes for data_trans_functions-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd9dc67245f73b4ba443aca53067661070dbfa26c8f32f48c6dd8a5fbf2a5726 |
|
MD5 | 36f2af981f90c63f69a8ec2f832edea2 |
|
BLAKE2b-256 | dec7eaad48ef73b9c1b8366ba64323260aacef63edcd9f78e654b2d55195dd37 |