fix relative path for Rawdata and position of arguments for Crim

这个提交包含在:
Sylwia Majchrowska
2021-07-31 23:09:49 +02:00
父节点 63bc9c204b
当前提交 6ad5ba5825
共有 3 个文件被更改,包括 13 次插入11 次删除

查看文件

@@ -217,28 +217,28 @@ def process_multicmds(multicmds):
for cmdinstance in multicmds[cmdname]:
tmp = cmdinstance.split()
if len(tmp) != 9:
if len(tmp) != 10:
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires at exactly nine parameters')
raise ValueError
if (tmp[5][0] != '[' and tmp[5][-1] != ']') or (tmp[6][0] != '[' and tmp[6][-1] != ']'):
if (tmp[3][0] != '[' and tmp[3][-1] != ']') or (tmp[4][0] != '[' and tmp[4][-1] != ']'):
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires list at 6th and 7th position')
raise ValueError
vol_frac = [float(i) for i in tmp[5].strip('[]').split(',')]
material = [float(i) for i in tmp[6].strip('[]').split(',')]
vol_frac = [float(i) for i in tmp[3].strip('[]').split(',')]
material = [float(i) for i in tmp[4].strip('[]').split(',')]
if len(material) % 3 != 0:
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' each material requires three parameters: e_inf, de, tau_0')
raise ValueError
materials = [material[n:n+3] for n in range(0, len(material), 3)]
setup = Crim(f_min=float(tmp[0]), f_max=float(tmp[1]), a=float(tmp[2]),
sigma=float(tmp[3]), mu=float(tmp[4]), mu_sigma=float(tmp[5]),
volumetric_fractions=vol_frac, materials=materials,
number_of_debye_poles=int(tmp[8], material_name=tmp[9]))
sigma=float(tmp[5]), mu=float(tmp[6]), mu_sigma=float(tmp[7]),
number_of_debye_poles=int(tmp[8]), material_name=tmp[9])
_, properties = setup.run()
multicmds['#material'].append(properties[0].split(':')[1].strip(' \t\n'))
multicmds['#add_dispersion_debye'].append(properties[1].split(':')[1].strip(' \t\n'))
cmdname = '#Rawdata'
if multicmds[cmdname] is not None:
for cmdinstance in multicmds[cmdname]:

查看文件

@@ -20,6 +20,7 @@ import numpy as np
import os
from matplotlib import pylab as plt
import matplotlib.gridspec as gridspec
from pathlib import Path
import sys
import scipy.interpolate
import warnings
@@ -60,7 +61,7 @@ class Relaxation(object):
optimizer class (Default: empty dict).
:type optimizer_options: dict, optional, default: empty dict
"""
def __init__(self, sigma, mu, mu_sigma,
material_name, f_n=50,
number_of_debye_poles=-1,
@@ -178,7 +179,7 @@ class Relaxation(object):
q = self.calculation()
# Set the real and the imaginary part of the relaxation function
self.rl, self.im = q.real, q.imag
if self.number_of_debye_poles == -1:
print("\n#########",
"Try to automaticaly fit number of Debye poles, up to 20!",
@@ -609,12 +610,13 @@ class Rawdata(Relaxation):
optimizer=optimizer,
optimizer_options=optimizer_options)
self.delimiter = delimiter
self.filename = filename
self.filename = Path(filename).absolute()
self.params = {'filename':self.filename}
def check_inputs(self):
""" Check the validity of the inputs. """
super(Rawdata, self).check_inputs()
if not os.path.isfile(self.filename):
sys.exit("File doesn't exists!")

查看文件

@@ -2,6 +2,6 @@
#dx_dy_dz: 0.004 0.004 0.004
#time_window: 3000
#Rawdata: ../user_libs/DebyeFit/Test.txt 0.1 1 0.1 3 M4
#Rawdata: user_libs/DebyeFit/Test.txt 0.1 1 0.1 3 M4
#box: 0 0 0 0.07 0.4 0.004 M4