Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Is it possible to log numpy nan in the logger?

edited June 11 in OpenSesame

Hello!

I am using np.nan in some variables. However the issue is that apparently the logger doesnt accept Nan.
I have the traceback:

File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libqtopensesame/misc/process.py", line 154, in run
    exp.run()
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/experiment.py", line 449, in run
    self.items.execute(self.var.start)
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 103, in execute
    self.run(name)
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 122, in run
    self[name].run()
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/sequence.py", line 51, in run
    self.experiment.items.run(_item)
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 122, in run
    self[name].run()
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/loop.py", line 341, in run
    self.experiment.items.execute(self._item)
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 103, in execute
    self.run(name)
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 122, in run
    self[name].run()
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/sequence.py", line 51, in run
    self.experiment.items.run(_item)
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/item_store.py", line 122, in run
    self[name].run()
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/logger.py", line 49, in run
    self._logvars = self.experiment.log.all_vars()
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/openexp/_log/log.py", line 92, in all_vars
    self._all_vars = list(self.experiment.var.inspect().keys())
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/var_store.py", line 418, in inspect
    for var, desc in item.var_info():
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/experiment.py", line 645, in var_info
    l.append( (var, self.var.get(var, _eval=False)) )
  File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/var_store.py", line 266, in get
    if int(val) == val:
ValueError: cannot convert float NaN to integer

Am I doing something wrong or is it the normal behavior of the logger?

Thanks,

Sylvain

Comments

  • Hi Sylvain,

    Thanks for reporting this. No, you're not doing anything wrong—this is a bug! I'll fix it for the next maintenance release (3.2.5). For now, the only workaround that I can think of is to make sure that there are no nan values in the experimental variables.

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Hey Sebastian,

    Oh ok great if you can implement this!

    Thanks!

    Sylvain

Sign In or Register to comment.