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

can roadrunner make bifurcation diagram showing Hopf Bifurcation with oscillation showing? #1234

Open
ZiyiiiLiu opened this issue Sep 9, 2024 · 2 comments

Comments

@ZiyiiiLiu
Copy link

Hi, I am using the code below to make my bifurcation diagram for many random parameter sets, and I want to know which set can have oscillation, can we do this? Thanks!
auto = Plugin("tel_auto2000")

Setup properties

auto.setProperty("SBML", r.getCurrentSBML())

auto.setProperty("ScanDirection", 'Positive')
auto.setProperty("PrincipalContinuationParameter", "S1")
auto.setProperty("PreSimulation", "True")
auto.setProperty("PreSimulationDuration", 30)
auto.setProperty("RL0", 0)
auto.setProperty("RL1", 5)
auto.setProperty("NMX", 1000)
#auto.setProperty("NDIM", 15)
auto.setProperty("NPR", 3)
auto.setProperty("KeepTempFiles", True)
auto.setProperty("DS", 0.001)
auto.setProperty("DSMIN", 0.0001)
auto.setProperty("DSMAX", 0.1)
auto.execute()
pts1 = auto.BifurcationPoints
if 1:
lbl1 = auto.BifurcationLabels
biData1 = auto.BifurcationData
# Correct call to the plotBifurcationDiagram function
biData1.plotBifurcationDiagram(pts1, lbl1)

@hsauro
Copy link

hsauro commented Sep 10, 2024 via email

@ZiyiiiLiu
Copy link
Author

ZiyiiiLiu commented Sep 10, 2024

I made a simple model, there is oscillations with the parameter, but nothing in the bifurcation diagram, do you know where I made wrong?

import tellurium as te

# Define the model
model_sclc_2 = """
    # Parameters
    m1 =1; 

    # Equations
    -> x; y
    -> y; m1 * (1 - x^2) * y - x
"""

# Load the model
r = te.loada(model_sclc_2)

# Initial conditions
ics_1 = {'x': 0.01, 'y': 6.1}
for var, val in ics_1.items():
    setattr(r, var, val)

# Parameter changes
pars = { 
    'm1': 1, 
}

# Apply parameter changes
for k in pars:
    setattr(r, k, pars[k])
#print( r.steadyState())
# Simulate the model
m = r.simulate(0, 100, 5000)
# Extract the simulation results
time = m[:, 0]  # Time data
x = m[:, 1]     # 'Y' variable data
y = m[:, 2]     # 'A' variable data

# Plot the results
plt.figure(figsize=(6,3))


plt.plot(time, x, label='x')
plt.plot(time, y, label='y ')

plt.xlabel('Time')
plt.ylabel('Concentration')
plt.title('Simulation Results of SCLC Model')
plt.legend(loc='best')
plt.grid(True)

# Save the plot
plt.savefig('simulation_results.png', dpi=300, bbox_inches='tight')
plt.show()

auto = Plugin("tel_auto2000")              

#print auto.listOfPropertyNames()

#Setup Auto Propertys
auto.setProperty("SBML", r.getCurrentSBML())

#Auto specific properties
auto.setProperty("ScanDirection", "Positive")    
auto.setProperty("PrincipalContinuationParameter", "m1")
auto.setProperty("PCPLowerBound", 0)
auto.setProperty("PCPUpperBound", 1.5)

#Max numberof points
auto.setProperty("NMX", 5000)  
       
#Execute the plugin
auto.execute()
     
# Bifurcation summary
print("Summary: ", auto.BifurcationSummary)

#Plot Bifurcation diagram
pts     = auto.BifurcationPoints
lbls    = auto.BifurcationLabels
biData  = auto.BifurcationData    

biData.plotBifurcationDiagram(pts, lbls) 

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

No branches or pull requests

2 participants