How to use pysces - 10 common examples

To help you get started, we’ve selected a few pysces examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PySCeS / pysces / pysces / examples / testinvalidstate.py View on Github external
#!/usr/bin/env python
# Testing the new parallel scanner class - detection of invalid states
# --jr20101218

import os
backupdir = os.getcwd()

import numpy as np
import pysces

tbox=pysces.PyscesUtils.TimerBox()
import time

m=pysces.model('isola2a')

ser = pysces.Scanner(m)

print("Serial execution...")
print("Start: ", tbox.normal_timer('SER'))
print(next(tbox.SER))
t1=time.time()
ser.quietRun = True
ser.addScanParameter('V4',0.01,200,2000,log=True)
ser.addUserOutput('J_R1', 'A')
ser.Run()
print("Done: ", next(tbox.SER))
t2=time.time()
print("Duration: %.2f seconds" % (t2-t1))
ser.statespersecond = len(ser.ScanSpace)/(t2-t1)
print("States per second: %.1f" % ser.statespersecond)
github davidcraft / SimKern / Testing / testpysces.py View on Github external
def sim_plot(pscfilename):
    '''
    Takes in a psc file, creates a pysces model, finds the steady states,
    and plots the values of each Species concentration over time
    Returns : a model object
    '''
    model = pysces.model(pscfilename)
    model.sim_start = 0.0
    model.sim_end = 20
    model.sim_points = 50
    model.Simulate()
    model.doState()
    model.doSimPlot(end=10.0,points=210,plot='species', fmt='lines',filename = None)
    return model
github PySCeS / pysces / pysces / examples / testRunScatter.py View on Github external
#!/usr/bin/env python
# Testing the new parallel scanner class

import os
backupdir = os.getcwd()

import numpy as np
import pysces

tbox=pysces.PyscesUtils.TimerBox()
import time

m=pysces.model('isola2a')

print("\n\nParallel execution...using RunScatter")
par2 = pysces.ParScanner(m)
t5=time.time()
par2.addScanParameter('V4',60,100,11)
par2.addScanParameter('V1',100,130,16)
par2.addScanParameter('V2',100,130,16,slave=True)
par2.addScanParameter('V3',80,90,6)
par2.addUserOutput('J_R1', 'A', 'ecR4_X', 'ccJR1_R1')
#par2.addUserOutput('J_R1', 'A')
par2.RunScatter()
t6=time.time()
print("Duration: %.2f seconds" % (t6-t5))
par2.statespersecond = par2.Tsteps/(t6-t5)
print("States per second: %.1f" % par2.statespersecond)
github PySCeS / pysces / pysces / examples / testparscanner.py View on Github external
#!/usr/bin/env python
# Testing the new parallel scanner class

import os
backupdir = os.getcwd()

import numpy as np
import pysces

tbox=pysces.PyscesUtils.TimerBox()
import time

m=pysces.model('isola2a')

ser = pysces.Scanner(m)

print("Serial execution...")
print("Start: ", tbox.normal_timer('SER'))
print(next(tbox.SER))
t1=time.time()
ser.quietRun = True
ser.addScanParameter('V4',60,100,11)
ser.addScanParameter('V1',100,160,16)
ser.addScanParameter('V2',100,130,16,slave=True)
ser.addScanParameter('V3',80,90,6)
ser.addUserOutput('J_R1', 'A', 'ecR4_X','ccJR1_R1')
github PySCeS / pysces / pysces / examples / testinvalidstate.py View on Github external
#!/usr/bin/env python
# Testing the new parallel scanner class - detection of invalid states
# --jr20101218

import os
backupdir = os.getcwd()

import numpy as np
import pysces

tbox=pysces.PyscesUtils.TimerBox()
import time

m=pysces.model('isola2a')

ser = pysces.Scanner(m)

print("Serial execution...")
print("Start: ", tbox.normal_timer('SER'))
print(next(tbox.SER))
t1=time.time()
ser.quietRun = True
ser.addScanParameter('V4',0.01,200,2000,log=True)
ser.addUserOutput('J_R1', 'A')
ser.Run()
print("Done: ", next(tbox.SER))
t2=time.time()
github PySCeS / pysces / pysces / examples / testRunScatter.py View on Github external
#!/usr/bin/env python
# Testing the new parallel scanner class

import os
backupdir = os.getcwd()

import numpy as np
import pysces

tbox=pysces.PyscesUtils.TimerBox()
import time

m=pysces.model('isola2a')

print("\n\nParallel execution...using RunScatter")
par2 = pysces.ParScanner(m)
t5=time.time()
par2.addScanParameter('V4',60,100,11)
par2.addScanParameter('V1',100,130,16)
par2.addScanParameter('V2',100,130,16,slave=True)
par2.addScanParameter('V3',80,90,6)
par2.addUserOutput('J_R1', 'A', 'ecR4_X', 'ccJR1_R1')
#par2.addUserOutput('J_R1', 'A')
par2.RunScatter()
t6=time.time()
print("Duration: %.2f seconds" % (t6-t5))
github PySCeS / pysces / pysces / examples / testparscanner.py View on Github external
ser.quietRun = True
ser.addScanParameter('V4',60,100,11)
ser.addScanParameter('V1',100,160,16)
ser.addScanParameter('V2',100,130,16,slave=True)
ser.addScanParameter('V3',80,90,6)
ser.addUserOutput('J_R1', 'A', 'ecR4_X','ccJR1_R1')
#ser.addUserOutput('J_R1', 'A')
ser.Run()
print("Done: ", next(tbox.SER))
t2=time.time()
print("Duration: %.2f seconds" % (t2-t1))
ser.statespersecond = len(ser.ScanSpace)/(t2-t1)
print("States per second: %.1f" % ser.statespersecond)

print("\n\nParallel execution...scans per run =", 100)
par = pysces.ParScanner(m)
par.scans_per_run = 100
t3=time.time()
par.addScanParameter('V4',60,100,11)
par.addScanParameter('V1',100,160,16)
par.addScanParameter('V2',100,130,16,slave=True)
par.addScanParameter('V3',80,90,6)
par.addUserOutput('J_R1', 'A', 'ecR4_X', 'ccJR1_R1')
#par.addUserOutput('J_R1', 'A')
par.Run()
t4=time.time()
print("Duration: %.2f seconds" % (t4-t3))
par.statespersecond = par.Tsteps/(t4-t3)
print("States per second: %.1f" % par.statespersecond)

print("\n Speedup with load balanced TaskClient: %.2f" % (par.statespersecond/ser.statespersecond))
github PySCeS / pysces / pysces / examples / testinvalidstate.py View on Github external
print("Serial execution...")
print("Start: ", tbox.normal_timer('SER'))
print(next(tbox.SER))
t1=time.time()
ser.quietRun = True
ser.addScanParameter('V4',0.01,200,2000,log=True)
ser.addUserOutput('J_R1', 'A')
ser.Run()
print("Done: ", next(tbox.SER))
t2=time.time()
print("Duration: %.2f seconds" % (t2-t1))
ser.statespersecond = len(ser.ScanSpace)/(t2-t1)
print("States per second: %.1f" % ser.statespersecond)

print("\n\nParallel execution...scans per run =", 36)
par = pysces.ParScanner(m)
par.scans_per_run = 36
t3=time.time()
par.addScanParameter('V4',0.01,200,2000,log=True)
par.addUserOutput('J_R1', 'A')
par.Run()
t4=time.time()
print("Duration: %.2f seconds" % (t4-t3))
par.statespersecond = par.Tsteps/(t4-t3)
print("States per second: %.1f" % par.statespersecond)

print("\n Speedup: %.2f" % (par.statespersecond/ser.statespersecond))

print("\n\nParallel execution...with scatter and gather")
par2 = pysces.ParScanner(m)
t5=time.time()
par2.addScanParameter('V4',0.01,200,2000,log=True)
github PySCeS / pysces / pysces / examples / testRunScatter.py View on Github external
#!/usr/bin/env python
# Testing the new parallel scanner class

import os
backupdir = os.getcwd()

import numpy as np
import pysces

tbox=pysces.PyscesUtils.TimerBox()
import time

m=pysces.model('isola2a')

print("\n\nParallel execution...using RunScatter")
par2 = pysces.ParScanner(m)
t5=time.time()
par2.addScanParameter('V4',60,100,11)
par2.addScanParameter('V1',100,130,16)
par2.addScanParameter('V2',100,130,16,slave=True)
par2.addScanParameter('V3',80,90,6)
par2.addUserOutput('J_R1', 'A', 'ecR4_X', 'ccJR1_R1')
#par2.addUserOutput('J_R1', 'A')
par2.RunScatter()
t6=time.time()
print("Duration: %.2f seconds" % (t6-t5))
par2.statespersecond = par2.Tsteps/(t6-t5)
print("States per second: %.1f" % par2.statespersecond)

os.chdir(backupdir)
github PySCeS / pysces / pysces / examples / testparscanner.py View on Github external
par.addScanParameter('V4',60,100,11)
par.addScanParameter('V1',100,160,16)
par.addScanParameter('V2',100,130,16,slave=True)
par.addScanParameter('V3',80,90,6)
par.addUserOutput('J_R1', 'A', 'ecR4_X', 'ccJR1_R1')
#par.addUserOutput('J_R1', 'A')
par.Run()
t4=time.time()
print("Duration: %.2f seconds" % (t4-t3))
par.statespersecond = par.Tsteps/(t4-t3)
print("States per second: %.1f" % par.statespersecond)

print("\n Speedup with load balanced TaskClient: %.2f" % (par.statespersecond/ser.statespersecond))

print("\n\nParallel execution...using RunScatter")
par2 = pysces.ParScanner(m)
t5=time.time()
par2.addScanParameter('V4',60,100,11)
par2.addScanParameter('V1',100,160,16)
par2.addScanParameter('V2',100,130,16,slave=True)
par2.addScanParameter('V3',80,90,6)
par2.addUserOutput('J_R1', 'A', 'ecR4_X', 'ccJR1_R1')
#par2.addUserOutput('J_R1', 'A')
par2.RunScatter()
t6=time.time()
print("Duration: %.2f seconds" % (t6-t5))
par2.statespersecond = par2.Tsteps/(t6-t5)
print("States per second: %.1f" % par2.statespersecond)

print("\n Speedup with RunScatter: %.2f" % (par2.statespersecond/ser.statespersecond))

print("\n===========\nComparing results...")