Skip to main content

No project description provided

Project description

Advanced Python & Linux Shell Commands: Project

Python package project

Description

This project has a python package de-transformation code to make data transformations. The package consists of 3 functions:

  • transpose2d
  • window1d
  • convolution2d

transpose2d

Description

Transposes a 2D matrix.

Parameters

  • input_matrix (list[list[float]]): The input 2D matrix to be transposed.

Return Value

  • list[list[float]]: The transposed 2D matrix, where rows become columns and columns become rows.

Example

from de_transformation.utils import transpose2d

# Example input matrix
input_matrix = [[1.0, 2.0, 3.0],
                [4.0, 5.0, 6.0]]

# Transpose the matrix
transposed_matrix = transpose2d(input_matrix)

# Output:
# transposed_matrix is now:
# [[1.0, 4.0],
#  [2.0, 5.0],
#  [3.0, 6.0]]

window1d

Description

Extracts window sub-arrays from a 1D list or numpy array, with the option to specify the size of the windows, the shift for the starting position of the window, and the stride between consecutive windows.

Parameters

  • input_array (list or np.ndarray): The input 1D array or list from which windows are extracted.
  • size (int): The size of the windows to extract.
  • shift (int, optional): The number of elements to shift the starting position of the window (default is 1).
  • stride (int, optional): The step size between consecutive windows (default is 1).

Return Value

  • list of lists or np.ndarrays: A list containing windows of the specified size extracted from the input array.

Example

from de_transformation.utils import window1d

# Example input array
input_array = [1, 2, 3, 4, 5, 6, 7, 8, 9]

# Extract windows of size 3 with a shift of 2
windows = window1d(input_array, size=3, shift=2)

# Output:
# windows is now:
# [[1, 2, 3],
#  [3, 4, 5],
#  [5, 6, 7],
#  [7, 8, 9]]

convolution2d

Description

Performs 2D convolution on a numpy array using a specified convolution kernel and stride.

Parameters

  • input_matrix (numpy.ndarray): The input 2D matrix to be convolved.
  • kernel (numpy.ndarray): The convolution kernel (filter) to apply.
  • stride (int, optional): The stride for the convolution operation (default is 1).

Return Value

  • numpy.ndarray: The result of the 2D convolution operation, which is a numpy array.

Usage Example

from de_transformation.utils import convolution2d

# Example input matrix
input_matrix = np.array([[1, 2, 3],
                         [4, 5, 6],
                         [7, 8, 9]])

# Example kernel
kernel = np.array([[1, 0],
                   [0, -1]])

# Perform 2D convolution
result = convolution2d(input_matrix, kernel)

# Output:
# result is now:
# [[  1.  -2.]
#  [ -1.  -2.]]

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

de_transformation-0.1.5.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

de_transformation-0.1.5-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file de_transformation-0.1.5.tar.gz.

File metadata

  • Download URL: de_transformation-0.1.5.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.4 Windows/10

File hashes

Hashes for de_transformation-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5031bf66482fa3052a8e5dba3359e96a69f4df40905b2ab29fe18611fb30c89e
MD5 7286ae66e7d6fc2b19b09dee75117396
BLAKE2b-256 0dc3205e55844faf8ffdb5772c190d48be79f54d4834db5f03eaf8541b8dbbca

See more details on using hashes here.

File details

Details for the file de_transformation-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: de_transformation-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.4 Windows/10

File hashes

Hashes for de_transformation-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5f439391e02c691f499fd2cdeca4399dd244d2159c0f6e994e74fd04472c9a92
MD5 618275395ebe51c1a7a8918cfaa47611
BLAKE2b-256 11852abf8ee1426ca71cb3b2116d4717f7458d279256ce2bdac5ac1d53e31505

See more details on using hashes here.

Supported by

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