Open eszter137 opened 4 years ago
arithmetic on variables is planned, but doesn’t work yet. it’s a major undertaking ( and will always be MUCH SLOWER than the explicitly written version that doesn’t use operators). you need to put the OR inside the quotes.
This certainly worked for me: abcd summary -q 'filename~"Surf" or filename~"n500”'
I think the “or” needs to be lower case...
-- Gábor
Gábor Csányi Professor of Molecular Modelling Engineering Laboratory, University of Cambridge Pembroke College Cambridge
Pembroke College supports CARA. A Lifeline to Academics at Risk. http://www.cara.ngo/
On 16 Mar 2020, at 12:28, eszter137 notifications@github.com wrote:
I'd like to be able to do something like:
abcd summary -q "ABS(E_MP2_3b)>0.01" -p "E_MP2_3b"
This would be useful when checking for the large differences between 2 calculation methods.
(It could be also solved by the OR operator but I haven't figured out how to use this yet - the following didn't work:
$ abcd summary -q "E_MP2_3b<-0.01" OR "E_MP2_3b>0.01" -p "E_MP2_3b"
$ abcd summary -q "E_MP2_3b<-0.01 OR E_MP2_3b>0.01" -p "E_MP2_3b"
)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I think this is something similar to your example but not working:
$ abcd summary -q '"E_MP2_3b<-0.01" or "E_MP2_3b>0.01"' -p "E_MP2_3b"
Traceback (most recent call last):
File "/home/es732/miniconda3/bin/abcd", line 8, in <module>
sys.exit(main())
File "/home/es732/miniconda3/lib/python3.7/site-packages/abcd/frontends/commandline/parser.py", line 121, in main
callback_func(**kwargs)
File "/home/es732/miniconda3/lib/python3.7/site-packages/abcd/frontends/commandline/decorators.py", line 15, in wrapper
func(*args, config=config, **kwargs)
File "/home/es732/miniconda3/lib/python3.7/site-packages/abcd/frontends/commandline/decorators.py", line 39, in wrapper
query_list.append(parser(q))
File "/home/es732/miniconda3/lib/python3.7/site-packages/abcd/parsers/queries.py", line 136, in __call__
return self.transformer.transform(self.parse(string))
File "/home/es732/miniconda3/lib/python3.7/site-packages/abcd/parsers/queries.py", line 133, in parse
return self.parser.parse(string)
File "/home/es732/miniconda3/lib/python3.7/site-packages/lark/lark.py", line 308, in parse
return self.parser.parse(text, start=start)
File "/home/es732/miniconda3/lib/python3.7/site-packages/lark/parser_frontends.py", line 193, in parse
return self._parse(text, start)
File "/home/es732/miniconda3/lib/python3.7/site-packages/lark/parser_frontends.py", line 54, in _parse
return self.parser.parse(input, start, *args)
File "/home/es732/miniconda3/lib/python3.7/site-packages/lark/parsers/earley.py", line 292, in parse
to_scan = self._parse(stream, columns, to_scan, start_symbol)
File "/home/es732/miniconda3/lib/python3.7/site-packages/lark/parsers/xearley.py", line 137, in _parse
to_scan = scan(i, to_scan)
File "/home/es732/miniconda3/lib/python3.7/site-packages/lark/parsers/xearley.py", line 114, in scan
raise UnexpectedCharacters(stream, i, text_line, text_column, {item.expect.name for item in to_scan}, set(to_scan))
lark.exceptions.UnexpectedCharacters: No terminal defined for 'o' at line 1 col 18
"E_MP2_3b<-0.01" or "E_MP2_3b>0.01"
^
Expecting: {'IN'}
When changing the place of the quotes, I don't get any results:
$ abcd summary -q 'E_MP2_3b<"-0.01" or E_MP2_3b>"0.01"' -p "E_MP2_3b"
though there are definitely structures with either of the queries:
$ abcd summary -q 'E_MP2_3b<-0.01' -p "E_MP2_3b"
E_MP2_3b count: 340 min: -2.8904e-01 med: -2.2580e-02 max: -1.0002e-02 std: 2.7190e-02 var: 7.3930e-04
1 [-2.8904e-01, -0.2611)
0 [-2.6114e-01, -0.2332)
1 [-2.3323e-01, -0.2053)
1 [-2.0533e-01, -0.1774)
0 [-1.7743e-01, -0.1495)
3 [-1.4952e-01, -0.1216)
3 [-1.2162e-01, -0.0937)
▉ 9 [-9.3714e-02, -0.0658)
7 [-6.5810e-02, -0.0379)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 315 [-3.7906e-02, -0.0100)
$ abcd summary -q 'E_MP2_3b>0.01' -p "E_MP2_3b"
E_MP2_3b count: 151 min: 1.0022e-02 med: 1.9160e-02 max: 4.0975e-01 std: 3.3383e-02 var: 1.1144e-03
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 148 [ 1.0022e-02, 0.0500)
1 [ 4.9995e-02, 0.0900)
1 [ 8.9968e-02, 0.1299)
0 [ 1.2994e-01, 0.1699)
0 [ 1.6991e-01, 0.2099)
0 [ 2.0989e-01, 0.2499)
0 [ 2.4986e-01, 0.2898)
0 [ 2.8983e-01, 0.3298)
0 [ 3.2981e-01, 0.3698)
1 [ 3.6978e-01, 0.4098)
it seems it handles numbers within quotes as strings, this won't result in any structures again:
$ abcd summary -q 'E_MP2_3b<"-0.01"' -p "E_MP2_3b"
ok, this version is working finally when removing the internal quotes:
$ abcd summary -q 'E_MP2_3b<-0.01 or E_MP2_3b>0.01' -p "E_MP2_3b"
E_MP2_3b count: 491 min: -2.8904e-01 med: -9.7434e-03 max: 4.0975e-01 std: 3.5010e-02 var: 1.2257e-03
1 [-2.8904e-01, -0.2192)
2 [-2.1916e-01, -0.1493)
▉ 11 [-1.4928e-01, -0.0794)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 326 [-7.9404e-02, -0.0095)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 148 [-9.5247e-03, 0.0604)
2 [ 6.0355e-02, 0.1302)
0 [ 1.3023e-01, 0.2001)
0 [ 2.0011e-01, 0.2700)
0 [ 2.6999e-01, 0.3399)
1 [ 3.3987e-01, 0.4098)
strings are quoted, numbers are not!! But (for strings) the quotes need to be protected from the shell by either enclosing the entire argument of the -q in ‘ (single quotes) or using backslashes on the double quotes.
-- Gábor
Gábor Csányi Professor of Molecular Modelling Engineering Laboratory, University of Cambridge Pembroke College Cambridge
Pembroke College supports CARA. A Lifeline to Academics at Risk. http://www.cara.ngo/
On 16 Mar 2020, at 16:01, eszter137 notifications@github.com wrote:
it seems it handles numbers within quotes as strings, this won't result in any structures again:
$ abcd summary -q 'E_MP2_3b<"-0.01"' -p "E_MP2_3b"
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
I'd like to be able to do something like:
This would be useful when checking for the large differences between 2 calculation methods.
(It could be also solved by the OR operator but I haven't figured out how to use this yet - the following didn't work:
)