Skip to main content

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.]]

Release files for de-transformation 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for de-transformation 0.1.5
File Size Uploaded
de_transformation-0.1.5.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for de-transformation 0.1.5
File Interpreter ABI Platform
de_transformation-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / de_transformation-0.1.5.tar.gz

Download URL de_transformation-0.1.5.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5031bf66482fa3052a8e5dba3359e96a69f4df40905b2ab29fe18611fb30c89e
BLAKE2b-256 checksum
How to use checksums
0dc3205e55844faf8ffdb5772c190d48be79f54d4834db5f03eaf8541b8dbbca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.4 Windows/10

Release files / de_transformation-0.1.5-py3-none-any.whl

Download URL de_transformation-0.1.5-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f439391e02c691f499fd2cdeca4399dd244d2159c0f6e994e74fd04472c9a92
BLAKE2b-256 checksum
How to use checksums
11852abf8ee1426ca71cb3b2116d4717f7458d279256ce2bdac5ac1d53e31505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.11.4 Windows/10

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page