def __init__(self, fromMethod=None, fromMatrix=None, avoidingRedundancy = True):
"""
On construit un objet de ce type en fournissant à l'aide de l'un des
- deux mots-clé, soit une fonction python, soit matrice.
+ deux mots-clé, soit une fonction python, soit une matrice.
Arguments :
- fromMethod : argument de type fonction Python
- fromMatrix : argument adapté au constructeur numpy.matrix
+ - avoidingRedundancy : évite ou pas les calculs redondants
"""
self.__NbCallsAsMatrix, self.__NbCallsAsMethod, self.__NbCallsOfCached = 0, 0, 0
self.__AvoidRC = bool( avoidingRedundancy )
keys = [k.replace(base,'') for k in keys]
data = '{'
for k in keys:
- data += '"%s":"%s",'%(k.split('__')[-1],self.dictMCVal[base+k])
+ key = k.split('__')[-1]
+ val = self.dictMCVal[base+k]
+ # print key," = ",val," ",type(val)
+ if isinstance(val, str) and key == "SetSeed":
+ data += '"%s":%s,'%(key,int(val))
+ elif isinstance(val, str) and not (val.count('[')>=2 or val.count('(')>=2):
+ data += '"%s":"%s",'%(key,val)
+ else:
+ data += '"%s":%s,'%(key,val)
+ data = data.replace("'",'"')
data += '}'
self.text_da += data_name + "_config = {} \n"
self.text_da += data_name + "_config['Type'] = '" + data_type + "'\n"
- self.text_da += data_name + "_config['From'] = '" + from_type + "'\n"
+ self.text_da += data_name + "_config['From'] = 'String'\n"
self.text_da += data_name + "_config['Data'] = '" + data + "'\n"
self.text_da += "study_config['" + data_name + "'] = " + data_name + "_config\n"
if Parameters.has_key("CenteredFiniteDifference"):
__Parameters["withCenteredDF"] = Parameters["CenteredFiniteDifference"]
if Parameters.has_key("EnableMultiProcessing"):
- __Parameters["withmpEnabled"] = Parameters["EnableMultiProcessing"]
+ __Parameters["EnableMultiProcessing"] = Parameters["EnableMultiProcessing"]
+ __Parameters["withmpEnabled"] = Parameters["EnableMultiProcessing"]
if Parameters.has_key("NumberOfProcesses"):
- __Parameters["withmpWorkers"] = Parameters["NumberOfProcesses"]
+ __Parameters["NumberOfProcesses"] = Parameters["NumberOfProcesses"]
+ __Parameters["withmpWorkers"] = Parameters["NumberOfProcesses"]
if Script is not None:
__Matrix, __Function = None, None
if Matrix: