diff --git a/src/msspec/__init__.py b/src/msspec/__init__.py index acffe9f..5fa3547 100644 --- a/src/msspec/__init__.py +++ b/src/msspec/__init__.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -16,8 +17,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/__init__.py -# Last modified: ven. 10 avril 2020 17:22:12 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot import ase diff --git a/src/msspec/calcio.py b/src/msspec/calcio.py index d83dc74..eaba19e 100644 --- a/src/msspec/calcio.py +++ b/src/msspec/calcio.py @@ -1,5 +1,25 @@ +#!/usr/bin/env python # coding: utf-8 -# vim: set et ts=4 sw=4 fdm=indent mouse=a cc=+1 tw=80: +# +# Copyright © 2016-2020 - Rennes Physics Institute +# +# This file is part of msspec. +# +# msspec is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# msspec is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this msspec. If not, see . +# +# Source file : src/msspec/calcio.py +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot + """ Module calcio @@ -910,7 +930,7 @@ class SpecIO(object): if content != old_content: with open(filename, 'w') as fd: fd.write(content) - LOGGER.debug(f"Writing Spec input file written in {filename}") + LOGGER.debug("Writing Spec input file written in {}".format(filename)) modified = True return modified @@ -1255,13 +1275,13 @@ class CompCurveIO(object): data = [] for i in range(1, 13): #data.append(np.loadtxt(prefix + f'{i:02d}' + '.txt')[-1]) - results = np.loadtxt(prefix + f'{i:02d}' + '.txt') + results = np.loadtxt(prefix + '{:02d}'.format(i) + '.txt') results = results.reshape((-1, 2)) data.append(results[index,1]) suffix = 'ren' exp = {'int': None, 'ren': None, 'chi': None, 'cdf': None} exp_ren = np.loadtxt(os.path.join('exp', 'div', - f'experiment_{suffix}.txt')) + 'experiment_{}.txt'.format(suffix))) calc_ren = np.loadtxt(os.path.join('calc', 'div', - f'calculation{index:d}_{suffix}.txt')) + 'calculation{:d}_{}.txt'.format(index,suffix))) return data, exp_ren, calc_ren diff --git a/src/msspec/calculator.py b/src/msspec/calculator.py index d5ba42c..9f9ef2b 100644 --- a/src/msspec/calculator.py +++ b/src/msspec/calculator.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -16,8 +17,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/calculator.py -# Last modified: ven. 10 avril 2020 17:19:24 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot """ @@ -1122,7 +1123,7 @@ class RFACTOR(object): for i in range(noif): X, Y = args[2*i], args[2*i+1] fname = os.path.join('calc', - f'calculation{self.stack_count:d}.txt') + 'calculation{:d}.txt'.format(self.stack_count)) # And save to the working space np.savetxt(fname, np.transpose([X, Y])) self.stack_count += 1 @@ -1130,7 +1131,7 @@ class RFACTOR(object): # Update the list of input calculation files self._params.calc_filename = [] for i in range(self.stack_count): - fname = os.path.join('calc', f'calculation{i:d}.txt') + fname = os.path.join('calc', 'calculation{:d}.txt'.format(i)) self._params.calc_filename.append(fname) # Write the input file @@ -1225,23 +1226,23 @@ class RFACTOR(object): dset_values.x, dset_values.yref = exp_data.T # Append the calculated values ycalc = calc_data[:,1] - dset_values.add_columns(**{f"calc{i:d}": ycalc}) - dset_rfc.add_columns(**{f'variable_set{i:d}': rfc}) + dset_values.add_columns(**{"calc{:d}".format(i): ycalc}) + dset_rfc.add_columns(**{'variable_set{:d}'.format(i): rfc}) # Plot the curves view_values.select('x', 'yref', legend='Reference values') title = '' for k,v in self.best_values.items(): - title += f'{k}={v} ' - view_values.select('x', f"calc{self.index:d}", + title += '{}={} '.format(k, v) + view_values.select('x', "calc{:d}".format(self.index), legend="Best calculated values") view_values.set_plot_options(title=title) view_results.select('counts') for i in range(self.stack_count): - view_rfc.select('rfactor_number', f'variable_set{i:d}', - legend=f"variables set #{i:d}") + view_rfc.select('rfactor_number', 'variable_set{:d}'.format(i), + legend="variables set #{:d}".format(i)) # Save the parameters for p in self.get_parameters(): bundle = {'group': str(p.group), diff --git a/src/msspec/cli.py b/src/msspec/cli.py index a51d78c..56855b1 100644 --- a/src/msspec/cli.py +++ b/src/msspec/cli.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -18,8 +19,8 @@ # along with msspec. If not, see . # # Source file : src/msspec/cli.py -# Last modified: jeu. 04 juin 2020 16:54:12 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot import sys diff --git a/src/msspec/create_tests_results.py b/src/msspec/create_tests_results.py index f0996d9..5af662b 100644 --- a/src/msspec/create_tests_results.py +++ b/src/msspec/create_tests_results.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -18,8 +19,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/create_tests_results.py -# Last modified: ven. 10 avril 2020 17:29:16 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot from msspec.tests import create_tests_results diff --git a/src/msspec/data/__init__.py b/src/msspec/data/__init__.py index b96b7ca..691ec75 100644 --- a/src/msspec/data/__init__.py +++ b/src/msspec/data/__init__.py @@ -1,5 +1,24 @@ -# -*- encoding: utf-8 -*- -# vim: set fdm=indent ts=4 sw=4 sts=4 et ai tw=80 cc=+0 mouse=a nu : # +#!/usr/bin/env python +# coding: utf-8 +# +# Copyright © 2016-2020 - Rennes Physics Institute +# +# This file is part of msspec. +# +# msspec is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# msspec is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this msspec. If not, see . +# +# Source file : src/msspec/data/__init__.py +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot from .electron_be import electron_be diff --git a/src/msspec/data/electron_be.py b/src/msspec/data/electron_be.py index 9709090..d6c428a 100644 --- a/src/msspec/data/electron_be.py +++ b/src/msspec/data/electron_be.py @@ -1,4 +1,24 @@ +#!/usr/bin/env python # coding: utf-8 +# +# Copyright © 2016-2020 - Rennes Physics Institute +# +# This file is part of msspec. +# +# msspec is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# msspec is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this msspec. If not, see . +# +# Source file : src/msspec/data/electron_be.py +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot """ Module electron_be diff --git a/src/msspec/iodata.py b/src/msspec/iodata.py index cd2a41c..dde6b81 100644 --- a/src/msspec/iodata.py +++ b/src/msspec/iodata.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -16,8 +17,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/iodata.py -# Last modified: ven. 10 avril 2020 17:23:11 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot """ @@ -442,24 +443,24 @@ class DataSet(object): for k, v in parameters.items(): if k == 'Cluster': continue - s += f"# {k}:\n" + s += "# {}:\n".format(k) if not(isinstance(v, list)): v = [v,] for p in v: - s += f"# {p['name']} = {p['value']} {p['unit']}\n" + s += "# {} = {} {}\n".format(p['name'], p['value'], p['unit']) return s colnames = self.columns() with open(filename, mode) as fd: # write the date and time of export now = datetime.now() - fd.write(f"# Data exported on {now}\n") + fd.write("# Data exported on {}\n".format(now)) fd.write(rule) # Append notes fd.write("# NOTES:\n") for line in self.notes.split('\n'): - fd.write(f"# {line}\n") + fd.write("# {}\n".format(line)) fd.write(rule) # Append parameters diff --git a/src/msspec/iodata_gi.py b/src/msspec/iodata_gi.py index 4eb0e91..1742f47 100644 --- a/src/msspec/iodata_gi.py +++ b/src/msspec/iodata_gi.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -15,9 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this msspec. If not, see . # -# Source file : src/msspec/iodata.py -# Last modified: ven. 10 avril 2020 17:23:11 -# Committed by : "Sylvain Tricot " +# Source file : src/msspec/iodata_gi.py +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot """ @@ -491,24 +492,24 @@ class DataSet(object): for k, v in parameters.items(): if k == 'Cluster': continue - s += f"# {k}:\n" + s += "# {}:\n".format(k) if not(isinstance(v, list)): v = [v,] for p in v: - s += f"# {p['name']} = {p['value']} {p['unit']}\n" + s += "# {} = {} {}\n".format(p['name'], p['value'], p['unit']) return s colnames = self.columns() with open(filename, mode) as fd: # write the date and time of export now = datetime.now() - fd.write(f"# Data exported on {now}\n") + fd.write("# Data exported on {}\n".format(now)) fd.write(rule) # Append notes fd.write("# NOTES:\n") for line in self.notes.split('\n'): - fd.write(f"# {line}\n") + fd.write("# {}\n".format(line)) fd.write(rule) # Append parameters diff --git a/src/msspec/iodata_wx.py b/src/msspec/iodata_wx.py index bc1c5b0..861fff9 100644 --- a/src/msspec/iodata_wx.py +++ b/src/msspec/iodata_wx.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -15,9 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this msspec. If not, see . # -# Source file : src/msspec/iodata.py -# Last modified: ven. 10 avril 2020 17:23:11 -# Committed by : "Sylvain Tricot " +# Source file : src/msspec/iodata_wx.py +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot """ @@ -437,24 +438,24 @@ class DataSet(object): for k, v in parameters.items(): if k == 'Cluster': continue - s += f"# {k}:\n" + s += "# {}:\n".format(k) if not(isinstance(v, list)): v = [v,] for p in v: - s += f"# {p['name']} = {p['value']} {p['unit']}\n" + s += "# {} = {} {}\n".format(p['name'], p['value'], p['unit']) return s colnames = self.columns() with open(filename, mode) as fd: # write the date and time of export now = datetime.now() - fd.write(f"# Data exported on {now}\n") + fd.write("# Data exported on {}\n".format(now)) fd.write(rule) # Append notes fd.write("# NOTES:\n") for line in self.notes.split('\n'): - fd.write(f"# {line}\n") + fd.write("# {}\n".format(line)) fd.write(rule) # Append parameters diff --git a/src/msspec/looper.py b/src/msspec/looper.py index 718fbe8..0dbfdc4 100644 --- a/src/msspec/looper.py +++ b/src/msspec/looper.py @@ -1,6 +1,24 @@ -# coding: utf8 -# -*- encoding: future_fstrings -*- -# vim: set et sw=4 ts=4 nu tw=79 cc=+1: +#!/usr/bin/env python +# coding: utf-8 +# +# Copyright © 2016-2020 - Rennes Physics Institute +# +# This file is part of msspec. +# +# msspec is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# msspec is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this msspec. If not, see . +# +# Source file : src/msspec/looper.py +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot from collections import OrderedDict from functools import partial @@ -21,7 +39,7 @@ class Variable: self.doc = doc def __repr__(self): - return f"" + return "".format(self.name) class Sweep: def __init__(self, key, comments="", unit=None, diff --git a/src/msspec/misc.py b/src/msspec/misc.py index 02786a9..e0d5db7 100644 --- a/src/msspec/misc.py +++ b/src/msspec/misc.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -18,8 +19,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/misc.py -# Last modified: ven. 10 avril 2020 17:30:42 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot """ diff --git a/src/msspec/parameters.py b/src/msspec/parameters.py index 493a279..51a3817 100644 --- a/src/msspec/parameters.py +++ b/src/msspec/parameters.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -18,8 +19,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/parameters.py -# Last modified: ven. 10 avril 2020 17:31:50 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot """ @@ -2012,20 +2013,20 @@ class CompCurveGeneralParameters(BaseParameters): value = p.allowed_values.index(p.value) self.compcurve_parameters.general_norm = value LOGGER.info("Curve Comparison: Normalization mode set to " - f"\"{p.value}\"") + "\"{}\"".format(p.value)) def bind_rescale(self, p): self.compcurve_parameters.general_iscale = int(p.value) state = "deactivated" if p.value: state = "activated" - LOGGER.info(f"Curve Comparison: Rescaling of data {state}") + LOGGER.info("Curve Comparison: Rescaling of data {}".format(state)) def bind_function(self, p): value = p.allowed_values.index(p.value) self.compcurve_parameters.general_icur = value LOGGER.info("Curve Comparison: Type of data used for comparison " - f"set to \"{p.value}\"") + "set to \"{}\"".format(p.value)) diff --git a/src/msspec/tests.py b/src/msspec/tests.py index 50246ae..8d76713 100644 --- a/src/msspec/tests.py +++ b/src/msspec/tests.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -16,8 +17,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/tests.py -# Last modified: ven. 10 avril 2020 17:33:28 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot import os diff --git a/src/msspec/utils.py b/src/msspec/utils.py index 1dee866..1355e11 100644 --- a/src/msspec/utils.py +++ b/src/msspec/utils.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -18,8 +19,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/utils.py -# Last modified: ven. 10 avril 2020 15:49:35 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot """ @@ -66,7 +67,7 @@ class ForeignPotential(object): self.phagen_data = {'types': []} def write(self, filename, prototypical_atoms): - LOGGER.debug(f"Writing Phagen input potential file: {filename}") + LOGGER.debug("Writing Phagen input potential file: {}".format(filename)) def DEPRECATEDappend_atom_potential(atom): Z = atom.number @@ -77,8 +78,8 @@ class ForeignPotential(object): itypes.append(i) # Check now that we have only one type in the list # otherwise we do not know yet how to deal with this. - assert len(itypes) > 0, f"Cannot find the data for atom with Z={Z}" - assert len(itypes) == 1, f"Too many datasets for atom with Z={Z}" + assert len(itypes) > 0, "Cannot find the data for atom with Z={}".format(Z) + assert len(itypes) == 1, "Too many datasets for atom with Z={}".format(Z) # So far so good, let's write the block t = self.phagen_data['types'][itypes[0]] s = "{:<7d}{:<10d}{:1.4f}\n".format( @@ -91,7 +92,7 @@ class ForeignPotential(object): def append_atom_potential(atom): line_fmt = "{:+1.8e} " * 4 + "\n" atom_type = atom.get('atom_type') - assert atom_type != None, f"Unable get the atom type!" + assert atom_type != None, "Unable get the atom type!" for t in self.phagen_data['types']: if t['atom_type'] == atom_type: s = "{:<7d}{:<10d}{:1.4f}\n".format( @@ -134,7 +135,7 @@ class SPRKKRPotential(ForeignPotential): self.potfile = potfile self.load_sprkkr_atom_types() for f in exported_files: - LOGGER.info(f"Loading file {f}...") + LOGGER.info("Loading file {}...".format(f)) # get the IT from the filename m=re.match('SPRKKR-IT_(?P\d+)-PHAGEN.*', os.path.basename(f)) it = int(m.group('IT')) @@ -188,7 +189,7 @@ class SPRKKRPotential(ForeignPotential): return data # load info in *.pot file - LOGGER.info(f"Loading SPRKKR *.pot file {self.potfile}...") + LOGGER.info("Loading SPRKKR *.pot file {}...".format(self.potfile)) with open(self.potfile, 'r') as fd: content = fd.read() @@ -229,7 +230,7 @@ class SPRKKRPotential(ForeignPotential): IT = occupation['ITOQ'] atom = self.atoms[i] atom.set('atom_type', IT) - LOGGER.debug(f"Site #{IQ} is type #{IT}, atom {atom}") + LOGGER.debug("Site #{} is type #{}, atom {}".format(IQ, IT, atom)) diff --git a/src/msspec/version.py b/src/msspec/version.py index 0dd57e8..05f004a 100644 --- a/src/msspec/version.py +++ b/src/msspec/version.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding: utf-8 # # Copyright © 2016-2020 - Rennes Physics Institute # @@ -16,8 +17,8 @@ # along with this msspec. If not, see . # # Source file : src/msspec/version.py -# Last modified: ven. 10 avril 2020 17:34:38 -# Committed by : "Sylvain Tricot " +# Last modified: Mon, 27 Sep 2021 17:49:48 +0200 +# Committed by : sylvain tricot import os diff --git a/src/options.mk b/src/options.mk index ec1a2ad..2ef0e2e 100644 --- a/src/options.mk +++ b/src/options.mk @@ -1,6 +1,6 @@ PYTHON = python PYMAJ = 3 -PYMIN = 6 +PYMIN = 5 FC = gfortran F2PY = f2py3 --f77exec=$(FC) --f90exec=$(FC)