diff --git a/src/msspec/calculator.py b/src/msspec/calculator.py index dc5d682..d5ba42c 100644 --- a/src/msspec/calculator.py +++ b/src/msspec/calculator.py @@ -747,15 +747,30 @@ class _PED(_MSCALCULATOR): proto_index = i+1 title = 'Scattering factor at {:.3f} eV'.format(kinetic_energy) + mini = min(map(np.min, [dset.sf_real, dset.sf_imag, dset.sf_module])) + maxi = max(map(np.max, [dset.sf_real, dset.sf_imag, dset.sf_module])) view = dset.add_view("Proto. atom #{:d}".format(proto_index), - title=title, projection='polar') + title=title, projection='polar', + ylim=[mini, maxi]) where = "proto_index=={:d}".format(proto_index) view.select('theta', 'sf_module', where=where, legend=r'$|f(\theta)|$') view.select('theta', 'sf_real', where=where, - legend=r'$\Im(f(\theta))$') - view.select('theta', 'sf_imag', where=where, legend=r'$\Re(f(\theta))$') + view.select('theta', 'sf_imag', where=where, + legend=r'$\Im(f(\theta))$') + + if scan_type == 'energy': + absorber_symbol = self.atoms[self.atoms.absorber].symbol + title = (r'Energy scan of {}({}) at $\theta$={:.2f}$\degree$ and ' + '$\phi$={:.2f}$\degree$').format( + absorber_symbol, level, theta, phi) + xlabel = r'Photoelectron kinetic energy (eV)' + ylabel = r'Signal (a. u.)' + + view = dset.add_view("EnergyScan".format(ke), title=title, + xlabel=xlabel, ylabel=ylabel) + view.select('energy', 'cross_section') # save the cluster #clusbuf = StringIO() @@ -922,6 +937,27 @@ class _PED(_MSCALCULATOR): malloc={'NPH_M': 8000}) return data + def get_energy_scan(self, phi=0, theta=0, + level=None, kinetic_energy=None, data=None): + """Computes an energy scan of the emitted photoelectrons. + + :param phi: All the values of the azimuthal angle to be computed. See + :ref:`scanparameters-phi`. + :param theta: The polar angle in degrees. See + :ref:`scanparameters-theta`. + :param level: The electronic level. See :ref:`pedparameters-level`. + :param kinetic_energy: see :ref:`scanparameters-kinetic_energy`. + :param data: a :py:class:`iodata.Data` object to append the results to + or None. + + :returns: The modified :py:class:`iodata.Data` object passed as an + argument or a new :py:class:`iodata.Data` object. + + """ + data = self._get_scan(scan_type='energy', level=level, theta=theta, + phi=phi, kinetic_energy=kinetic_energy, data=data) + return data + class _EIG(_MSCALCULATOR): """ diff --git a/src/msspec/looper.py b/src/msspec/looper.py index ce846d4..89f6fb8 100644 --- a/src/msspec/looper.py +++ b/src/msspec/looper.py @@ -236,7 +236,22 @@ class Looper: df = pd.DataFrame(dfdata, columns=columns) self.data = df - return df + + #return df + # return a list of [x0, y0, x1, y1,...xn, yn] and a list + # of corresponding dict of parameters {'keyA': [val0,...valn], + # 'keyB': [val0,...valn], ...} + + all_xy = [] + for irow, row in df.iterrows(): + all_xy.append(row.output[0]) + all_xy.append(row.output[1]) + parameters = df.to_dict() + parameters.pop('output') + + return all_xy, parameters + + @@ -282,7 +297,7 @@ if __name__ == "__main__": looper = Looper() looper.pipeline = bar - data = looper.run(emitter, emitter_plane, uij, theta, levels, ncpu=1, + data = looper.run(emitter, emitter_plane, uij, theta, levels, ncpu=4, passindex=True) - - print(data[data.emitter_plane.eq(0)].theta.unique()) + print(data) + #print(data[data.emitter_plane.eq(0)].theta.unique()) diff --git a/src/msspec/parameters.py b/src/msspec/parameters.py index 5941b22..493a279 100644 --- a/src/msspec/parameters.py +++ b/src/msspec/parameters.py @@ -853,8 +853,8 @@ class MuffintinParameters(BaseParameters): def __init__(self, phagen_parameters, spec_parameters): parameters = ( Parameter('charge_relaxation', types=bool, default=True, doc=""" - Used to specify wether the charge density of the photoabsorbing atom, which is used - to construct the potential, is allowaed to relax around the core hole or not. + Used to specify whether the charge density of the photoabsorbing atom, which is used + to construct the potential, is allowed to relax around the core hole or not. """), Parameter('ionicity', types=dict, default={}, doc=""" A dictionary to specify the ionicity of each kind of atoms. If empty, the atoms are considered to be diff --git a/src/msspec/spec/fortran/treatment/comp_curves.f b/src/msspec/spec/fortran/treatment/comp_curves.f index 93e245d..4dfe1ac 100644 --- a/src/msspec/spec/fortran/treatment/comp_curves.f +++ b/src/msspec/spec/fortran/treatment/comp_curves.f @@ -113,7 +113,7 @@ C CST PROGRAM COMP_CURVE SUBROUTINE COMP_CURVES() C - PARAMETER (N_SIZE=1000,N_FILES=100,NMAX=9999) + PARAMETER (N_SIZE=1000,N_FILES=1000,NMAX=9999) C INTEGER CC_EXP(N_SIZE),CC_CAL(N_SIZE),VALUE,NVALUE C @@ -1634,7 +1634,7 @@ C Author : D. Sébilleau C C Last modified : 9 Sep 2014 C - PARAMETER (N_SIZE=1000,N_FILES=100) + PARAMETER (N_SIZE=1000,N_FILES=1000) C REAL*4 X_CAL(N_SIZE),I_CAL,X,Y REAL*4 DIFF,STEP1,STEP2 @@ -2955,7 +2955,7 @@ C Author : D. Sébilleau C C Last modified : 5 Sep 2014 C - PARAMETER (N_SIZE=1000,N_FILES=100) + PARAMETER (N_SIZE=1000,N_FILES=1000) C REAL*4 EXPE(N_SIZE),CALCULATION(N_SIZE,N_FILES) REAL*4 MIN_EXP,MIN_CAL,MINIMUM,SHIFT @@ -9748,7 +9748,7 @@ C Author : D. Sébilleau C C Last modified : 19 Aug 2014 C - PARAMETER (N_SIZE=1000,N_FILES=100) + PARAMETER (N_SIZE=1000,N_FILES=1000) C REAL*4 EXPE(N_SIZE),CALC(N_SIZE),Y_MEAN(N_SIZE) real*4 x(N_SIZE)