Skip to content
Snippets Groups Projects
Commit 031a126b authored by dh00601's avatar dh00601
Browse files

renaming the code

parent 5518e597
No related branches found
No related tags found
No related merge requests found
...@@ -68,22 +68,23 @@ from binarycpython.tests.test_plot_functions import ( ...@@ -68,22 +68,23 @@ from binarycpython.tests.test_plot_functions import (
) )
from binarycpython.tests.test_run_system_wrapper import * from binarycpython.tests.test_run_system_wrapper import *
from binarycpython.tests.tests_population_extensions.test__distribution_functions import ( from binarycpython.tests.tests_population_extensions.test_distribution_functions import (
test_flat, test_flat,
test_number, test_number,
test_const_distribution test_const_distribution,
test_powerlaw
) )
from binarycpython.tests.tests_population_extensions.test__grid_options_defaults import ( from binarycpython.tests.tests_population_extensions.test_grid_options_defaults import (
test_grid_options_help, test_grid_options_help,
test_grid_options_description_checker, test_grid_options_description_checker,
test_write_grid_options_to_rst_file, test_write_grid_options_to_rst_file,
) )
from binarycpython.tests.tests_population_extensions.test__version_info import ( from binarycpython.tests.tests_population_extensions.test_version_info import (
test_return_binary_c_version_info, test_return_binary_c_version_info,
test_parse_binary_c_version_info test_parse_binary_c_version_info
) )
from binarycpython.tests.tests_population_extensions.test__gridcode import ( from binarycpython.tests.tests_population_extensions.test_gridcode import (
test_add_grid_variable, test_add_grid_variable,
) )
......
...@@ -67,18 +67,18 @@ from binarycpython.utils.dicts import ( ...@@ -67,18 +67,18 @@ from binarycpython.utils.dicts import (
keys_to_floats, keys_to_floats,
) )
from binarycpython.utils.population_extensions._analytics import analytics from binarycpython.utils.population_extensions.analytics import analytics
from binarycpython.utils.population_extensions._cache import cache from binarycpython.utils.population_extensions.cache import cache
from binarycpython.utils.population_extensions._dataIO import dataIO from binarycpython.utils.population_extensions.dataIO import dataIO
from binarycpython.utils.population_extensions._distribution_functions import distribution_functions from binarycpython.utils.population_extensions.distribution_functions import distribution_functions
from binarycpython.utils.population_extensions._grid_logging import grid_logging from binarycpython.utils.population_extensions.grid_logging import grid_logging
from binarycpython.utils.population_extensions._grid_options_defaults import grid_options_defaults from binarycpython.utils.population_extensions.grid_options_defaults import grid_options_defaults
from binarycpython.utils.population_extensions._gridcode import gridcode from binarycpython.utils.population_extensions.gridcode import gridcode
from binarycpython.utils.population_extensions._HPC import HPC from binarycpython.utils.population_extensions.HPC import HPC
from binarycpython.utils.population_extensions._metadata import metadata from binarycpython.utils.population_extensions.metadata import metadata
from binarycpython.utils.population_extensions._Moe_di_Stefano_2017 import Moe_di_Stefano_2017 from binarycpython.utils.population_extensions.Moe_di_Stefano_2017 import Moe_di_Stefano_2017
from binarycpython.utils.population_extensions._spacing_functions import spacing_functions from binarycpython.utils.population_extensions.spacing_functions import spacing_functions
from binarycpython.utils.population_extensions._version_info import version_info from binarycpython.utils.population_extensions.version_info import version_info
from binarycpython import _binary_c_bindings from binarycpython import _binary_c_bindings
...@@ -148,6 +148,7 @@ class Population( ...@@ -148,6 +148,7 @@ class Population(
self.grid_options = copy.deepcopy(self.get_grid_options_defaults_dict()) self.grid_options = copy.deepcopy(self.get_grid_options_defaults_dict())
# Custom options # Custom options
# TODO: is this really necessary here? The custom options should be empty on start i think
self.custom_options = { self.custom_options = {
"save_snapshot": False, "save_snapshot": False,
} }
...@@ -172,7 +173,7 @@ class Population( ...@@ -172,7 +173,7 @@ class Population(
self.get_Moe_di_Stefano_2017_default_options() self.get_Moe_di_Stefano_2017_default_options()
) )
# Write MOE2017 options to a file. NOTE: not sure why i put this here anymore # Write MOE2017 options to a file. NOTE: (david) not sure why i put this here anymore
os.makedirs( os.makedirs(
os.path.join(self.grid_options["tmp_dir"], "moe_distefano"), exist_ok=True os.path.join(self.grid_options["tmp_dir"], "moe_distefano"), exist_ok=True
) )
...@@ -222,6 +223,10 @@ class Population( ...@@ -222,6 +223,10 @@ class Population(
# add metadata # add metadata
self.add_system_metadata() self.add_system_metadata()
# set up function cache.
# NOTE: (david) I added this here to be able to test the distributions functions without actually running anything.
self.setup_function_cache()
def jobID(self): def jobID(self):
""" """
Function to return the job ID number of this process Function to return the job ID number of this process
......
...@@ -243,12 +243,13 @@ class cache: ...@@ -243,12 +243,13 @@ class cache:
"function_cache_functions" "function_cache_functions"
].get(func) ].get(func)
# TODO: Make this part better: needs to be able to handle any depth
x = func.split(".") x = func.split(".")
modulename = "binarycpython.utils." + x[0] modulename = "binarycpython.utils.population_extensions." + x[0]
module = importlib.import_module(modulename) module = importlib.import_module(modulename)
_method = eval("module.{}.{}".format(x[0], x[1])) _method = eval("module.{}.{}".format(x[0], x[1]))
if testargs:
if testargs:
def _func_wrap(*args, **kwargs): def _func_wrap(*args, **kwargs):
""" """
wrap to return args and kwargs wrap to return args and kwargs
......
...@@ -673,6 +673,7 @@ class dataIO: ...@@ -673,6 +673,7 @@ class dataIO:
os.sync() os.sync()
dirname = os.path.dirname(filename) dirname = os.path.dirname(filename)
os.scandir(dirname) os.scandir(dirname)
os.scandir.close()
def compression_type(self, filename): def compression_type(self, filename):
""" """
......
...@@ -205,13 +205,13 @@ class grid_options_defaults: ...@@ -205,13 +205,13 @@ class grid_options_defaults:
# set above # set above
# #
# if n is None, no cache is set up # if n is None, no cache is set up
"_distribution_functions.powerlaw_constant": (0, "NoCache", "1,100,-2"), "distribution_functions.powerlaw_constant": (0, "NoCache", "1,100,-2"),
"_distribution_functions.calculate_constants_three_part_powerlaw": ( "distribution_functions.calculate_constants_three_part_powerlaw": (
16, 16,
"FIFOCache", "FIFOCache",
"0.1,0.5,1,100,-1.3,-2.3,-2.3", "0.1,0.5,1,100,-1.3,-2.3,-2.3",
), ),
"_distribution_functions.gaussian_normalizing_const": ( "distribution_functions.gaussian_normalizing_const": (
16, 16,
"FIFOCache", "FIFOCache",
"1.0,1.0,-10.0,+10.0", "1.0,1.0,-10.0,+10.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment