Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability for vectorfield to instantiate from_uv #5797

Merged
merged 7 commits into from Jul 19, 2023

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Jul 6, 2023

Closes #3486

image
import pandas as pd
import numpy as np
import holoviews as hv
hv.extension("bokeh")

x = np.linspace(-1, 1, 4)
X, Y = np.meshgrid(x, x)
U, V = 5 * X, 5 * Y

df = pd.DataFrame({
    "x": X.flatten(),
    "y": Y.flatten(),
    "u": U.flatten(),
    "v": V.flatten(),
})

hv.VectorField.from_uv(df, ["x", "y"], ["u", "v"])

@codecov-commenter
Copy link

codecov-commenter commented Jul 6, 2023

Codecov Report

Merging #5797 (13a80ec) into main (53111a9) will increase coverage by 0.00%.
The diff coverage is 97.95%.

@@           Coverage Diff           @@
##             main    #5797   +/-   ##
=======================================
  Coverage   88.14%   88.15%           
=======================================
  Files         307      307           
  Lines       62841    62912   +71     
=======================================
+ Hits        55394    55461   +67     
- Misses       7447     7451    +4     
Flag Coverage Δ
ui-tests 22.40% <10.20%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
holoviews/element/geom.py 97.50% <94.73%> (-2.50%) ⬇️
...oloviews/tests/element/test_elementconstructors.py 98.90% <100.00%> (+0.21%) ⬆️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

holoviews/element/geom.py Outdated Show resolved Hide resolved
@Hoxbro Hoxbro added this to the 1.17.0 milestone Jul 7, 2023
@ahuang11 ahuang11 changed the title Allow vectorfield from U/V Add ability for vectorfield to instantiate from_uv Jul 10, 2023
@ahuang11 ahuang11 requested a review from philippjfr July 10, 2023 17:46
Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@philippjfr philippjfr merged commit 9d2274c into main Jul 19, 2023
14 checks passed
@philippjfr philippjfr deleted the vectorfield_from_uv branch July 19, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing x, y velocities to VectorField (alternative to angle, magnitude)
4 participants