get_resolved_dos()
Inconsistent Behavior with atom_indices
Type
#1584
Labels
bug
Something isn't working
Summary
There is a bug in the
get_resolved_dos()
method when plotting the DOS via theelectronic_structure
object. The function behaves differently depending on whetheratom_indices
is a native Pythonint
or anumpy.int64
.pyiron Version and Platform
pyiron: '0.5.2'
pyiron_atomistics: '0.6.12'
Expected Behavior
The
get_resolved_dos()
method should return DOS data with consistent behavior regardless of whetheratom_indices
is anumpy.int64
or a native Pythonint
.Actual Behavior
When passing an
atom_indices
of typenumpy.int64
, the method returns an unexpected output shape.In this case,
132
is a native Pythonint
, andk
is anumpy.int64
, leading to different behaviors despite representing the same index.Steps to Reproduce
get_resolved_dos()
using a Pythonint
asatom_indices
:get_resolved_dos()
using anumpy.int64
asatom_indices
:Further Information, Files, and Links
The issue arises because the following code does not correctly identify
numpy.int64
:A suggested fix is to replace this line with:
This will ensure both
numpy.int64
and nativeint
types are handled correctly. Thanks to @pmrv for this suggestion!The text was updated successfully, but these errors were encountered: