-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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
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.