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

Quantification of time scale separation using sojourn time in nullclines #50

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

biphy
Copy link
Collaborator

@biphy biphy commented Mar 5, 2024

Regarding issue #45, this PR implements a function calculate_sojourn_time_fractions_in_nullclines which calculates the time fraction that an oscillation stays near the nullcline of each variable. It returns a numerical vector of which length equals the dimension of the problem and each element is between 0 and 1 by design. Its element close to 1 implies that the dynamics occurs near the nullcline of the corresponding variable, which lets us to identify a slowly-varying variable. Thus this function can be used to quantify the concept of the time scale separation in relaxation oscillators. For example, maximum(calculate_sojourn_time_fractions_in_nullclines(ode_solution)) close to 1 can be interpreted as the dynamics being relaxation oscillator-like having sharp transitions between slow states.

@biphy biphy added the enhancement New feature or request label Mar 5, 2024
@biphy biphy requested a review from ftavella March 5, 2024 16:56
@biphy biphy self-assigned this Mar 5, 2024
@biphy biphy marked this pull request as ready for review March 5, 2024 18:07
Copy link
Collaborator

@ftavella ftavella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! See my comments for some things that are not totally clear to me

period = 1 / mean(calculate_main_frequency(ode_solution, length(ode_solution.t), length(ode_solution.t))["frequency"])

idx_last_cycle = ode_solution.t .> ode_solution.t[end] - period
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? We should add a comment here explaining why

# add one more data point to fully complete a cycle

function gradient(v, grid)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function defined inside calculate_sojourn_time_fractions_in_nullclines because it uses information that is only within the scope of that function? If not it should be defined outside as its own separate function for clarity

@test max_sojourn_time[4] > max_sojourn_time[8]
@test max_sojourn_time[4] > max_sojourn_time[9]
@test max_sojourn_time[4] > max_sojourn_time[10]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also add a test comparing 3 and 4 just in case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants