예제 #1
0
파일: engine.py 프로젝트: rat-h/uniPRCsim
 def __init__(self, filename=None, mode="STD"):
     td.Thread.__init__(self)
     global model
     if filename == None:
         sys.stderr.write("Wrong filename\nABBORT\n\n")
         sys.exit(1)
     parser = make_parser()
     parser.setContentHandler(mp.modelparcer())
     parser.parse(filename)
     mp.model.mode = mode
     self.model = mp.model
예제 #2
0
파일: test-all.py 프로젝트: rat-h/uniPRCsim
# details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
###################################
from xml.sax import make_parser
import modelparcer as mp

global model


print "<!-- TEST MODEL-PARSER CLASS --->"
parser=make_parser()
parser.setContentHandler(mp.modelparcer())
parser.parse("example.xml")
print "<!---------- HAS DONE ----------->\n\n"

print "<!-- TEST PRC CLASS --->"
print  "<!-- Type I --->"
p = mp.model.objlst["prc"]["Type I"]
for i in  p.write():
	print i
for test_item in ( (0.2,0.0), (0.2,1.0),(0.2,0.1), (0.1,0.15), (0.25,0.2), (0.15,0.2),
					(0.0,0.2), (0.1,1.2)):
	rst = p.getvl(test_item[0], test_item[1])
	print "gsyn=%g, ph=%g :"% test_item, float(rst[0])," :",float(rst[1])

print "\n<!-- Type II --->"
p = mp.model.objlst["prc"]["Type II"]