Git Product home page Git Product logo

postptv's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

postptv's Issues

tests fail on Python 3 with the numpy 1.18.3

`(test) MacBook-Pro:postptv alexliberzon$ pytest tests/
============================= test session starts ==============================
platform darwin -- Python 3.7.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /Users/alexliberzon/Downloads/flowtracks/postptv
collected 25 items

tests/test_analysis.py .. [ 8%]
tests/test_interp.py ........F. [ 48%]
tests/test_io.py .... [ 64%]
tests/test_scene.py ....... [ 92%]
tests/test_sequence.py .. [100%]

=================================== FAILURES ===================================
____________________________ TestJacobian.test_inv _____________________________

self = <test_interp.TestJacobian testMethod=test_inv>

def test_inv(self):
    pos = np.array([[0., 0., 0.]])
    tracer_pos = np.array([
        [0.001, 0, 0],
        [-0.001, 0, 0],
        [0,  0.001, 0],
        [0, -0.001, 0],
        [0, 0,  0.001],
        [0, 0, -0.001]
    ])
    # Basically we interpolate something based on the average position
    # change, because it's easy for me to visualize.
    interp_data = tracer_pos*2

    interp = interpolation.interpolant('inv', 6, 3)
    interp.set_scene(tracer_pos, pos, interp_data)

    local = interp.interpolate()
    np.testing.assert_array_equal(local, np.zeros((1, 3)))

    jac = interp.eulerian_jacobian()
  self.assertTrue(np.all(jac[:, [0, 1, 2], [0, 1, 2]] != 0))

E IndexError: index 1 is out of bounds for axis 1 with size 1

tests/test_interp.py:170: IndexError
=============================== warnings summary ===============================
tests/test_io.py::TestPtvis::test_trajectories_hdf
tests/test_io.py::TestPtvis::test_trim_hdf
/Users/alexliberzon/opt/miniconda3/envs/test/lib/python3.7/site-packages/flowtracks/io.py:710: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
dtype = np.dtype(fields)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=========================== short test summary info ============================
FAILED tests/test_interp.py::TestJacobian::test_inv - IndexError: index 1 is ...
=================== 1 failed, 24 passed, 2 warnings in 4.53s ===================
`

bug in inverse weigthing

AttributeError                            Traceback (most recent call last)
Cell In[3], line 12
      7 # Here we start to use the repeated-interpolation machinery,
      8 # By informing the interpolant of the current frame data,
      9 # and then querying it about that data without having to repeat it.
     10 interp.set_scene(frame.tracers.pos(), frame.particles.pos(), 
     11     frame.tracers.velocity())
---> 12 neighb_base = interp.which_neighbours()
     14 # Check that we have a particle with the desired number of tracers.
     15 candidates = neighb_base.sum(axis=1) >= 10

AttributeError: 'InverseDistanceWeighter' object has no attribute 'which_neighbours'

when running repeated_interpolation example

trajectory length

Hello Yosef and Alex,
Thank you for the valuable package you provided.
I am using flowtracks for Lagrangian studies and I have two questions I hope you can help me with those:

  1. I get the length of each trajectory by using following line:
    traj.pos()[-1,0]-traj.pos()[0,0]
    the maximum length I get is 0.16 but when I plot traj positions I see the maximum length of the trajectories is equal to the length of the observation volume (0.3 m).
    my guess is that the plot function just join small trajectories and make a longer one or so. If yes, based on what criteria it does that? Please correct me if I am wrong.
    2)is there any class for Lyapunov exponent calculation in flowtracks?
    Thank you for all the help,

numpy changed the indexing and it causes errors

I think we need to change the way we use indexing in trajectory.py

return self.__dict__[attr][selector]

from

self.__dict__[attr][selector]

to

self.__dict__[attr][np.array(selector).astype(np.int)]

for instance particle_pairs fail for the call of the type:

trajid = [0,1,2]
particle_pairs(original,shifted,trajids=np.array(trajid),time_points=np.zeros(3))

with the error

/Users/alex/miniconda3/envs/postptv/lib/python2.7/site-packages/flowtracks/pairs.pyc in particle_pairs(primary_trajects, secondary_trajects, trajids, time_points)
     52         prim_in_frame_ids = np.unique(trajids[coord_locator])
     53         prim_in_frame = [t for t in prim_traj if t.trajid() in prim_in_frame_ids]
---> 54         prim_parts = take_snapshot(prim_in_frame, frame_num, schema)
     55 
     56         sec_in_frame_ixs = trajectories_in_frame(secondary_trajects, frame_num,

/Users/alex/miniconda3/envs/postptv/lib/python2.7/site-packages/flowtracks/trajectory.py in take_snapshot(trajects, frame, schema)
    305         first_frame = traj.time()[0]
    306         for prop in copy_keys:
--> 307             kwds[prop][trix] = traj.__dict__[prop](frame - first_frame)
    308         kwds['trajid'][trix] = traj.trajid()
    309 

/Users/alex/miniconda3/envs/postptv/lib/python2.7/site-packages/flowtracks/trajectory.py in getter(self, selector)
     66                 return self.__dict__[attr]
     67             else:
---> 68                 return self.__dict__[attr][selector]
     69 
     70         def setter(self, new_val, selector=None):

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

probably also in other places, e.g.

self.__dict__[attr][selector] = new_val

[feature request] linking of the broken trajectories

One of the common issues that can be solved through post-processing is the linking of the broken trajectories. There are publications by Beat Luethi (called glueing) and Haitao Xu (multi-dimensional tracking) that dealt with this problem for 3D-PTV specifically and there is an old Matlab code that I've wrote some time ago

Matlab linking code

The idea is rather simple - for each two trajectories that are possibly broken pieces of the same trajectory project the edges (last for the earlier and first for the later) towards each other and see if they are within the acceptable tolerance (of distance, velocity and/or acceleration and time difference). If they are, connect, replace them by a single peace, make it smooth again, repeat the search.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.