fusion-energy / spectrum_plotter

A Python package for creating publication quality plots for neutron / photon / particle spectrum
MIT License
4 stars 1 forks source link

making openmc convertor optional #29

Open py1sl opened 2 years ago

py1sl commented 2 years ago

How would folk feel about making the openmc tally unit convertor optional either something along the lines of

 try:
        import external_module
    except ImportError:
        external_module = None 

or moving the import into the plot_spectrum_from_tally function?

shimwell commented 2 years ago

Sure we can do this if it helps you in anyway. Feel free to make a PR and we can merge it in.

The openmc_tally_unit_converter is quite minimal, as in it doesn't actually have any dependencies that are not already needed by spectrum plotter. So I can't quite see the benefits myself but if you want it then we will do it

py1sl commented 2 years ago

Spectrum plotter doesn't import openMC directly only via openmc_tally_unit_converter This change would in future allow spectrum plotter to be extended to other codes / be code agnostic allowing consistent plotting with different codes without needing to install openMC.

shimwell commented 2 years ago

Fair enough. Sometimes I forget there are other codes :smile:

Feel free to make a PR and we can merge it in