Testing
- class baseclasses.BaseRegTest(ref_file, train=False, comm=None)[source]
The class for handling regression tests.
- Parameters:
- ref_filestr
The name of the reference file, containing its full path.
- trainbool, optional
Whether to train the reference values, or test against existing reference values, by default False
- commMPI communicator, optional
The MPI comm if testing in parallel, by default None
- check_archbool, optional
Whether to check and set the appropriate PETSc arch prior to running tests, by default False. Note this option does not currently work.
- add_metadata(metadata)[source]
Add a metadata entry to the reference file, which is not used when checking reference values.
- Parameters:
- metadatadict
The dictionary of metadata to add
- assert_allclose(actual, reference, name, rtol, atol, full_name=None)[source]
This is basically a wrapper on numpy.testing.assert_allclose with a generated error message
- par_add_norm(name, values, **kwargs)[source]
Add the norm across values from all processors.
- Parameters:
- namestr
The name of the value
- valuesndarray
The array to be added. This must be a numpy array distributed over self.comm
- **kwargs
See
getTol
on how to specif tolerances.
- par_add_sum(name, values, **kwargs)[source]
Add the sum of sum of the values from all processors.
- Parameters:
- namestr
The name of the value
- valuesndarray
The array to be added. This must be a numpy array distributed over self.comm
- **kwargs
See
getTol
on how to specif tolerances.
- par_add_val(name, values, **kwargs)[source]
Add value(values) from parallel process in sorted order
- Parameters:
- namestr
The name of the value
- valuesndarray
The array to be added. This must be a numpy array distributed over self.comm
- **kwargs
See
getTol
on how to specif tolerances.
- root_add_dict(name, d, **kwargs)[source]
Only write from the root proc
- Parameters:
- namestr
The name of the dictionary
- ddict
The dictionary to add
- **kwargs
See
getTol
on how to specif tolerances.
- baseclasses.testing.getTol(**kwargs)[source]
Returns the tolerances based on kwargs. There are two ways of specifying tolerance:
pass in
tol
which will setatol = rtol = tol
individually set
atol
andrtol
If any values are unspecified, the default value will be used.
- Parameters:
- atolfloat
absolute tolerance, default: 1E-12
- rtolfloat
relative tolerance, default: 1E-12
- tolfloat
tolerance. If specified,
atol
andrtol
values are ignored and both set to this value
- Returns:
- rtolfloat
relative tolerance
- atolfloat
absolute tolerance