Giter Site home page Giter Site logo

.csv output about trex HOT 4 CLOSED

mooch443 avatar mooch443 commented on May 29, 2024
.csv output

from trex.

Comments (4)

roaldarbol avatar roaldarbol commented on May 29, 2024 2

I actually use R too, and had to find a nice way to work with .npz files (they're getting increaslingly frequent, so I figured why not just work with them directly). As @mooch443 correctly mentions, the reticulate library is the way around it. I made a gist here which can be used to import and clean either a single file or even list all files in a folder, as well as removing Inf from the data frame (which was previously an issue, #21). I've got a few more snippets of code, e.g. for making moving averages/medians, so do let me know if I can help more. :-)

Here's the gist

from trex.

MarkJThomas avatar MarkJThomas commented on May 29, 2024

@mooch443

Hiya, I don't suppose you have any guidance to the above please?

All the best,
Mark

from trex.

mooch443 avatar mooch443 commented on May 29, 2024

Hey,

yes - sorry. I was about to get around to issues just now.

You may use an R extension to load the npz files into R directly: https://rstudio.github.io/reticulate/
I haven't tried it myself (not an R user), but this is supposed to work.

As to how you can get to the trajectories of individuals, there is an example for handling the npz data (in Python), as well as an explanation of the format, here: https://trex.run/docs/formats.html#positional-data

I am sorry, again, for the delay and I hope this will help. Essentially, what you will have to do is open the npz file for an individual (e.g. data/video_fish0.npz) and then plot X#wcentroid and Y#wcentroid together in a 2D plot. The way you extracted them seems to have gotten rid of the _fishX.npz suffixes (which means you are probably losing information).

Best
-Tristan

from trex.

MarkJThomas avatar MarkJThomas commented on May 29, 2024

Apologies for the delay in responding! Thank you so much for your help and the R script. It worked like a treat for the .npz files I have. You mentioned a few more snippets of code, I wondered if you had some to obtain movement speed/averages? I am quite new to this analysis so anything that can help me obtain output for the .npz files in R would be great :-)

@roaldarbol - I just noticed it says you are Brighton based, I am from Hassocks! - Small world

from trex.

Related Issues (20)

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.