Skip to content

Commit

Permalink
update tests to use gold standards
Browse files Browse the repository at this point in the history
  • Loading branch information
Cleveland committed Jan 8, 2024
1 parent 9dca763 commit 3d7101e
Show file tree
Hide file tree
Showing 22 changed files with 362 additions and 20 deletions.
8 changes: 5 additions & 3 deletions opppy/dump_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

from opppy.progress import progress

USE_THREADS = not os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('false', '0', 'f')

USE_THREADS = os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('true', '1', 't')

def point_value_1d(data, x_key, value_key, x_value, method='nearest'):
'''
Expand Down Expand Up @@ -489,7 +488,10 @@ def extract_series_2d_slice(data_list,series_key,value_key,dim_keys, slice_value

def append_dumps(data, dump_files, opppy_parser, key_words=None):
'''
Append output data from a list of output_files to a user provided dictionary using a user proved opppy_parser
Append output data from a list of output_files to a user provided dictionary using a user proved
opppy_parser. By default this function will use the multiprocessing option to parallelize the
parsing of multiple dumps. The parallel parsing can be disabled by setting
the environment variable 'OPPPY_USE_THREADS=False'
Input options:
data opppy input dictionary to be append to (must have a 'verion' opppy key)
Expand Down
10 changes: 6 additions & 4 deletions opppy/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
from opppy.version import __version__
from opppy.progress import *

USE_THREADS = not os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('false', '0', 'f')


USE_THREADS = os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('true', '1', 't')

def append_cycle_data(cycle_data, data, sort_key_string):
'''
Expand Down Expand Up @@ -317,7 +315,11 @@ def extract_cycle_data(cycle_string, my_opppy_parser):

def append_output_dictionary(data, output_files, opppy_parser, append_date=False):
'''
Append output data from a list of output_files to a user provided dictionary using a user proved opppy_parser
Append output data from a list of output_files to a user provided dictionary using a user proved
opppy_parser. By default this function will use the multiprocessing option to parallelize the
parsing of multiple dumps. The parallel parsing can be disabled by setting
the environment variable 'OPPPY_USE_THREADS=False'
arguments:
data opppy input dictionary to be append to (must have a 'verion' opppy key)
Expand Down
8 changes: 6 additions & 2 deletions opppy/tally.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from opppy.progress import *
from opppy.output import *

USE_THREADS = not os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('false', '0', 'f')
USE_THREADS = os.getenv("OPPPY_USE_THREADS", 'True').lower() in ('true', '1', 't')

def append_tally_data(cycle_data, data, sort_key_string):
'''
Expand Down Expand Up @@ -216,7 +216,11 @@ def print_tally_data(data):

def append_tally_dictionary(data, output_files, opppy_parser, append_date=False):
'''
Append tally data from a list of output_files to a user provided dictionary using a user proved opppy_parser
Append tally data from a list of output_files to a user provided dictionary using a user proved
opppy_parser. By default this function will use the multiprocessing option to parallelize the
parsing of multiple dumps. The parallel parsing can be disabled by setting the environment
variable 'OPPPY_USE_THREADS=False'
arguments:
data opppy input dictionary to be append to (must have a 'verion' opppy key)
Expand Down
Binary file added tests/gold_2d_line_data.p
Binary file not shown.
Binary file added tests/gold_2d_slice_tracer_data.p
Binary file not shown.
Binary file added tests/gold_2d_tracer_data.p
Binary file not shown.
Binary file added tests/gold_dump0.p
Binary file not shown.
Binary file added tests/gold_dumps.p
Binary file not shown.
Binary file added tests/gold_extract_cycle.p
Binary file not shown.
Binary file added tests/gold_grid_data.p
Binary file not shown.
Binary file added tests/gold_line_data.p
Binary file not shown.
Binary file added tests/gold_output.p
Binary file not shown.
Binary file added tests/gold_point_data.p
Binary file not shown.
Binary file added tests/gold_sub_dump0.p
Binary file not shown.
Binary file added tests/gold_sub_dumps.p
Binary file not shown.
Binary file added tests/gold_tally.p
Binary file not shown.
Binary file added tests/gold_tally_extract_cycle.p
Binary file not shown.
Binary file added tests/gold_tracer_data.p
Binary file not shown.
1 change: 1 addition & 0 deletions tests/my_test_opppy_dump_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def build_data_dictionary(self, filename, dump_keys=None):
if key in line and len(key) is len(line.split(':')[0]):
data[key] = array(str_vector_to_float_vector(line.strip('\n').split(' ')[1:]))


# build xy_verts for 2d mesh plotting example
if 'x' in data and 'y' in data:
xy_verts = []
Expand Down
Loading

0 comments on commit 3d7101e

Please sign in to comment.