Michael-Neales-Macbook-Pro-2% ~/mx/openmx/OpenMx/trunk/inst/tools/mxAlgebraParser.py < ~/mx/openmxscripts/testalgebraparser.txt > ~/mx/openmxscripts/testalgebraparser.out
Traceback (most recent call last):
File "/Users/neale/mx/openmx/OpenMx/trunk/inst/tools/mxAlgebraParser.py", line 149, in
print(parser.parse(input))
File "build/bdist.macosx-10.3-i386/egg/ply/yacc.py", line 265, in parse
File "build/bdist.macosx-10.3-i386/egg/ply/yacc.py", line 921, in parseopt_notrack
File "build/bdist.macosx-10.3-i386/egg/ply/lex.py", line 384, in token
File "/Users/neale/mx/openmx/OpenMx/trunk/inst/tools/mxAlgebraParser.py", line 42, in t_error
raise Exception("Illegal character " + str(t.value[0]))
Exception: Illegal character #
Michael-Neales-Macbook-Pro-2% cat ~/mx/openmxscripts/testalgebraparser.out
Mx parser for multiple groups
The Mx script attached works ok. The parser generates a lot of errors. It is possible that my installation of the parser is the problem, as it has never yet worked for me.
#1
Log in or register to post comments
#2
makeLabels <- function(x) { sapply(x, function(y) { paste('var', y, sep = '') })}
matrixA <- mxMatrix(type = "full", nrow = 1, ncol = 1, free = FALSE, byrow = TRUE, name = "A")
matrixC <- mxMatrix(type = "full", nrow = 1, ncol = 1, free = FALSE, byrow = TRUE, name = "C")
matrixE <- mxMatrix(type = "full", nrow = 1, ncol = 1, free = FALSE, byrow = TRUE, name = "E")
algebraB <- mxAlgebra(cbind(rbind(cbind(A + C + E, A) + C, A) + C, A) + C + E, name = "B")
model <- mxModel(name = "")
model <- mxModel(model, matrixA, matrixC, matrixE)
model <- mxModel(model, algebraB)
Two issues remain:
1. I encounter errors running mxRun(model) in OpenMx
2. The Algebra is not correct, apologies to Muhammad ibn Mūsā al-Khwārizmī, as I suspect that the operators | and _ have not been given sufficiently low priority (they come below + and - in precedence).
Log in or register to post comments
#3
Michael-Neales-Macbook-Pro-2% ~/mx/openmx/OpenMx/trunk/inst/tools/mxParser.py < ~/mx/openmx/Mx\ 1.0\ Scripts/oneloc.mx > ~/mx/openmx/Mx\ 1.0\ Scriptsutneloc.o
Traceback (most recent call last):
File "/Users/neale/mx/openmx/OpenMx/trunk/inst/tools/mxParser.py", line 254, in
parseModel(sys.stdin.read())
File "/Users/neale/mx/openmx/OpenMx/trunk/inst/tools/mxParser.py", line 235, in parseModel
mxInput = tryDirectives(mxInput)
File "/Users/neale/mx/openmx/OpenMx/trunk/inst/tools/mxParser.py", line 220, in tryDirectives
subtract = mxDirectives[directive](mxInput)
File "/Users/neale/mx/openmx/OpenMx/trunk/inst/tools/mxParser.py", line 63, in parseMatrices
declareLines = block.group(1).strip().split('\n')
AttributeError: 'NoneType' object has no attribute 'group'
Log in or register to post comments
#4
Log in or register to post comments
#5
Log in or register to post comments
#6
Log in or register to post comments
#7
Log in or register to post comments