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 an observable for pairwise distance and an accumulator for contact times #5032

Open
wants to merge 1 commit into
base: python
Choose a base branch
from

Conversation

pm-blanco
Copy link
Contributor

@pm-blanco pm-blanco commented Jan 24, 2025

Added:

  • observables.PairwiseDistances: an observable that tracks pairwise distances between two sets of particles.
  • accumulators.ContactTimes: an accumulator that tracks contact times within contact threshold for a set of input distances.
  • samples\contact_time.py: a sample script showcasing how to use these new features.

The contact time is defined as:

$$\tau = t_f - t_0$$

where $t_f$ is the last measured time at which those particles were in contact and $t_0$ the first measured time at which those particles were in contact. For example, if two particles have been only in contact during two consecutive configuration then their contact time is $\tau = dt$, where $dt$ is the time step. If they are only in contact for a single configuration then their contact time is $\tau = 0$.

@RudolfWeeber
Copy link
Contributor

Thank you Pablo. This is a very useful addition.
IMO, we should try to split this into

  • an observable PairwiseDistance(pids1,pids2)
  • and an accumulator ParticlecontactTimes(pairwise_distance_obs, contact_distance)

In my impression, this would allow us to leave the observabl genuinely stateless (and avoid cirumenting teh them being const). All the state would be in the accumulator.

Should we do a short video call, to discuss?

@pm-blanco
Copy link
Contributor Author

Hi Rudolf! The solution you propose makes sense to me, the "hack" I had to do felt a bit against the current phylosophy of the observable/accumulator framework. I am simply not too familiar with the c++ core of the accumulators/observables so I did not want to tinker with it too much. I think I got myself somewhat familiar now with the observable framework, so I can try to refactor the feature to match what you propose.

Regarding the videocall, sounds good. I will send you an e-mail so we can schedule a time 😄

@pm-blanco
Copy link
Contributor Author

@jngrad I have the PR mostly ready for review, but my test is skipped by the CI for some reason. Do you know why?

The following tests did not run:
	 30 - contact_time (Skipped)

@jngrad
Copy link
Member

jngrad commented Feb 20, 2025

@jngrad I have the PR mostly ready for review, but my test is skipped by the CI for some reason. Do you know why?

The following tests did not run:
	 30 - contact_time (Skipped)

The class is missing a test_something(self) method to check the result of the simulation.

@pm-blanco pm-blanco changed the title draft: observable to track contact times observable for pairwise distance and accumulator for contact times Feb 20, 2025
@pm-blanco pm-blanco changed the title observable for pairwise distance and accumulator for contact times add an observable for pairwise distance and an accumulator for contact times Feb 20, 2025
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jngrad
Copy link
Member

jngrad commented Feb 20, 2025

@pm-blanco I think something went wrong during the rebase. Could you please try this?

git reset --soft upstream/python # rewind changes accidentally taken from the python branch
git commit -m 'Add contact time observable'
git show # here carefully inspect the diff to make sure it only contains your feature
git push -f

If this doesn't help, use git reflog to look through the history of orphaned commits and resurrect e.g. a38417ee4.

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.

3 participants