if cr.match(ln): return 1
return 0
AdjointOperatorInNS.info = u"The Python file has to contain explicitly an \\"AdjointOperator\\" function definition with only one pair of vectors as argument."
+def ColDataFileExtVal(filename):
+ __readable = (".csv", ".tsv", ".txt", ".npy", ".npz")
+ if os.path.exists(filename) and os.path.splitext(filename)[1] in __readable:
+ return 1
+ return 0
+ColDataFileExtVal.info = u"The data file has to contain explicitly one or more number columns with separator, or one variable, that can fit in a unique continuous vector."
"""%(module_version.name,module_version.cata)
# Important : validators=[...] pour que les conditions soient traitees simultanement, en "ET", et pas en "OU" (choisi dans le cas du tuple a la place de la liste)
statut = statut,
FROM = SIMP(statut = "o", typ = "TXM", into=({data_into}), defaut={data_default}),
SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
- SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
+ SCRIPT_FILE = SIMP(statut = "o", typ = ("FichierNoAbs",'Python Files (*.py)',), validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
),
STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
STRING = SIMP(statut = "o", typ = "TXM",{ms_default} fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
data = self.dictMCVal[search_type + "STRING_DATA__STRING"]
elif from_type == "Script":
data = self.dictMCVal[search_type + "SCRIPT_DATA__SCRIPT_FILE"]
+ elif from_type == "DataFile":
+ data = self.dictMCVal[search_type + "DATA_DATA__DATA_FILE"]
elif from_type == "ScriptWithSwitch":
data = self.dictMCVal[search_type + "SCRIPTWITHSWITCH_DATA__SCRIPTWITHSWITCH_FILE"]
elif from_type == "ScriptWithFunctions":
else:
raise Exception('From Type unknown', from_type)
- if from_type == "String" or from_type == "Script":
+ if from_type == "String" or from_type == "Script" or from_type == "DataFile":
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"
if msg is not None:
print(msg)
if delta is not None:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
raise AssertionError("%s != %s within %s places"%(first,second,delta))
else:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
raise AssertionError("%s != %s within %i places"%(first,second,places))
return max(abs(numpy.asarray(first) - numpy.asarray(second)))
if msg is not None:
print(msg)
if delta is not None:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
raise AssertionError("%s != %s within %s places"%(first,second,delta))
else:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
raise AssertionError("%s != %s within %i places"%(first,second,places))
return max(abs(numpy.asarray(first) - numpy.asarray(second)))
if msg is not None:
print(msg)
if delta is not None:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
raise AssertionError("%s != %s within %s places"%(first,second,delta))
else:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
raise AssertionError("%s != %s within %i places"%(first,second,places))
return max(abs(numpy.asarray(first) - numpy.asarray(second)))
# ----------
ecart = assertAlmostEqualArrays(Xoptimum, [ 2., 3., 4.])
#
- print(" The maximal absolute error in the test is of %.2e."%ecart)
- print(" The results are correct.")
+ print("The maximal absolute error in the test is of %.2e."%ecart)
+ print("The results are correct.")
print("")
#
return Xoptimum
if msg is not None:
print(msg)
if delta is not None:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
raise AssertionError("%s != %s within %s places"%(first,second,delta))
else:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
raise AssertionError("%s != %s within %i places"%(first,second,places))
return max(abs(numpy.asarray(first) - numpy.asarray(second)))
if msg is not None:
print(msg)
if delta is not None:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
raise AssertionError("%s != %s within %s places"%(first,second,delta))
else:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
raise AssertionError("%s != %s within %i places"%(first,second,places))
return max(abs(numpy.asarray(first) - numpy.asarray(second)))
if msg is not None:
print(msg)
if delta is not None:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > float(delta) ).any():
raise AssertionError("%s != %s within %s places"%(first,second,delta))
else:
- if ( (numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
+ if ( numpy.abs(numpy.asarray(first) - numpy.asarray(second)) > 10**(-int(places)) ).any():
raise AssertionError("%s != %s within %i places"%(first,second,places))
return max(abs(numpy.asarray(first) - numpy.asarray(second)))