polare

Python package for continuous data transformations.

https://github.com/jaiwillems/polare

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary

Keywords

interpolation-techniques numpy
Last synced: 7 months ago · JSON representation ·

Repository

Python package for continuous data transformations.

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
interpolation-techniques numpy
Created about 4 years ago · Last pushed about 4 years ago
Metadata Files
Readme Contributing License Code of conduct Citation

README.md

PyPI version license Downloads wheel

Polare is a computation tool that provides a continuous representation of input data, referred to as a Stroke, which doubles as an algebraic node for computations. A set of discrete data can be stored in the Stroke object and operated on as if it was a continuous function; the altered Stroke can then be evaluated within its input domain.

Why is Polare Useful?

In computation workflows, data can be interpolated after initial processing. Although, in cases where the post-transformation data is vastly more irregular than input data, it can be challenging to capture the actual data behaviour through interpolating the transformed data. In such cases, interpolating the input data before applying the transformations is desirable to capture the behaviour of the underlying data. By design, Strokes take advantage of pre-interpolation without the need first to decide where to interpolate.

The ability to decide interpolation points after the fact can be helpful in many applications. For example, in root-finding algorithms, it is necessary to be able to interpolate at any arbitrary point within the input domain without knowing the root of the data previously.

In short, if interpolation of irregular transformed data is desired, a more robust and representative interpolation can be achieved by performing the conversion using a Stroke rather than post interpolation.

Design Focus

The design focus of Polare was for seamless integration into NumPy intensive workflows. As a result, Strokes are compatible with most NumPy universal functions. Currently, NumPy functions that depend on a scalar input (e.g. np.cos, np.radians, etc.) only work on single Stroke objects whereas NumPy functions that necessitate array inputs (e.g. np.sum, np.dot, etc), are supported. Additionally, the program supports many Python operands for Stroke-to-Stroke and Stroke-to-scalar operations.

Quick Start Guide

Firstly, we can use a Stroke for interpolation!

```python from polare import Stroke import numpy as np

Generate data.

x = np.linspace(-1, 1, 10) y = np.exp(x) + np.cos(np.pi * x) + 1

Instantiate Stroke object.

f = Stroke(x=x, y=y, kind="cubic")

Interpolate.

xnew = np.linspace(-1, 1, 100) ynew = f(xnew) ```

Strokes can be operated on using standard Python operators, unlike other interpolation objects.

```python

We can shift the Stroke through addition/subtraction.

f = f + 10

We can scale the Stroke through multiplication/division.

f = 5 * f

And then interpolate the final result...

ynew = f(xnew) ```

Strokes are compatible with many NumPy universal functions allowing for simple integration into NumPy intensive workflows.

For the following NumPy-focused examples, we will use the proceeding variable definitions:

```python t = np.linspace(0, 10, 100)

x1 = Stroke(t, x1data, kind="cubic") y1 = Stroke(t, y1data, kind="cubic") z1 = Stroke(t, z1_data, kind="cubic")

x2 = Stroke(t, x1data, kind="cubic") y2 = Stroke(t, y1data, kind="cubic") z2 = Stroke(t, z1_data, kind="cubic") ```

where x1,y1,z1 and x2,y2,z2 represent coordinate points in 3D space. We can then form NumPy vectors:

python v1 = np.array([x1, y1, z1]) v2 = np.array([x2, y2, z2])

Using standard NumPy techniques, we can get a continuous/interpolable representation of expected results. For example, we can get a continuous/interpolable representation of the norm of our vectors with time:

```python norm1 = np.linalg.norm(v1) norm2 = np.linalge.norm(v2)

Interpolate norms.

tnew = np.linspace(5, 6, 100) norm1new = norm1(tnew) norm2new = norm2(t_new) ```

Or we could get a continuous/interpolable representation of the vector dot product with time:

```python dot12 = np.dot(v1, v2)

Interpolate inner product.

tnew = np.linspace(5, 6, 100) dot12new = dot12(t_new) ```

Combining these results, we can get a continuous/interpolable time-series of the angle between our two vectors:

```python theta12rad = np.arccos(dot12 / (norm1 * norm2)) theta12deg = np.degrees(theta12_rad)

Interpolate angles.

tnew = np.linspace(5, 6, 100) theta12radnew = theta12rad(tnew) theta12degnew = theta12deg(t_new) ```

An example of another helpful data operation is matrix-vector multiplication. To rotate our vector, v1, about the z-axis by a time-evolving angle, theta12_rad, we can use the 3rd principal axis rotation:

```python

Construct rotation matrix and rotate position vector.

c3 = np.array([[np.cos(theta12rad), -np.sin(theta12rad), 0], [np.sin(theta12rad), np.cos(theta12rad), 0], [0, 0, 1]]) new_pos = np.matmul(c3, v1)

Interpolate new (rotated) positions.

tnew = np.linspace(0, 9, 100) x1new = newpos0 y1new = newpos1 z1new = new_pos2 ```

Owner

  • Name: Jai Willems
  • Login: JaiWillems
  • Kind: user
  • Location: Toronto, Canada

Third year Engineering Science student at the University of Toronto focusing in aerospace engineering with a minor in robotics & mechatronics.

Citation (CITATION.cff)

cff-version: 1.2.0
message: Citation for the Polare library.
title: Polare
abstract: Kernels for continuous data transformations.
authors:
  - family-names: Willems
    given-names: Jai
version: 0.1.0
date-released: "2022-04-01"
license: BSD-3-Clause
repository-code: "https://github.com/JaiWillems/polare"

GitHub Events

Total
Last Year

Committers

Last synced: about 3 years ago

All Time
  • Total Commits: 38
  • Total Committers: 2
  • Avg Commits per committer: 19.0
  • Development Distribution Score (DDS): 0.053
Top Committers
Name Email Commits
Jai Willems j****h@h****m 36
Jai Willems 6****s@u****m 2

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 59 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 1
  • Total maintainers: 1
pypi.org: polare

Kernels for continuous data transformations.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 59 Last month
Rankings
Dependent packages count: 10.0%
Dependent repos count: 21.7%
Stargazers count: 27.8%
Average: 27.9%
Forks count: 29.8%
Downloads: 50.0%
Maintainers (1)
Last synced: 7 months ago

Dependencies

setup.py pypi
  • numpy *
  • scipy *