PaNOSC-ViNYL / SimEx

Start-to-end photon experiment simulation platform
https://simex.readthedocs.io/
GNU General Public License v3.0
26 stars 25 forks source link

Bug hunting in simex_platform and tutorials #147

Open CFGrote opened 6 years ago

CFGrote commented 6 years ago
ax3l commented 6 years ago

Added installation/dependency bugs. The first impression and hurdles during a first try decide about the acceptance/success/spread of a project.

I am thinking about workflows like: quick-start with a container, one-line installation with e.g. spack, simple and well-running examples, maybe mybinder "try it online" versions. We need to check if they are automated as much as possible (deploy) and still working as expected.

n01r commented 6 years ago
rshopa commented 5 years ago

Two bugs, one regarding PMI diagnostics (pmi_diagnostics.py), second from PlasmaXRTSCalculator example:

In[33]: import numpy as np
        import matplotlib.pyplot as plt
        %run ../simex_platform/Sources/python/ScriptCollection/DataAnalysis/pmi/pmi_diagnostics.py

  File "/mnt/home/rshopa/SIMEX/simex_platform/Sources/python/ScriptCollection/DataAnalysis/pmi/pmi_diagnostics.py", line 118
    if a_comm == 'plot-disp':
     ^
IndentationError: expected an indented block
parameters = PlasmaXRTSCalculatorParameters(
             elements=[['Be', 1, -1]],      # Stochiometry and partial charges
             photon_energy=4960.0,          # [eV]
             scattering_angle=30.0,         # [deg]
             electron_temperature=13.0,     # [eV/kB]
             electron_density=3.0e23,       # [1/cm**3]
             ion_temperature=6.0,           # [eV]
             ion_charge=2.0,
             mass_density=1.85,             # [g/cm**3]
             debye_temperature=None,
             band_gap=None,
             energy_range={'min' : -200.0,  # Min. energy/eV to calculate (relative to photon energy)
                           'max' :  200.0,  # Max. energy/eV to calculate (relative to photon energy)
                           'step':    1.0}, # Energy binning/eV.
             model_Sii='DH',                # Use Debye-Hueckel
             model_See='BMA',               # Use Born-Mermin
             model_Sbf='IA',                # Use impulse approximation
             model_IPL=0.0,                 # No ionization potential lowering.
             model_Mix=None,                # Use default (advanced mixing).
             lfc=None,                      # No local field correction.
             Sbf_norm=None,                 # No normalization of the bound-free spectrum.
             source_spectrum='GAUSS',       # Source spectrum will be taken from wavefront input.
             source_spectrum_fwhm=5,        # Not needed here.
                )
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-a36feca9ed9d> in <module>
     21              Sbf_norm=None,                 # No normalization of the bound-free spectrum.
     22              source_spectrum='GAUSS',       # Source spectrum will be taken from wavefront input.
---> 23              source_spectrum_fwhm=5,        # Not needed here.
     24                 )

~/SIMEX/simex_platform/lib/python3.6/SimEx/Parameters/PlasmaXRTSCalculatorParameters.py in __init__(self, elements, photon_energy, scattering_angle, electron_temperature, electron_density, ion_temperature, ion_charge, mass_density, debye_temperature, band_gap, energy_range, model_Sii, model_See, model_Sbf, model_IPL, model_Mix, lfc, Sbf_norm, source_spectrum, source_spectrum_fwhm, **kwargs)
    139         self.__electron_temperature = checkAndSetElectronTemperature(electron_temperature)
    140         # Set electron density, charge, and mass density depending on which input was given.
--> 141         self.__electron_density, self.__ion_charge, self.__mass_density = checkAndSetDensitiesAndCharge(electron_density, ion_charge, mass_density, elements)
    142         self.__ion_temperature   = checkAndSetIonTemperature(ion_temperature, self.electron_temperature)
    143         self.__debye_temperature = checkAndSetDebyeTemperature(debye_temperature)

~/SIMEX/simex_platform/lib/python3.6/SimEx/Parameters/PlasmaXRTSCalculatorParameters.py in checkAndSetDensitiesAndCharge(electron_density, ion_charge, mass_density, elements)
    684 
    685     if abs( electron_density / (mass_density * ion_charge * Avogadro / molar_weight) - 1. ) > 1e-4:
--> 686         raise ValueError( "Electron density, mass_density, and ion charge are not internally consistent: ne = %5.4e/cm**3, rho*Zf*NA/u= %5.4e/cm**3." % (electron_density, mass_density * ion_charge * Avogadro/molar_weight) )
    687 
    688     return electron_density, ion_charge, mass_density

ValueError: Electron density, mass_density, and ion charge are not internally consistent: ne = 3.0000e+23/cm**3, rho*Zf*NA/u= 2.4724e+23/cm**3.
CFGrote commented 5 years ago

thanks for reporting these, i'll take a look. the indentation is trivial, the xrts is a missing unit.

On 7/11/19 2:59 PM, Roman Shopa wrote:

Two bugs, one regarding PMI diagnostics (pmi_diagnostics.py), second from PlasmaXRTSCalculator example:

|In[33]: import numpy as np import matplotlib.pyplot as plt %run ../simex_platform/Sources/python/ScriptCollection/DataAnalysis/pmi/pmi_diagnostics.py File "/mnt/home/rshopa/SIMEX/simex_platform/Sources/python/ScriptCollection/DataAnalysis/pmi/pmi_diagnostics.py", line 118 if a_comm == 'plot-disp': ^ IndentationError: expected an indented block |

|parameters = PlasmaXRTSCalculatorParameters( elements=[['Be', 1, -1]],

Stochiometry and partial charges photon_energy=4960.0, # [eV]

scattering_angle=30.0, # [deg] electron_temperature=13.0, # [eV/kB] electron_density=3.0e23, # [1/cm3] ion_temperature=6.0, # [eV] ion_charge=2.0, mass_density=1.85, # [g/cm3] debye_temperature=None, band_gap=None, energy_range={'min' : -200.0, # Min. energy/eV to calculate (relative to photon energy) 'max' : 200.0, # Max. energy/eV to calculate (relative to photon energy) 'step': 1.0}, # Energy binning/eV. model_Sii='DH', # Use Debye-Hueckel model_See='BMA', # Use Born-Mermin model_Sbf='IA', # Use impulse approximation model_IPL=0.0, # No ionization potential lowering. model_Mix=None, # Use default (advanced mixing). lfc=None, # No local field correction. Sbf_norm=None, # No normalization of the bound-free spectrum. source_spectrum='GAUSS', # Source spectrum will be taken from wavefront input. source_spectrum_fwhm=5, # Not needed here. )

ValueError Traceback (most recent call last)

in 21 Sbf_norm=None, # No normalization of the bound-free spectrum. 22 source_spectrum='GAUSS', # Source spectrum will be taken from wavefront input. ---> 23 source_spectrum_fwhm=5, # Not needed here. 24 ) ~/SIMEX/simex_platform/lib/python3.6/SimEx/Parameters/PlasmaXRTSCalculatorParameters.py in __init__(self, elements, photon_energy, scattering_angle, electron_temperature, electron_density, ion_temperature, ion_charge, mass_density, debye_temperature, band_gap, energy_range, model_Sii, model_See, model_Sbf, model_IPL, model_Mix, lfc, Sbf_norm, source_spectrum, source_spectrum_fwhm, **kwargs) 139 self.__electron_temperature = checkAndSetElectronTemperature(electron_temperature) 140 # Set electron density, charge, and mass density depending on which input was given. --> 141 self.__electron_density, self.__ion_charge, self.__mass_density = checkAndSetDensitiesAndCharge(electron_density, ion_charge, mass_density, elements) 142 self.__ion_temperature = checkAndSetIonTemperature(ion_temperature, self.electron_temperature) 143 self.__debye_temperature = checkAndSetDebyeTemperature(debye_temperature) ~/SIMEX/simex_platform/lib/python3.6/SimEx/Parameters/PlasmaXRTSCalculatorParameters.py in checkAndSetDensitiesAndCharge(electron_density, ion_charge, mass_density, elements) 684 685 if abs( electron_density / (mass_density * ion_charge * Avogadro / molar_weight) - 1. ) > 1e-4: --> 686 raise ValueError( "Electron density, mass_density, and ion charge are not internally consistent: ne = %5.4e/cm**3, rho*Zf*NA/u= %5.4e/cm**3." % (electron_density, mass_density * ion_charge * Avogadro/molar_weight) ) 687 688 return electron_density, ion_charge, mass_density ValueError: Electron density, mass_density, and ion charge are not internally consistent: ne = 3.0000e+23/cm**3, rho*Zf*NA/u= 2.4724e+23/cm**3. | — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .