Code Monkey home page Code Monkey logo

saspt's People

Contributors

alecheckert avatar vinsfan368 avatar whyeo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

saspt's Issues

Posterior Probability does not add up to 1

Hi Alec, here is another one, more of a clarification/question than an issue.

I noticed that the sum of posterior probabilities over all values of diffusion coefficients is 0.0278 and not 1. Interestingly, the sum is same for two different grids of D. Could you please explain why? Or am I missing something?

Given that this is correct, should the immobile fraction (e.g., Fig. 5C in your eLife paper about this code) be defined as

sum(P(D<threshold)) / sum(P(all))

instead of just the numerator?

Does the code output posterior diffusion coefficient probability for every transition?

Hi again @alecheckert,

I am wondering if one can access a diffusion coefficient value for every frame-to-frame transition during a trajectory. So a trajectory with length of N frames will have N-1 diffusion coefficient values.

Does saspt report that or carry out that kind of assignment at all?

The natural guess would be SA.trajectories.something which would be a row or column vector of length N-1. But I could not find something like that. Am I thinking in the right direction?

Can the code be used for long trajectories?

Possibly another FAQ, more on the scientific side rather than the repo. I am asking to make sure because of fast response (thanks again)!

Since the number of jumps for each trajectory are accounted for in the calculation (alpha_j has a factor of n_i), my intuition is that the code can be safely used even for non-blinking fluorophores which would end up with loooooong trajectories.

Is that correct?

Processing >10k trajectories

This may be an FAQ: the code seems to be processing only 10000 trajectories even if the input dataset contains many more. Are these the first 10,000 trajectories in the input array or randomly chosen? Is there a variable to change this?

Kudos on the great paper and the public repo!

Quirks with subsampling within `StateArrayDataset`

Hi @alecheckert, I ran across some quirks when trying to subsample within an SAD. Here's a code snippet:

import saspt
from saspt.dataset import StateArrayDataset
import os
import pandas as pd

module_path = os.path.dirname(os.path.dirname(saspt.__file__))
sample_csv = os.path.join(module_path, "examples", 
                          "u2os_ht_nls_7.48ms", "region_8_7ms_trajs.csv")
settings = dict(pixel_size_um=0.16,            
                frame_interval=0.00748,   
                focal_depth=0.7,              
                sample_size=10,    
                progress_bar=True,         
                likelihood_type='rbme',    
                splitsize=10,   
                start_frame=0)
paths = dict(filepath=[sample_csv for _ in range(3)],
             condition=['test' for _ in range(3)])
SAD = StateArrayDataset.from_kwargs(pd.DataFrame(paths),
                                    path_col='filepath',
                                    condition_col='condition',
                                    **settings)
print(f"Sum of unnormalized posterior probabilities per file:", 
      f"{SAD.posterior_occs.sum(axis=(1,2))}", 
      sep="\n")
print(f"SAD.jumps_per_file attr:", SAD.jumps_per_file, sep="\n")

The problem is that subsampling is happening every time StateArrayDataset._load_tracks is called. This can happen twice while using the object (unless the user clear()s): once when calculating occupancies and another to get processed track statistics. jumps_per_file depends on the processed track stats, so it doesn't agree with the posterior occs.

A solution could be to bundle StateArrayDataset._get_processed_track_statistics() and StateArrayDataset.calc_marginal_posterior_occs() into a bigger function. I guess the subsampled detections could also be cached on the SAD object, though that could take up a lot of memory.

Happy to try to fix this; let me know what you think is the best way forward.

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.