Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data_trans_functions-1.0.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

data_trans_functions-1.0.0-py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page