aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

verdi data trajectory show broken

Open ltalirz opened this issue 5 years ago • 4 comments

tested on aiida-core release_0.12.3:

$ verdi data trajectory show 184
Default format is not defined, please specify.
Valid formats are:
  xcrysden
  jmol
  mpl_heatmap
  mpl_pos
$ verdi data trajectory show 184 --format jmol
Traceback (most recent call last):
  File "/Users/leopold/Applications/miniconda3/envs/aiida_production/bin/verdi", line 11, in <module>
    sys.exit(run())
  File "/Users/leopold/Applications/miniconda3/envs/aiida_production/lib/python2.7/site-packages/aiida/cmdline/verdilib.py", line 1050, in run
    aiida.cmdline.verdilib.exec_from_cmdline(sys.argv)
  File "/Users/leopold/Applications/miniconda3/envs/aiida_production/lib/python2.7/site-packages/aiida/cmdline/verdilib.py", line 1035, in exec_from_cmdline
    CommandClass.run(*argv[command_position + 1:])
  File "/Users/leopold/Applications/miniconda3/envs/aiida_production/lib/python2.7/site-packages/aiida/cmdline/baseclass.py", line 137, in run
    function_to_call(*args[1:])
  File "/Users/leopold/Applications/miniconda3/envs/aiida_production/lib/python2.7/site-packages/aiida/cmdline/baseclass.py", line 217, in run
    function_to_call(*args[1:])
  File "/Users/leopold/Applications/miniconda3/envs/aiida_production/lib/python2.7/site-packages/aiida/cmdline/commands/data.py", line 308, in show
    func(format, n_list, **parsed_args)
  File "/Users/leopold/Applications/miniconda3/envs/aiida_production/lib/python2.7/site-packages/aiida/cmdline/commands/data.py", line 1762, in _show_jmol
    f.write(trajectory._exportstring('cif', **kwargs)[0])
  File "/Users/leopold/Applications/miniconda3/envs/aiida_production/lib/python2.7/site-packages/aiida/orm/data/__init__.py", line 155, in _exportstring
    return func(main_file_name=main_file_name, **kwargs)
TypeError: _prepare_cif() got an unexpected keyword argument 'stepsize'
(aiida_production) leopold@tsf-428-wpa-6-049:~/Personal/Postdoc-MARVEL/Projects/2019-01-CoRE-COF-paper/geoopt-test

I'm happy to fix this but I have a few questions:

  • has somebody already worked on this in the latest provenance_redesign already (not to waste efforts)?
  • do mpl_heatmap and mpl_pos make sense as options here?

Please find attached an export of the trajectory node: traj.zip

ltalirz avatar Jan 31 '19 16:01 ltalirz

@yakutovicha You worked on the new verdi data commands if I remember well - can you help with these questions?

ltalirz avatar Jan 31 '19 16:01 ltalirz

Ok, I tested it on the provenance_redesign branch and looks like the trajectory object can't be shown there either. The error message is different though:

Traceback (most recent call last):
  File "/home/epfl/work/venv-aiida-development/bin/verdi", line 9, in <module>
    sys.exit(verdi())
  File "/home/epfl/work/venv-aiida-development/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/epfl/work/venv-aiida-development/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/epfl/work/venv-aiida-development/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/epfl/work/venv-aiida-development/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/epfl/work/venv-aiida-development/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/epfl/work/venv-aiida-development/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/epfl/work/venv-aiida-development/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/epfl/work/aiida_core/aiida/cmdline/utils/decorators.py", line 72, in decorated_function
    return function(*args, **kwargs)
TypeError: trajectory_show() got an unexpected keyword argument 'trajectory_index'

A small function to create trajectory object:

def create_trajectory_data():
    from aiida.orm.data.array.trajectory import TrajectoryData
    from aiida.orm.groups import Group
    import numpy

    # Create a node with two arrays
    n = TrajectoryData()

    # I create sample data
    stepids = numpy.array([60, 70])
    times = stepids * 0.01
    cells = numpy.array([[[
        2.,
        0.,
        0.,
    ], [
        0.,
        2.,
        0.,
    ], [
        0.,
        0.,
        2.,
    ]], [[
        3.,
        0.,
        0.,
    ], [
        0.,
        3.,
        0.,
    ], [
        0.,
        0.,
        3.,
    ]]])
    symbols = numpy.array(['H', 'O', 'C'])
    positions = numpy.array([[[0., 0., 0.], [0.5, 0.5, 0.5], [1.5, 1.5, 1.5]], [[0., 0., 0.], [0.5, 0.5, 0.5],
                                                                                [1.5, 1.5, 1.5]]])
    velocities = numpy.array([[[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]], [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5],
                                                                           [-0.5, -0.5, -0.5]]])

    # I set the node
    n.set_trajectory(
        stepids=stepids, cells=cells, symbols=symbols, positions=positions, times=times, velocities=velocities)

    return n.store()

yakutovicha avatar Jan 31 '19 17:01 yakutovicha

I just encountered this problem with aiida==1.6.5. The error message for me is

TypeError: trajectory_show() got an unexpected keyword argument 'trajectory_index'

I think it is because show_options includes options.TRAJECTORY_INDEX()

ryotatomioka avatar Feb 24 '22 16:02 ryotatomioka

also ​options.WITH_ELEMENTS()​ seems to cause a problem

ryotatomioka avatar Feb 24 '22 17:02 ryotatomioka