adrybakov / rad-tools

Sandbox (mainly condense matter plotting)
https://rad-tools.org
GNU General Public License v3.0
6 stars 6 forks source link

[Bug]: UnboundLocalError: cannot access local variable 'axs' where it is not associated with a value #21

Open Arcadio-Buendia opened 5 days ago

Arcadio-Buendia commented 5 days ago

What happened?

After facing the error with my files I ran an example file in rad-tools/docs/examples/rad-plot-fatbands/collinear-spin-polarized which gave the error


Following DOS seednames (filpdos) are detected:
   * csp
(1/1) Start to work with csp seedname
collinear, spin-polarized case detected.
  1 Ni detected
  2 I detected
Plotting custom plot
Input is understood as:
"Ni":
  * PDOS is summed among the following Ni atoms:
      Ni#1
  * For each Ni atom PDOS is summed among the following projections:
      s#1 s#4 p#2 d#3
Traceback (most recent call last):
  File "/home/prabin/cobra/bin/rad-plot-flatbands", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/prabin/cobra/lib/python3.12/site-packages/radtools/score/plot_fatbands.py", line 384, in main
    manager(**vars(args))
  File "/home/prabin/cobra/lib/python3.12/site-packages/radtools/score/plot_fatbands.py", line 213, in manager
    plot_custom_fatbands(
  File "/home/prabin/cobra/lib/python3.12/site-packages/radtools/dos/fatbands_plotting.py", line 97, in plot_custom_fatbands
    plot_fatbands(
  File "/home/prabin/cobra/lib/python3.12/site-packages/radtools/dos/fatbands_plotting.py", line 277, in plot_fatbands
    plot_entry(axs[i], pdos, projector, xlim, ylim, efermi)
               ^^^
UnboundLocalError: cannot access local variable 'axs' where it is not associated with a value```

The command I ran is ```rad-plot-flatbands --custom "Ni"```

### What did you expect to happen?

flatband pictures should be prepared 

### RAD-tools version

0.9.0 

### Git commit hash

d7611d10a7da50215b7e600c8e6e920777f541d2

### Python version

3.12.5

### OS

Linux

### Additional info about OS

debian 

### Additional informnation

_No response_
adrybakov commented 5 days ago

Hello!

Thank you for the interest in the package.

The script for flatbands is half-done and is not well tested (in terms of the interface). In this particular example the solution might be to add -sep/--separate flag to the command as non-separate style is not implemented at the moment. It worked for the example in the folder that you've mentioned:

rad-plot-flatbands --custom "Ni" -sep

I might try to finalise it in the following weeks, if you have suggestions from the user side for the script (I am having trouble to decide on the style of the flatband plots in particular) please share them! (You can contact me directly or post them as a reply here).

P.S. If you have feedback on the other parts of the package - I will be glad to hear it as well.

Best, Andrey

Arcadio-Buendia commented 3 days ago

Using the -sep option worked for me. Thanks for the library, it's very useful and quite efficient at what it does. If I encounter something else as I use it, I will definitely let you know.