示例#1
0
 def setUpClass(cls) -> None:
     Registry.clear_all_registries()
     add_builtin_symbols_to_registry()
     cls.afa_web = AflowAdapter()
     store_data = loadfn(os.path.join(TEST_DATA_DIR, 'aflow_store.json'))
     store = MemoryStore()
     store.connect()
     store.update(store_data, key='auid')
     cls.afa_store = AflowAdapter(store)
示例#2
0
def add_builtin_models_to_registry(register_symbols=True):
    _PYTHON_MODEL_NAMES_LIST.clear()
    # Load python models
    python_module_list = iter_modules(__path__)
    if register_symbols:
        from propnet.symbols import add_builtin_symbols_to_registry
        add_builtin_symbols_to_registry()
    for _, module_name, _ in python_module_list:
        module_path = "propnet.models.python.{}".format(module_name)
        model = PyModuleModel(module_path, is_builtin=True, overwrite_registry=True)
        globals()[model.name] = model
        _PYTHON_MODEL_NAMES_LIST.append(model.name)
示例#3
0
def add_builtin_models_to_registry(register_symbols=True):
    _COMPOSITE_MODEL_NAMES_LIST.clear()
    # Load composite models
    composite_module_list = iter_modules(__path__)
    if register_symbols:
        from propnet.symbols import add_builtin_symbols_to_registry
        add_builtin_symbols_to_registry()
    for _, module_name, _ in composite_module_list:
        module_path = "propnet.models.composite.{}".format(module_name)
        model = PyModuleCompositeModel(module_path, is_builtin=True, overwrite_registry=True)
        globals()[model.name] = model
        _COMPOSITE_MODEL_NAMES_LIST.append(model.name)
示例#4
0
 def setUpClass(cls):
     add_builtin_symbols_to_registry()
     # Create some test properties and a few base objects
     cls.q1 = QuantityFactory.create_quantity(
         Registry("symbols")['bulk_modulus'],
         ureg.Quantity.from_tuple([200, [['gigapascals', 1]]]))
     cls.q2 = QuantityFactory.create_quantity(
         Registry("symbols")['shear_modulus'],
         ureg.Quantity.from_tuple([100, [['gigapascals', 1]]]))
     cls.q3 = QuantityFactory.create_quantity(
         Registry("symbols")['bulk_modulus'],
         ureg.Quantity.from_tuple([300, [['gigapascals', 1]]]))
     cls.material = None
     cls.graph = Graph()
示例#5
0
def add_builtin_models_to_registry(register_symbols=True):
    _EQUATION_MODEL_NAMES_LIST.clear()
    # Load equation models
    equation_model_dir = os.path.join(os.path.dirname(__file__))
    equation_module_files = glob(equation_model_dir + '/*.yaml')

    if register_symbols:
        from propnet.symbols import add_builtin_symbols_to_registry
        add_builtin_symbols_to_registry()
    for filename in equation_module_files:
        model_path = os.path.join(equation_model_dir, filename)
        model = EquationModel.from_file(model_path,
                                        is_builtin=True,
                                        overwrite_registry=True)
        globals()[model.name] = model
        _EQUATION_MODEL_NAMES_LIST.append(model.name)
示例#6
0
 def setUpClass(cls):
     Registry.clear_all_registries()
     add_builtin_symbols_to_registry()
示例#7
0
 def test_reimport_symbols(self):
     Registry("symbols").pop('youngs_modulus')
     self.assertNotIn('youngs_modulus', Registry("symbols"))
     add_builtin_symbols_to_registry()
     self.assertIn('youngs_modulus', Registry("symbols"))