Removed all f-strings.
By replacing f-strings by the standard ".format" call, the package can be now compatible with python3.5
This commit is contained in:
parent
ec0fc248ce
commit
369e743197
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -16,8 +17,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/__init__.py
|
# Source file : src/msspec/__init__.py
|
||||||
# Last modified: ven. 10 avril 2020 17:22:12
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
import ase
|
import ase
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
# coding: utf-8
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# Source file : src/msspec/calcio.py
|
||||||
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Module calcio
|
Module calcio
|
||||||
|
@ -910,7 +930,7 @@ class SpecIO(object):
|
||||||
if content != old_content:
|
if content != old_content:
|
||||||
with open(filename, 'w') as fd:
|
with open(filename, 'w') as fd:
|
||||||
fd.write(content)
|
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
|
modified = True
|
||||||
|
|
||||||
return modified
|
return modified
|
||||||
|
@ -1255,13 +1275,13 @@ class CompCurveIO(object):
|
||||||
data = []
|
data = []
|
||||||
for i in range(1, 13):
|
for i in range(1, 13):
|
||||||
#data.append(np.loadtxt(prefix + f'{i:02d}' + '.txt')[-1])
|
#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))
|
results = results.reshape((-1, 2))
|
||||||
data.append(results[index,1])
|
data.append(results[index,1])
|
||||||
suffix = 'ren'
|
suffix = 'ren'
|
||||||
exp = {'int': None, 'ren': None, 'chi': None, 'cdf': None}
|
exp = {'int': None, 'ren': None, 'chi': None, 'cdf': None}
|
||||||
exp_ren = np.loadtxt(os.path.join('exp', 'div',
|
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',
|
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
|
return data, exp_ren, calc_ren
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -16,8 +17,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/calculator.py
|
# Source file : src/msspec/calculator.py
|
||||||
# Last modified: ven. 10 avril 2020 17:19:24
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -1122,7 +1123,7 @@ class RFACTOR(object):
|
||||||
for i in range(noif):
|
for i in range(noif):
|
||||||
X, Y = args[2*i], args[2*i+1]
|
X, Y = args[2*i], args[2*i+1]
|
||||||
fname = os.path.join('calc',
|
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
|
# And save to the working space
|
||||||
np.savetxt(fname, np.transpose([X, Y]))
|
np.savetxt(fname, np.transpose([X, Y]))
|
||||||
self.stack_count += 1
|
self.stack_count += 1
|
||||||
|
@ -1130,7 +1131,7 @@ class RFACTOR(object):
|
||||||
# Update the list of input calculation files
|
# Update the list of input calculation files
|
||||||
self._params.calc_filename = []
|
self._params.calc_filename = []
|
||||||
for i in range(self.stack_count):
|
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)
|
self._params.calc_filename.append(fname)
|
||||||
|
|
||||||
# Write the input file
|
# Write the input file
|
||||||
|
@ -1225,23 +1226,23 @@ class RFACTOR(object):
|
||||||
dset_values.x, dset_values.yref = exp_data.T
|
dset_values.x, dset_values.yref = exp_data.T
|
||||||
# Append the calculated values
|
# Append the calculated values
|
||||||
ycalc = calc_data[:,1]
|
ycalc = calc_data[:,1]
|
||||||
dset_values.add_columns(**{f"calc{i:d}": ycalc})
|
dset_values.add_columns(**{"calc{:d}".format(i): ycalc})
|
||||||
dset_rfc.add_columns(**{f'variable_set{i:d}': rfc})
|
dset_rfc.add_columns(**{'variable_set{:d}'.format(i): rfc})
|
||||||
|
|
||||||
# Plot the curves
|
# Plot the curves
|
||||||
view_values.select('x', 'yref', legend='Reference values')
|
view_values.select('x', 'yref', legend='Reference values')
|
||||||
title = ''
|
title = ''
|
||||||
for k,v in self.best_values.items():
|
for k,v in self.best_values.items():
|
||||||
title += f'{k}={v} '
|
title += '{}={} '.format(k, v)
|
||||||
view_values.select('x', f"calc{self.index:d}",
|
view_values.select('x', "calc{:d}".format(self.index),
|
||||||
legend="Best calculated values")
|
legend="Best calculated values")
|
||||||
view_values.set_plot_options(title=title)
|
view_values.set_plot_options(title=title)
|
||||||
|
|
||||||
view_results.select('counts')
|
view_results.select('counts')
|
||||||
|
|
||||||
for i in range(self.stack_count):
|
for i in range(self.stack_count):
|
||||||
view_rfc.select('rfactor_number', f'variable_set{i:d}',
|
view_rfc.select('rfactor_number', 'variable_set{:d}'.format(i),
|
||||||
legend=f"variables set #{i:d}")
|
legend="variables set #{:d}".format(i))
|
||||||
# Save the parameters
|
# Save the parameters
|
||||||
for p in self.get_parameters():
|
for p in self.get_parameters():
|
||||||
bundle = {'group': str(p.group),
|
bundle = {'group': str(p.group),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -18,8 +19,8 @@
|
||||||
# along with msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/cli.py
|
# Source file : src/msspec/cli.py
|
||||||
# Last modified: jeu. 04 juin 2020 16:54:12
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -18,8 +19,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/create_tests_results.py
|
# Source file : src/msspec/create_tests_results.py
|
||||||
# Last modified: ven. 10 avril 2020 17:29:16
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
from msspec.tests import create_tests_results
|
from msspec.tests import create_tests_results
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
# -*- encoding: utf-8 -*-
|
#!/usr/bin/env python
|
||||||
# vim: set fdm=indent ts=4 sw=4 sts=4 et ai tw=80 cc=+0 mouse=a nu : #
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# Source file : src/msspec/data/__init__.py
|
||||||
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
from .electron_be import electron_be
|
from .electron_be import electron_be
|
||||||
|
|
|
@ -1,4 +1,24 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
# coding: utf-8
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# Source file : src/msspec/data/electron_be.py
|
||||||
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Module electron_be
|
Module electron_be
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -16,8 +17,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/iodata.py
|
# Source file : src/msspec/iodata.py
|
||||||
# Last modified: ven. 10 avril 2020 17:23:11
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -442,24 +443,24 @@ class DataSet(object):
|
||||||
for k, v in parameters.items():
|
for k, v in parameters.items():
|
||||||
if k == 'Cluster':
|
if k == 'Cluster':
|
||||||
continue
|
continue
|
||||||
s += f"# {k}:\n"
|
s += "# {}:\n".format(k)
|
||||||
if not(isinstance(v, list)):
|
if not(isinstance(v, list)):
|
||||||
v = [v,]
|
v = [v,]
|
||||||
for p in 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
|
return s
|
||||||
|
|
||||||
colnames = self.columns()
|
colnames = self.columns()
|
||||||
with open(filename, mode) as fd:
|
with open(filename, mode) as fd:
|
||||||
# write the date and time of export
|
# write the date and time of export
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
fd.write(f"# Data exported on {now}\n")
|
fd.write("# Data exported on {}\n".format(now))
|
||||||
fd.write(rule)
|
fd.write(rule)
|
||||||
|
|
||||||
# Append notes
|
# Append notes
|
||||||
fd.write("# NOTES:\n")
|
fd.write("# NOTES:\n")
|
||||||
for line in self.notes.split('\n'):
|
for line in self.notes.split('\n'):
|
||||||
fd.write(f"# {line}\n")
|
fd.write("# {}\n".format(line))
|
||||||
fd.write(rule)
|
fd.write(rule)
|
||||||
|
|
||||||
# Append parameters
|
# Append parameters
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -15,9 +16,9 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/iodata.py
|
# Source file : src/msspec/iodata_gi.py
|
||||||
# Last modified: ven. 10 avril 2020 17:23:11
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -491,24 +492,24 @@ class DataSet(object):
|
||||||
for k, v in parameters.items():
|
for k, v in parameters.items():
|
||||||
if k == 'Cluster':
|
if k == 'Cluster':
|
||||||
continue
|
continue
|
||||||
s += f"# {k}:\n"
|
s += "# {}:\n".format(k)
|
||||||
if not(isinstance(v, list)):
|
if not(isinstance(v, list)):
|
||||||
v = [v,]
|
v = [v,]
|
||||||
for p in 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
|
return s
|
||||||
|
|
||||||
colnames = self.columns()
|
colnames = self.columns()
|
||||||
with open(filename, mode) as fd:
|
with open(filename, mode) as fd:
|
||||||
# write the date and time of export
|
# write the date and time of export
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
fd.write(f"# Data exported on {now}\n")
|
fd.write("# Data exported on {}\n".format(now))
|
||||||
fd.write(rule)
|
fd.write(rule)
|
||||||
|
|
||||||
# Append notes
|
# Append notes
|
||||||
fd.write("# NOTES:\n")
|
fd.write("# NOTES:\n")
|
||||||
for line in self.notes.split('\n'):
|
for line in self.notes.split('\n'):
|
||||||
fd.write(f"# {line}\n")
|
fd.write("# {}\n".format(line))
|
||||||
fd.write(rule)
|
fd.write(rule)
|
||||||
|
|
||||||
# Append parameters
|
# Append parameters
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -15,9 +16,9 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/iodata.py
|
# Source file : src/msspec/iodata_wx.py
|
||||||
# Last modified: ven. 10 avril 2020 17:23:11
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -437,24 +438,24 @@ class DataSet(object):
|
||||||
for k, v in parameters.items():
|
for k, v in parameters.items():
|
||||||
if k == 'Cluster':
|
if k == 'Cluster':
|
||||||
continue
|
continue
|
||||||
s += f"# {k}:\n"
|
s += "# {}:\n".format(k)
|
||||||
if not(isinstance(v, list)):
|
if not(isinstance(v, list)):
|
||||||
v = [v,]
|
v = [v,]
|
||||||
for p in 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
|
return s
|
||||||
|
|
||||||
colnames = self.columns()
|
colnames = self.columns()
|
||||||
with open(filename, mode) as fd:
|
with open(filename, mode) as fd:
|
||||||
# write the date and time of export
|
# write the date and time of export
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
fd.write(f"# Data exported on {now}\n")
|
fd.write("# Data exported on {}\n".format(now))
|
||||||
fd.write(rule)
|
fd.write(rule)
|
||||||
|
|
||||||
# Append notes
|
# Append notes
|
||||||
fd.write("# NOTES:\n")
|
fd.write("# NOTES:\n")
|
||||||
for line in self.notes.split('\n'):
|
for line in self.notes.split('\n'):
|
||||||
fd.write(f"# {line}\n")
|
fd.write("# {}\n".format(line))
|
||||||
fd.write(rule)
|
fd.write(rule)
|
||||||
|
|
||||||
# Append parameters
|
# Append parameters
|
||||||
|
|
|
@ -1,6 +1,24 @@
|
||||||
# coding: utf8
|
#!/usr/bin/env python
|
||||||
# -*- encoding: future_fstrings -*-
|
# coding: utf-8
|
||||||
# vim: set et sw=4 ts=4 nu tw=79 cc=+1:
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# Source file : src/msspec/looper.py
|
||||||
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
@ -21,7 +39,7 @@ class Variable:
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Variable(\'{self.name}\')>"
|
return "<Variable(\'{}\')>".format(self.name)
|
||||||
|
|
||||||
class Sweep:
|
class Sweep:
|
||||||
def __init__(self, key, comments="", unit=None,
|
def __init__(self, key, comments="", unit=None,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -18,8 +19,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/misc.py
|
# Source file : src/msspec/misc.py
|
||||||
# Last modified: ven. 10 avril 2020 17:30:42
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -18,8 +19,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/parameters.py
|
# Source file : src/msspec/parameters.py
|
||||||
# Last modified: ven. 10 avril 2020 17:31:50
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -2012,20 +2013,20 @@ class CompCurveGeneralParameters(BaseParameters):
|
||||||
value = p.allowed_values.index(p.value)
|
value = p.allowed_values.index(p.value)
|
||||||
self.compcurve_parameters.general_norm = value
|
self.compcurve_parameters.general_norm = value
|
||||||
LOGGER.info("Curve Comparison: Normalization mode set to "
|
LOGGER.info("Curve Comparison: Normalization mode set to "
|
||||||
f"\"{p.value}\"")
|
"\"{}\"".format(p.value))
|
||||||
|
|
||||||
def bind_rescale(self, p):
|
def bind_rescale(self, p):
|
||||||
self.compcurve_parameters.general_iscale = int(p.value)
|
self.compcurve_parameters.general_iscale = int(p.value)
|
||||||
state = "deactivated"
|
state = "deactivated"
|
||||||
if p.value:
|
if p.value:
|
||||||
state = "activated"
|
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):
|
def bind_function(self, p):
|
||||||
value = p.allowed_values.index(p.value)
|
value = p.allowed_values.index(p.value)
|
||||||
self.compcurve_parameters.general_icur = value
|
self.compcurve_parameters.general_icur = value
|
||||||
LOGGER.info("Curve Comparison: Type of data used for comparison "
|
LOGGER.info("Curve Comparison: Type of data used for comparison "
|
||||||
f"set to \"{p.value}\"")
|
"set to \"{}\"".format(p.value))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -16,8 +17,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/tests.py
|
# Source file : src/msspec/tests.py
|
||||||
# Last modified: ven. 10 avril 2020 17:33:28
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -18,8 +19,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/utils.py
|
# Source file : src/msspec/utils.py
|
||||||
# Last modified: ven. 10 avril 2020 15:49:35
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -66,7 +67,7 @@ class ForeignPotential(object):
|
||||||
self.phagen_data = {'types': []}
|
self.phagen_data = {'types': []}
|
||||||
|
|
||||||
def write(self, filename, prototypical_atoms):
|
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):
|
def DEPRECATEDappend_atom_potential(atom):
|
||||||
Z = atom.number
|
Z = atom.number
|
||||||
|
@ -77,8 +78,8 @@ class ForeignPotential(object):
|
||||||
itypes.append(i)
|
itypes.append(i)
|
||||||
# Check now that we have only one type in the list
|
# Check now that we have only one type in the list
|
||||||
# otherwise we do not know yet how to deal with this.
|
# 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) > 0, "Cannot find the data for atom with Z={}".format(Z)
|
||||||
assert len(itypes) == 1, f"Too many datasets for atom with Z={Z}"
|
assert len(itypes) == 1, "Too many datasets for atom with Z={}".format(Z)
|
||||||
# So far so good, let's write the block
|
# So far so good, let's write the block
|
||||||
t = self.phagen_data['types'][itypes[0]]
|
t = self.phagen_data['types'][itypes[0]]
|
||||||
s = "{:<7d}{:<10d}{:1.4f}\n".format(
|
s = "{:<7d}{:<10d}{:1.4f}\n".format(
|
||||||
|
@ -91,7 +92,7 @@ class ForeignPotential(object):
|
||||||
def append_atom_potential(atom):
|
def append_atom_potential(atom):
|
||||||
line_fmt = "{:+1.8e} " * 4 + "\n"
|
line_fmt = "{:+1.8e} " * 4 + "\n"
|
||||||
atom_type = atom.get('atom_type')
|
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']:
|
for t in self.phagen_data['types']:
|
||||||
if t['atom_type'] == atom_type:
|
if t['atom_type'] == atom_type:
|
||||||
s = "{:<7d}{:<10d}{:1.4f}\n".format(
|
s = "{:<7d}{:<10d}{:1.4f}\n".format(
|
||||||
|
@ -134,7 +135,7 @@ class SPRKKRPotential(ForeignPotential):
|
||||||
self.potfile = potfile
|
self.potfile = potfile
|
||||||
self.load_sprkkr_atom_types()
|
self.load_sprkkr_atom_types()
|
||||||
for f in exported_files:
|
for f in exported_files:
|
||||||
LOGGER.info(f"Loading file {f}...")
|
LOGGER.info("Loading file {}...".format(f))
|
||||||
# get the IT from the filename
|
# get the IT from the filename
|
||||||
m=re.match('SPRKKR-IT_(?P<IT>\d+)-PHAGEN.*', os.path.basename(f))
|
m=re.match('SPRKKR-IT_(?P<IT>\d+)-PHAGEN.*', os.path.basename(f))
|
||||||
it = int(m.group('IT'))
|
it = int(m.group('IT'))
|
||||||
|
@ -188,7 +189,7 @@ class SPRKKRPotential(ForeignPotential):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
# load info in *.pot file
|
# 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:
|
with open(self.potfile, 'r') as fd:
|
||||||
content = fd.read()
|
content = fd.read()
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ class SPRKKRPotential(ForeignPotential):
|
||||||
IT = occupation['ITOQ']
|
IT = occupation['ITOQ']
|
||||||
atom = self.atoms[i]
|
atom = self.atoms[i]
|
||||||
atom.set('atom_type', IT)
|
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))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2016-2020 - Rennes Physics Institute
|
# Copyright © 2016-2020 - Rennes Physics Institute
|
||||||
#
|
#
|
||||||
|
@ -16,8 +17,8 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/version.py
|
# Source file : src/msspec/version.py
|
||||||
# Last modified: ven. 10 avril 2020 17:34:38
|
# Last modified: Mon, 27 Sep 2021 17:49:48 +0200
|
||||||
# Committed by : "Sylvain Tricot <sylvain.tricot@univ-rennes1.fr>"
|
# Committed by : sylvain tricot <sylvain.tricot@univ-rennes1.fr>
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PYTHON = python
|
PYTHON = python
|
||||||
PYMAJ = 3
|
PYMAJ = 3
|
||||||
PYMIN = 6
|
PYMIN = 5
|
||||||
|
|
||||||
FC = gfortran
|
FC = gfortran
|
||||||
F2PY = f2py3 --f77exec=$(FC) --f90exec=$(FC)
|
F2PY = f2py3 --f77exec=$(FC) --f90exec=$(FC)
|
||||||
|
|
Loading…
Reference in New Issue