Parse error in input/poisson_parametric_study.py

Hi,
First of all, sorry for disappearing for a month or so. Things got really busy with moving and starting school again.
I cloned the latest git repository from [1] and issued a make in the root sfepy directory. Then I ran ./runTests.py and everything passed.
So I tried to run the poisson_parametric_study example and got the following parser exception.:
logan@phoenix:~/projects/sfepy$ ./simple.py input/poisson_parametric_study.py sfepy: left over: ['select_circ', 'vary_omega1_size', '__builtins__', '__file__', 'output', '__name__', 'pause', 'nm', '_filename', 'default_diameter', 'debug', 'os', '__doc__'] sfepy: reading mesh (database/square_circ.vtk)...
sfepy: ...done in 0.02 s
sfepy: setting up domain edges...
sfepy: ...done in 0.01 s
sfepy: creating regions... sfepy: leaf Omega region_Omega__2 parsing failed: Struct:Omega_1 name: Omega_1 select: nodes by select_circ( x, y, z, 0.250000 ) Traceback (most recent call last): File "./simple.py", line 100, in <module> main() File "./simple.py", line 93, in main app = SimpleApp( conf, options, output_prefix ) File "/home/logan/projects/sfepy/sfepy/applications/simple_app.py", line 48, in __init__ **kwargs ) File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 83, in from_conf obj.set_regions(conf.regions, conf.materials, obj.functions) File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 124, in set_regions self.domain.create_regions(conf_regions, functions) File "/home/logan/projects/sfepy/sfepy/fem/domain.py", line 589, in create_regions out = bnf.parseString( rdef.select ) File "/usr/lib/pymodules/python2.5/pyparsing.py", line 1076, in parseString raise exc pyparsing.ParseException: Expected end of text (at char 20), (line:1, col:21)
I fired up winpdb and was able to find the exception raised at line 589 in sfepy/fem/domain.py. It looks it isn't parsing the region definition on line 45 of poisson_parametric_study.py:
'Omega_1' : ('nodes by select_circ( x, y, z, %f )' % default_diameter, {}),
The parser fails on the '(' character in the string 'nodes by select_circ( x, y, z, %f )'. Since I'm not familiar yet with pyparsing, that's as far as I can get for now. Does anyone else see this?
Thanks! Logan
[1] : git://git.sympy.org/sfepy.git

Hi Logan,
Logan Sorenson wrote:
Hi,
First of all, sorry for disappearing for a month or so. Things got really busy with moving and starting school again.
Same here (no school though, just work).
I cloned the latest git repository from [1] and issued a make in the root sfepy directory. Then I ran ./runTests.py and everything passed.
Good, I try to keep the master repo without errors.
So I tried to run the poisson_parametric_study example and got the following parser exception.:
logan@phoenix:~/projects/sfepy$ ./simple.py input/poisson_parametric_study.py sfepy: left over: ['select_circ', 'vary_omega1_size', '__builtins__', '__file__', 'output', '__name__', 'pause', 'nm', '_filename', 'default_diameter', 'debug', 'os', '__doc__'] sfepy: reading mesh (database/square_circ.vtk)...
sfepy: ...done in 0.02 s
sfepy: setting up domain edges...
sfepy: ...done in 0.01 s
sfepy: creating regions... sfepy: leaf Omega region_Omega__2 parsing failed: Struct:Omega_1 name: Omega_1 select: nodes by select_circ( x, y, z, 0.250000 ) Traceback (most recent call last): File "./simple.py", line 100, in <module> main() File "./simple.py", line 93, in main app = SimpleApp( conf, options, output_prefix ) File "/home/logan/projects/sfepy/sfepy/applications/simple_app.py", line 48, in __init__ **kwargs ) File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 83, in from_conf obj.set_regions(conf.regions, conf.materials, obj.functions) File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 124, in set_regions self.domain.create_regions(conf_regions, functions) File "/home/logan/projects/sfepy/sfepy/fem/domain.py", line 589, in create_regions out = bnf.parseString( rdef.select ) File "/usr/lib/pymodules/python2.5/pyparsing.py", line 1076, in parseString raise exc pyparsing.ParseException: Expected end of text (at char 20), (line:1, col:21)
I fired up winpdb and was able to find the exception raised at line 589 in sfepy/fem/domain.py. It looks it isn't parsing the region definition on line 45 of poisson_parametric_study.py:
'Omega_1' : ('nodes by select_circ( x, y, z, %f )' % default_diameter, {}),
The parser fails on the '(' character in the string 'nodes by select_circ( x, y, z, %f )'. Since I'm not familiar yet with pyparsing, that's as far as I can get for now. Does anyone else see this?
Thanks for the bug-report! This input file is not covered by the tests, and it should. Could you submit an issue at [1]? It is also easy to fix, see below.
The error you see is related to implementing the issues 36 and 93, [2,3], i.e. a unification of passing (extra) arguments to BC, material, and region definition functions. There is now a new keyword 'functions', where a function to be used should be registered, and any extra parameters are handled there too. The function is then used by its name only, see, for example, input/octahedron.py (or "git grep 'functions =" to see all the inputs using this feature).
Would you like to try and fix it yourself?
cheers, r.
[1] http://code.google.com/p/sfepy/issues/list [2] http://code.google.com/p/sfepy/issues/detail?id=36&can=1 [3] http://code.google.com/p/sfepy/issues/detail?id=93&can=1

Hi Robert,
Thanks for the bug-report! This input file is not covered by the tests, and it should. Could you submit an issue at [1]? It is also easy to fix, see below.
I opened issue #98 [1]. Should I just open issues for such problems from now on to keep the mailing list free of clutter? :)
The error you see is related to implementing the issues 36 and 93, [2,3], i.e. a unification of passing (extra) arguments to BC, material, and region definition functions. There is now a new keyword 'functions', where a function to be used should be registered, and any extra parameters are handled there too. The function is then used by its name only, see, for example, input/octahedron.py (or "git grep 'functions =" to see all the inputs using this feature).
Would you like to try and fix it yourself?
Ok, based off input/octahedron.py I think was able to figure out how to add the select_circ function. I posted the code in a reply to [1]. However, now I'm getting an IndexError exception which seems to be coming from the material definitions (see the reply to the issue). I'll take another look into that later on.
cheers, r.
Cheers! Logan

Hi Logan,
Logan Sorenson wrote:
Thanks for the bug-report! This input file is not covered by the tests, and it should. Could you submit an issue at [1]? It is also easy to fix, see below.
I opened issue #98 [1]. Should I just open issues for such problems from now on to keep the mailing list free of clutter? :)
Well, the mailing list has been almost dead lately, so it's good to have some discussion here finally :)
The error you see is related to implementing the issues 36 and 93, [2,3], i.e. a unification of passing (extra) arguments to BC, material, and region definition functions. There is now a new keyword 'functions', where a function to be used should be registered, and any extra parameters are handled there too. The function is then used by its name only, see, for example, input/octahedron.py (or "git grep 'functions =" to see all the inputs using this feature).
Would you like to try and fix it yourself?
Ok, based off input/octahedron.py I think was able to figure out how to add the select_circ function. I posted the code in a reply to [1]. However, now I'm getting an IndexError exception which seems to be coming from the material definitions (see the reply to the issue). I'll take another look into that later on.
Good job, thanks!
The error you see is due to a small change in material definition syntax, as described in the issue 93.
However there were other, deeper, problems, that required fixing the sfepy code itself (see the new issue 99). Try the new git version, and let me know if that works. In that case, also close the issue, please. :)
cheers, r.

Hi Robert,
On Thu, Oct 1, 2009 at 4:04 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Well, the mailing list has been almost dead lately, so it's good to have some discussion here finally :)
Ok, in that case, I'm sure I'll have lots to cover. :)
Good job, thanks!
The error you see is due to a small change in material definition syntax, as described in the issue 93.
However there were other, deeper, problems, that required fixing the sfepy code itself (see the new issue 99). Try the new git version, and let me know if that works. In that case, also close the issue, please. :)
I pulled the latest git and poisson_parametric_study.py seems to be working now. Closing this issue. Thanks for your guidance on this! My python skills are pretty small right now, but I hope I can improve. Sfepy is a very interesting project to me for my research so it provides some strong motivation and a good example to study from!
Best regards, Logan

Actually, it seems like I'm not able to close the issue. Do I need special permissions for that on Google groups?
Thanks, Logan

Logan Sorenson wrote:
Actually, it seems like I'm not able to close the issue. Do I need special permissions for that on Google groups?
I guess you need a google account (which you already have, looking at your e-mail), and be among the project members - I have just added you, ok?
Today I am leaving to a big meeting of our department, organized at a rather secluded place in nature (even cell phone signal is extremely hard to get there), so I will be off-line, see you on Monday.
r.

On Fri, Oct 2, 2009 at 4:51 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Logan Sorenson wrote:
Actually, it seems like I'm not able to close the issue. Do I need special permissions for that on Google groups?
I guess you need a google account (which you already have, looking at your e-mail), and be among the project members - I have just added you, ok?
Do I have to be the owner of an issue to close it out?
Today I am leaving to a big meeting of our department, organized at a rather secluded place in nature (even cell phone signal is extremely hard to get there), so I will be off-line, see you on Monday.
Ok, no worries, have a good weekend!
By the way, my research is in MEMS/Microsystems.
Thanks! Logan

Logan Sorenson wrote:
On Fri, Oct 2, 2009 at 4:51 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Logan Sorenson wrote:
Actually, it seems like I'm not able to close the issue. Do I need special permissions for that on Google groups? I guess you need a google account (which you already have, looking at your e-mail), and be among the project members - I have just added you, ok?
Do I have to be the owner of an issue to close it out?
I do not think so... You still cannot close?
Today I am leaving to a big meeting of our department, organized at a rather secluded place in nature (even cell phone signal is extremely hard to get there), so I will be off-line, see you on Monday.
Ok, no worries, have a good weekend!
By the way, my research is in MEMS/Microsystems.
Cool! I would like to see your results in case sfepy helps you.
r.

On Mon, Oct 5, 2009 at 4:23 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Logan Sorenson wrote:
On Fri, Oct 2, 2009 at 4:51 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Logan Sorenson wrote:
Actually, it seems like I'm not able to close the issue. Do I need special permissions for that on Google groups? I guess you need a google account (which you already have, looking at your e-mail), and be among the project members - I have just added you, ok?
Do I have to be the owner of an issue to close it out?
I do not think so... You still cannot close?
Oh, nevermind, I didn't realize everything was done through the bottom of the page for the issue. I marked the issue as verified.
Today I am leaving to a big meeting of our department, organized at a rather secluded place in nature (even cell phone signal is extremely hard to get there), so I will be off-line, see you on Monday.
Ok, no worries, have a good weekend!
By the way, my research is in MEMS/Microsystems.
Cool! I would like to see your results in case sfepy helps you.
Sure, I will do that and make sure to cite sfepy in any papers.
Thanks! Logan

Logan Sorenson wrote:
Hi Robert,
On Thu, Oct 1, 2009 at 4:04 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Well, the mailing list has been almost dead lately, so it's good to have some discussion here finally :)
Ok, in that case, I'm sure I'll have lots to cover. :)
Yes, please, do not hesitate to ask here.
Good job, thanks!
The error you see is due to a small change in material definition syntax, as described in the issue 93.
However there were other, deeper, problems, that required fixing the sfepy code itself (see the new issue 99). Try the new git version, and let me know if that works. In that case, also close the issue, please. :)
I pulled the latest git and poisson_parametric_study.py seems to be working now. Closing this issue. Thanks for your guidance on this! My python skills are pretty small right now, but I hope I can improve. Sfepy is a very interesting project to me for my research so it provides some strong motivation and a good example to study from!
I am glad to hear that! What is your field of research by the way?
cheers, r.
participants (2)
-
Logan Sorenson
-
Robert Cimrman