SimEx
SimEx copied to clipboard
Bug hunting in simex_platform and tutorials
- [ ] Go through all tutorials and note down all bugs
- [ ] Go through reference manual and note down all bugs and errors
- including installation/dependency bugs
- [ ] Fix them
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.
- #158 : using the tutorial on nano-crystal diffraction
- #163 : using the tutorial notebooks from https://github.com/eucall-software/simex_notebooks
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.
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/cm3, rhoZfNA/u= %5.4e/cm3." % (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/cm3, rhoZfNA/u= 2.4724e+23/cm3. |
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eucall-software/simex_platform/issues/147?email_source=notifications&email_token=ADWCQR6ZJCNPOYYCC3UUVUTP64VBPA5CNFSM4EZBXYN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZWTTZQ#issuecomment-510474726, or mute the thread https://github.com/notifications/unsubscribe-auth/ADWCQR2C7F5JL6CNATN32PLP64VBPANCNFSM4EZBXYNQ.