Added 'other_parameters' keyword to any scan.
epsi-builds/msspec_python3/pipeline/head There was a failure building this commit Details

This keyword is a dictionary allowing any option
to be passed to Phagen or Spec just before runing
the calculation. It is usefull to pass special options
that are for example set automatically otherwise.
This commit is contained in:
Sylvain Tricot 2021-11-30 16:26:10 +01:00
parent 7567b920a1
commit 925d694099
2 changed files with 23 additions and 12 deletions

View File

@ -616,7 +616,7 @@ class _PED(_MSCALCULATOR):
def _get_scan(self, scan_type='theta', phi=0, def _get_scan(self, scan_type='theta', phi=0,
theta=np.linspace(-70, 70, 141), level=None, theta=np.linspace(-70, 70, 141), level=None,
kinetic_energy=None, data=None, kinetic_energy=None, data=None,
malloc={}): malloc={}, other_parameters={}):
LOGGER.info("Computting the %s scan...", scan_type) LOGGER.info("Computting the %s scan...", scan_type)
if data: if data:
self.iodata = data self.iodata = data
@ -651,6 +651,13 @@ class _PED(_MSCALCULATOR):
self.spectroscopy_parameters.set_parameter('level', level) self.spectroscopy_parameters.set_parameter('level', level)
# It is still possible to change any parameter right before
# runing Phagen or Spec
for k, v in other_parameters.items():
grp_str, parma_str = k.split('.')
grp = getattr(self, grp_str)
grp.set_parameter(parma_str, v, force=True)
self.get_tmatrix() self.get_tmatrix()
self.run_spec(malloc) self.run_spec(malloc)
@ -852,7 +859,7 @@ class _PED(_MSCALCULATOR):
return self.iodata return self.iodata
def get_scattering_factors(self, level='1s', kinetic_energy=None, def get_scattering_factors(self, level='1s', kinetic_energy=None,
data=None): data=None, **kwargs):
"""Computes the scattering factors of all prototypical atoms in the """Computes the scattering factors of all prototypical atoms in the
cluster. cluster.
@ -871,11 +878,12 @@ class _PED(_MSCALCULATOR):
""" """
data = self._get_scan(scan_type='scatf', level=level, data=data, data = self._get_scan(scan_type='scatf', level=level, data=data,
kinetic_energy=kinetic_energy) kinetic_energy=kinetic_energy, **kwargs)
return data return data
def get_theta_scan(self, phi=0, theta=np.linspace(-70, 70, 141), def get_theta_scan(self, phi=0, theta=np.linspace(-70, 70, 141),
level=None, kinetic_energy=None, data=None): level=None, kinetic_energy=None, data=None,
**kwargs):
"""Computes a polar scan of the emitted photoelectrons. """Computes a polar scan of the emitted photoelectrons.
:param phi: The azimuthal angle in degrees. See :param phi: The azimuthal angle in degrees. See
@ -892,11 +900,12 @@ class _PED(_MSCALCULATOR):
""" """
data = self._get_scan(scan_type='theta', level=level, theta=theta, data = self._get_scan(scan_type='theta', level=level, theta=theta,
phi=phi, kinetic_energy=kinetic_energy, data=data) phi=phi, kinetic_energy=kinetic_energy,
data=data, **kwargs)
return data return data
def get_phi_scan(self, phi=np.linspace(0, 359, 359), theta=0, def get_phi_scan(self, phi=np.linspace(0, 359, 359), theta=0,
level=None, kinetic_energy=None, data=None): level=None, kinetic_energy=None, data=None, **kwargs):
"""Computes an azimuthal scan of the emitted photoelectrons. """Computes an azimuthal scan of the emitted photoelectrons.
:param phi: All the values of the azimuthal angle to be computed. See :param phi: All the values of the azimuthal angle to be computed. See
@ -913,12 +922,13 @@ class _PED(_MSCALCULATOR):
""" """
data = self._get_scan(scan_type='phi', level=level, theta=theta, data = self._get_scan(scan_type='phi', level=level, theta=theta,
phi=phi, kinetic_energy=kinetic_energy, data=data) phi=phi, kinetic_energy=kinetic_energy,
data=data, **kwargs)
return data return data
def get_theta_phi_scan(self, phi=np.linspace(0, 360), def get_theta_phi_scan(self, phi=np.linspace(0, 360),
theta=np.linspace(0, 90, 45), level=None, theta=np.linspace(0, 90, 45), level=None,
kinetic_energy=None, data=None): kinetic_energy=None, data=None, **kwargs):
"""Computes a stereographic scan of the emitted photoelectrons. """Computes a stereographic scan of the emitted photoelectrons.
The azimuth ranges from 0 to 360° and the polar angle ranges from 0 to The azimuth ranges from 0 to 360° and the polar angle ranges from 0 to
@ -935,11 +945,11 @@ class _PED(_MSCALCULATOR):
""" """
data = self._get_scan(scan_type='theta_phi', level=level, theta=theta, data = self._get_scan(scan_type='theta_phi', level=level, theta=theta,
phi=phi, kinetic_energy=kinetic_energy, data=data, phi=phi, kinetic_energy=kinetic_energy, data=data,
malloc={'NPH_M': 8000}) malloc={'NPH_M': 8000}, **kwargs)
return data return data
def get_energy_scan(self, phi=0, theta=0, def get_energy_scan(self, phi=0, theta=0,
level=None, kinetic_energy=None, data=None): level=None, kinetic_energy=None, data=None, **kwargs):
"""Computes an energy scan of the emitted photoelectrons. """Computes an energy scan of the emitted photoelectrons.
:param phi: All the values of the azimuthal angle to be computed. See :param phi: All the values of the azimuthal angle to be computed. See
@ -956,7 +966,8 @@ class _PED(_MSCALCULATOR):
""" """
data = self._get_scan(scan_type='energy', level=level, theta=theta, data = self._get_scan(scan_type='energy', level=level, theta=theta,
phi=phi, kinetic_energy=kinetic_energy, data=data) phi=phi, kinetic_energy=kinetic_energy,
data=data, **kwargs)
return data return data

View File

@ -1540,7 +1540,7 @@ class CalculationParameters(BaseParameters):
Parameter('cutoff_factor', types=(int, float), Parameter('cutoff_factor', types=(int, float),
limits=(1e-4, 999.9999), default=0.01, private=False), limits=(1e-4, 999.9999), default=0.01, private=False),
Parameter('mean_free_path', types=(int, float, str), Parameter('mean_free_path', types=(int, float, str),
default='SeahDench', allowed_values=('mono', 'SeahDench'), default='SeahDench', #allowed_values=('mono', 'SeahDench'),
doc=""" doc="""
The electron mean free path value. You can either: The electron mean free path value. You can either:
- Enter a value (in Angströms), in this case any value <=0 will disable the damping - Enter a value (in Angströms), in this case any value <=0 will disable the damping