optados-developers / optados

Official Repository of the Optados code
http://www.optados.org
20 stars 22 forks source link

Python Script to Turn a PDIS into a plot #13

Open ajm143 opened 4 years ago

ajm143 commented 4 years ago

Write a python script to turn pdis into a plot (the input to this program will be a file with the structure of a 'bands' file)

ml-evs commented 4 years ago

I've already implemented this as part of matador (in spectral_plotting submodule), see example below. We discussed extracting the relevant plotting functions from matador to do arbitrary projected bandstructure plots in this manner (for e.g. contributions to EELS); this will require a fair bit of extra work as the matador dispersion script depends on all of the matador scraper functions and data classes. If you wanted to depend on matador directly it'd spur me to register a package on PyPi, though I will only support Python 3.

LCO

The core plotting routine is _ordered_scatter which ensures the smallest contribution is always plotted on top and interpolates the bands for smoothness.

Happy to help out, whatever you decide.

ml-evs commented 4 years ago

After a quick discussion with @ajm143 we have a few options:

i) I try to extract the relevant parts of matador into a standalone Python 3 script that only depends on matplotlib and numpy (which I think is a reasonable expectation). This will obviously have to be maintained somehow...

ii) Depend on matador as a git submodule only with a simple entry point Python script from inside OptaDOS (linked at compile time) that provides the same functionality as (i), but hopefully maintenance will carry on at the matador end (and I'd be happy to include any other projections that get introduced to OptaDOS).

iii) Write a script that somehow generates Python code that will make the plot in a customisable way (a la current xmgrace solution). This will be tricky, and any editing of the script will probably require Python knowledge...

The main problem here is the lack of customisability compared to the xmgrace plot. In matador I adhere to the user's matplotlib style sheet (examples) so perhaps writing a script that also does this with e.g. a user-defined map between projection labels->colours is the most useful thing to do, with either (i) or (ii) above.