schrodinger.test.stu.outcomes.standard_workups module¶
Contains the class _PropertyCompare
, and several functions to perform test
workups.
The most commonly used workup is compare_ct_property
@copyright: Schrodinger, LLC. All rights reserved.
- exception schrodinger.test.stu.outcomes.standard_workups.WorkupFailure(msg, *args)[source]¶
Bases:
schrodinger.test.stu.outcomes.failures.WorkupFailure
- args¶
- failure_type = 'workup'¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- schrodinger.test.stu.outcomes.standard_workups.lines_in_file(file_expr, num_lines_target, tolerance)[source]¶
Counts the number of lines in one or more files matching a single shell expansion expression,
file_expr
and checks that they are within +/-tolerance
ofnum_lines_target
.usage: lines_in_file(‘file’, num_lines_target, tolerance)
- schrodinger.test.stu.outcomes.standard_workups.files_exist(*filenames)[source]¶
Checks to see if all the files exist. Inputs are assumed to be filenames or shell expansion expressions representing filenames. Note that shell expansion expressions check for _any_ match (not _all_).
usage: files_exist(‘file1’, ‘file2’, …)
- schrodinger.test.stu.outcomes.standard_workups.file_exists(*filenames)¶
Alias for backwards compatibility.
- schrodinger.test.stu.outcomes.standard_workups.many_files_exist(input_file)[source]¶
Checks to see if all the files exist. Input is assumed to be a file containing list of filenames or shell expansion expressions representing filenames - one filename per line.
- schrodinger.test.stu.outcomes.standard_workups.files_dont_exist(*filenames)[source]¶
Checks to see if all the files don’t exist. Input is assumed to be a list of filenames or shell expansion expressions representing filenames.
usage: files_dont_exist(‘file1’, ‘file2’, …)
- schrodinger.test.stu.outcomes.standard_workups.cts_in_file(filename, num_cts_target, tolerance=0)[source]¶
Counts the number of cts in a file and checks that its within +/- range of the expected number of cts.
usage: cts_in_file(file, num_cts_target, tolerance)
- schrodinger.test.stu.outcomes.standard_workups.cts_less_than(filename, num_cts_upper_bound)[source]¶
Check that
filename
has fewer thannum_cts_upper_bound
cts.
- schrodinger.test.stu.outcomes.standard_workups.cts_greater_than(filename, num_cts_lower_bound)[source]¶
Check that
filename
has greater thannum_cts_lower_bound
cts.
- schrodinger.test.stu.outcomes.standard_workups.compare_ct_property(filename, inp_property, inp_property_target, tolerance=0)[source]¶
Compare property in the first ct to a user-provided value.
example usage: compare_ct_property(‘filename’, ‘inp_property’, 7.5, tolerance=0.01) Tolerance only works for properties that start with i or r (integers or floats).
- schrodinger.test.stu.outcomes.standard_workups.parse_log_file(file_expr, pattern, occurrences=1)[source]¶
Search files for a string. The string must appear at least the required number of times in each file.
- Parameters
file_expr (str) – file(s) to search; treated as a glob expression
pattern (str) – string to search; treated as a simple substring
occurrences (int) – minimum number of times the pattern must appear in each file. As a special case, when occurrences=0, it is treated as a maximum.
Examples:
parse_log_file('job.log', 'Job succeeded!') parse_log_file('dock.log', 'Wrote pose', occurrences=42) parse_log_file('*.out', 'ERRROR', occurrences=0)
- schrodinger.test.stu.outcomes.standard_workups.strict_evaluate_ct_properties(stdvalue_file, structure_file)[source]¶
Deprecated: Please use
compare_ct_properties
if possible.Compare a subset of ct level properties for cts in a file against standard values using strict evaluation.
All properties must match within the provided per-value range in order for the comparison to be a success. Also checks that all expected cts (rows) in standard file have a corresponding match in the structure file. The structure file can have additional cts though.
Use the
evaluate_ct_properties
workup instead to prevent a failure from being triggered when a ct in the standard file is not found in the structure file.- Parameters
stdvalue_file (str) – Path to a PropertyCompare file (must be a csv file with specific columns; see the _PropertyCompare class for details)
structure_file (str) – Path to a Maestro structure file
- schrodinger.test.stu.outcomes.standard_workups.evaluate_ct_properties(stdvalue_file, structure_file)[source]¶
Deprecated: Please use
compare_ct_properties
if possible.Compare a subset of ct level properties for cts in a file against standard values.
All properties must match within the provided per-value range in order for the comparison to be a success.
Note that a failure will NOT be triggered if a ct (row) in the standard file is not located in the structure file. To ensure that all cts in the standard match an entry in the comparison file, please use the workup
strict_evaluate_ct_properties
.- Parameters
stdvalue_file (str) – Path to a PropertyCompare file (must be a csv file with specific columns; see the _PropertyCompare class for details)
structure_file (str) – Path to a Maestro structure file
- schrodinger.test.stu.outcomes.standard_workups.check_for_all_expected_cts(stdvalue_file, structure_file)[source]¶
Look for the existence of all expected cts.
The structure file can have additional cts. Uses PropertyCompare standard file format: https://wiki.schrodinger.com/QA/PropertyCompare
usage: check_for_all_expected_cts(‘std_file’, ‘str_file’)
- schrodinger.test.stu.outcomes.standard_workups.compare_files(filea, fileb, *options)[source]¶
Find the diff of two files and compare the output.
Compare script takes the following arguments.
usage: compare_files(‘filea’, ‘fileb’, ‘-option1’, ‘value1_if_any’, ‘-option2’, ‘value2_if_any’)
Options:
<cutoff> Absolute or relative diff allowed btw numerical fields. Must be a positive number. The default is 0.00001. -r|-rel Compare relative differences btw differing fields. This is the default. -a|-abs Compare absolute differences btw differing fields. The default is to compare relative differences. -m|-mag <mag> Minimum magnitude to use for assessing relative diffs. Must be positive. The default value is 1.0. -z Compare magnitudes only (ignore sign differences). -s|-skip <file> File containing regexps for lines to ignore. By default the file './skip_lines' is used.
- schrodinger.test.stu.outcomes.standard_workups.untar(tar_name, *filenames)[source]¶
Extracts a file from a tar file.
The files file1, file2, etc. will be extracted from tarName. Extract all the files in tarName, if no filename is specified.
usage: untar(tar_name, file1, file2, …)
- schrodinger.test.stu.outcomes.standard_workups.unzip(zip_name, *filenames)[source]¶
Extracts a file from a zip file.
The files file1, file2, etc. will be extracted from zipName.
Extract all the files in zipName,if no file name is specified
usage: unzip(zip_name, file1, file2, …)
- schrodinger.test.stu.outcomes.standard_workups.gunzip(filename)[source]¶
Extracts a file from a gz file. The original file is untouched, and the extracted file has the same name minus the gz extension.
usage: gunzip(filename)