-
Notifications
You must be signed in to change notification settings - Fork 10
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
Improvement: simulation generates photon timestamps directly #4
Comments
@lampo808, if you look at the method ParticlesSimulation.simulate_timestamps_mix_da_online it does what you need for a mixture of multiple FRET populations. If you want to do only a single-color version you could simplify that method removing the duplication that is there to simulate both donor and acceptor channel, maybe call it ParticlesSimulation.simulate_timestamps_mix_online. If you send a PR to add this method I would be happy to merge it. Let me know if you need further help. |
Great, didn't notice that function. |
@tritemio, while testing the modified method In[8]: S.simulate_timestamps_mix_da_online(b, b, (slice(0, S.num_particles),), bkg, bkg, pbm.hash_(rs.get_state()), timeslice=t_max)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-8-bc8096f32957> in <module>()
----> 1 S.simulate_timestamps_mix_da_online(b, b, (slice(0, S.num_particles),), bkg, bkg, pbm.hash_(rs.get_state()), timeslice=t_max)
C:/Users/Marco/Work/Work In Progress/PyBroMo\pybromo\diffusion.py in simulate_timestamps_mix_da_online(self, max_rates_d, max_rates_a, populations, bg_rate_d, bg_rate_a, rs, seed, chunksize, comp_filter, overwrite, skip_existing, scale, path, t_chunksize, timeslice)
1023 `timeslice` seconds. If None, simulate until `self.t_max`.
1024 """
-> 1025 self.open_store_timestamp(chunksize=chunksize, path=path)
1026 rs = self._get_group_randomstate(rs, seed, self.ts_group)
1027 if t_chunksize is None:
C:/Users/Marco/Work/Work In Progress/PyBroMo\pybromo\diffusion.py in open_store_timestamp(self, path, chunksize, chunkslice, mode)
490 return
491 if path is None:
--> 492 path = self.store.filepath.parent
493 self.ts_store = self._open_store(TimestampStore,
494 prefix=ParticlesSimulation._PREFIX_TS,
AttributeError: 'ParticlesSimulation' object has no attribute 'store' Any idea of what's going wrong? The zipped notebook to reproduce the issue is attached. Thanks |
@lampo808, the notebook you attached does not have any error, maybe you sent the wrong one. Also please use the latest version from master of pybromo (in the notebook you sent a very old version is used). |
@lampo808, I was able to reproduce your error trying to reverse engineer what you are doing. I took your notebook and inserted the command you posted above but it did work because the syntax is completely wrong (you need to pass lists of brightnesses and the argument
Where |
@lampo808, the proper way to call that method is:
Explanation: when there is no trajectory file open, the method Yes, the error message does not help in this case and the method should also work without a path (just using the current folder is not specified). I'll fix this. |
I thought that with all these arguments is better to use keyword-argument to help when reading and avoiding errors. For the reference, please use:
Another possible improvement can be that when |
@tritemio sorry for the notebook, the modifications I did were not saved (including using the last version of PyBroMo). I will double check next time. Thanks for the solution and explanation, I can take care of the automatic path selection were none is passed and the improvement you proposed for the populations, if that's fine for you. |
@lampo808 sounds good! A few tips: For the path you can modify For the |
I want to use PyBroMo to simulate timestamps generated from a single-molecule experiment.
tl;dr: it would be great to add an option to
PyBroMo.simulate_diffusion
to save only the timestamps.My plan is to run a series of simulations to understand which experimental parameters I need to tweak to be able to achieve a good SNR.
To save disk space, instead of following the example of
PyBroMo - B.1 Disk-single-core - Generate photon timestamps.ipynb
I'm generating intensity traces and then calculating timestamps from sratch using the following code:Working with the intensity trace is rather memory-consuming, so it would be great if the timestamps could be generated directly by the simulation function.
The text was updated successfully, but these errors were encountered: