libAtoms / abcd

1 stars 4 forks source link

problem with formula summary under --all #50

Closed gabor1 closed 4 years ago

gabor1 commented 5 years ago
gc121mac1:~ gabor$ docker exec quip abcd summary -q volker -q 'energy_per_atom < -134' -p energy_per_atom -p formula

info.energy_per_atom  count: 606  min: -157.5082 med: -145.08839 max: -134.26744   std: 6.844526 var:46.847536
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉               56 [-157.51, -155.18)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉             59 [-155.18, -152.86)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉                  49 [-152.86, -150.54)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉                  49 [-150.54, -148.21)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉             60 [-148.21, -145.89)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉             60 [-145.89, -143.56)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉                     44 [-143.56, -141.24)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 84 [-141.24, -138.92)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉   80 [-138.92, -136.59)
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉           65 [-136.59, -134.27)

info.formula count: 606 unique: 43
▉                                         21 C216H6
▉                                         20 C216H35
▉                                         20 C216H29
▉                                         18 C216H32
▉                                         18 C216H30
▉                                         18 C216H2
▉                                         18 C216H16
▉                                         17 C216H36
▉                                         17 C216H34
▉                                         16 C216H38
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 423 ...
gc121mac1:~ gabor$ docker exec quip abcd summary -q volker -q 'energy_per_atom < -134' -p energy_per_atom -p formula --all
Traceback (most recent call last):
  File "/usr/local/bin/abcd", line 11, in <module>
    load_entry_point('abcd==0.4', 'console_scripts', 'abcd')()
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/frontends/shell/__init__.py", line 17, in cli
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/frontends/shell/__init__.py", line 108, in __call__
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/frontends/shell/__init__.py", line 324, in summary
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/backends/atoms_mongoengine.py", line 575, in hist
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/backends/atoms_mongoengine.py", line 596, in _hist_float
  File "/usr/lib/python3/dist-packages/numpy/lib/function_base.py", line 730, in histogram
    norm = bins / (mx - mn)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
gc121mac1:~ gabor$ 
gabor1 commented 5 years ago

in fact this is enough

gc121mac1:~ gabor$ docker exec quip abcd summary -q volker  -p energy_per_atom --all
Traceback (most recent call last):
  File "/usr/local/bin/abcd", line 11, in <module>
    load_entry_point('abcd==0.4', 'console_scripts', 'abcd')()
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/frontends/shell/__init__.py", line 17, in cli
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/frontends/shell/__init__.py", line 108, in __call__
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/frontends/shell/__init__.py", line 324, in summary
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/backends/atoms_mongoengine.py", line 575, in hist
  File "/usr/local/lib/python3.5/dist-packages/abcd-0.4-py3.5.egg/abcd/backends/atoms_mongoengine.py", line 596, in _hist_float
  File "/usr/lib/python3/dist-packages/numpy/lib/function_base.py", line 730, in histogram
    norm = bins / (mx - mn)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
gc121mac1:~ gabor$ 
fekad commented 4 years ago

Yes, it is a special case with floats. The '--all' option doesn't make to much sense in the case of float and integer arrays. Practically all the floats are different. There is two possible way to resolve this issue:

gabor1 commented 4 years ago

I agree that the -- all should do nothing when you are binning stuff and printing all the bins, which is what happens with the floats. but it shouldn't return an error either.

if I ask for a float and a string and --all, then I expect the float to be binned (And this is unaffected by the --all) but the string histogram should be printed in full