def test_parse_name(get_oxidationstate_dict): names, excepted = get_oxidationstate_dict for name, expected_res in zip(names, excepted): getoxstates = GetOxStatesCSD([]) result = getoxstates.parse_name(name) print(result) assert result == expected_res
def test_parser(): """Test with some hand-selected MOFs""" test_list = [ "ACIBOE", "AZOHEC", "BADJAU", "ACOLIP", "QAGWIG", "GOCBAD", "BUVYIB01", "GIRNIH", "FURVEU", "GAHJUW", ] expected = { "ACIBOE": { "Zn": [np.nan] }, "AZOHEC": { "Zn": [2] }, "BADJAU": { "Sc": [np.nan] }, "ACOLIP": { "Zn": [2] }, "QAGWIG": { "Fe": [2] }, "GOCBAD": { "Cu": [2] }, "BUVYIB01": { "Fe": [2] }, "GIRNIH": { "Cd": [2] }, "FURVEU": { "Fe": [2] }, "GAHJUW": { "Fe": [0] }, } getoxstates = GetOxStatesCSD(test_list) result = getoxstates.run_parsing() assert expected == result
def test_parser(): """Test with some hand-selected MOFs""" test_list = [ 'ACIBOE', 'AZOHEC', 'BADJAU', 'ACOLIP', 'QAGWIG', 'GOCBAD', 'BUVYIB01', 'GIRNIH', 'FURVEU', 'GAHJUW', ] expected = { 'ACIBOE': { 'Zn': [np.nan] }, 'AZOHEC': { 'Zn': [2] }, 'BADJAU': { 'Sc': [np.nan] }, 'ACOLIP': { 'Zn': [2] }, 'QAGWIG': { 'Fe': [2] }, 'GOCBAD': { 'Cu': [2] }, 'BUVYIB01': { 'Fe': [2] }, 'GIRNIH': { 'Cd': [2] }, 'FURVEU': { 'Fe': [2] }, 'GAHJUW': { 'Fe': [0] }, } getoxstates = GetOxStatesCSD(test_list) result = getoxstates.run_parsing() assert expected == result
def run_parsing(names_cleaned, output_name=None): """ Args: names_cleaned (list): list of CSD identifiers output_name (str): filestem for the output pickle file Returns: writes output as pickle file """ getoxstatesobject = GetOxStatesCSD(names_cleaned) if output_name is None: timestr = time.strftime('%Y%m%d-%H%M%S') output_name = '-'.join([timestr, 'csd_ox_parse_output']) outputdict = getoxstatesobject.run_parsing(njobs=4) with open(output_name + '.pkl', 'wb') as filehandle: pickle.dump(outputdict, filehandle)
def run_parsing(output_name=None): """ Args: output_name (str): filestem for the output pickle file Returns: writes output as pickle file """ # all database entries getoxstatesobject = GetOxStatesCSD(generate_id_list()) if output_name is None: timestr = time.strftime('%Y%m%d-%H%M%S') output_name = '-'.join([timestr, 'csd_ox_parse_output_reference']) outputdict = getoxstatesobject.run_parsing(njobs=4) with open(output_name + '.pkl', 'wb') as filehandle: pickle.dump(outputdict, filehandle)