def get_isotope_dicts(element='', database='ENDF_VII'):
    """return a dictionary with list of isotopes found in database and name of database files
    
    Parameters:
    ===========
    element: string. Name of the element
      ex: 'Ag'
    database: string (default is ENDF_VII)
    
    Returns:
    ========
    dictionary with isotopes and files 
      ex: {'Ag': {'isotopes': ['107-Ag','109-Ag'],
                  'file_names': ['Ag-107.csv','Ag-109.csv']}}
    
    """
    _file_path = os.path.abspath(os.path.dirname(__file__))
    _database_folder = os.path.join(_file_path, 'reference_data', database)
    _element_search_path = os.path.join(_database_folder, element + '-*.csv')

    list_files = glob.glob(_element_search_path)
    if not list_files:
        raise ValueError("File names contains NO '-', the name should in the format of 'Cd-115_m1' or 'Cd-114'")
    list_files.sort()
    isotope_dict = {'isotopes': {'list': [],
                                 'file_names': [],
                                 'density': {'value': np.NaN,
                                             'units': 'g/cm3'},
                                 'mass': {'value': [],
                                          'units': 'g/mol',
                                          },
                                 'isotopic_ratio': [], },
                    'density': {'value': np.NaN,
                                'units': 'g/cm3'},
                    'molar_mass': {'value': np.NaN,
                                   'units': 'g/mol'},
                    }

    # isotope_dict_mirror = {}
    _isotopes_list = []
    _isotopes_list_files = []
    _isotopes_mass = []
    _isotopes_density = []
    _isotopes_atomic_ratio = []
    _density = np.NaN
    _molar_mass = np.NaN

    for file in list_files:
        # Obtain element, z number from the basename
        _basename = os.path.basename(file)
        filename = os.path.splitext(_basename)[0]
        if '-' in filename:
            [_name, _number] = filename.split('-')
            if '_' in _number:
                [aaa, meta] = _number.split('_')
                _number = aaa[:]
        else:
            _split_list = re.split(r'(\d+)', filename)
            if len(_split_list) == 2:
                [_name, _number] = _split_list
            else:
                _name = _split_list[0]
                _number = _split_list[1]
        if _number == '0':
            _number = '12'
        _symbol = _number + '-' + _name
        isotope = str(_symbol)

        _isotopes_list.append(isotope)
        _isotopes_list_files.append(_basename)
        _isotopes_mass.append(get_mass(isotope))
        _isotopes_atomic_ratio.append(get_abundance(isotope))
        _isotopes_density.append(get_density(isotope))
        _density = get_density(element)
        _molar_mass = get_mass(element)

    isotope_dict['isotopes']['list'] = _isotopes_list
    isotope_dict['isotopes']['file_names'] = _isotopes_list_files
    isotope_dict['isotopes']['mass']['value'] = _isotopes_mass
    isotope_dict['isotopes']['isotopic_ratio'] = _isotopes_atomic_ratio
    isotope_dict['isotopes']['density']['value'] = _isotopes_density
    isotope_dict['density']['value'] = _density
    isotope_dict['molar_mass']['value'] = _molar_mass
    return isotope_dict
def get_isotope_dicts ( element = '' , database = 'ENDF_VII' ) : _file_path = os . path . abspath ( os . path . dirname ( __file__ ) ) _database_folder = os . path . join ( _file_path , 'reference_data' , database ) _element_search_path = os . path . join ( _database_folder , element + '-*.csv' ) list_files = glob . glob ( _element_search_path ) if not list_files : raise ValueError ( "File names contains NO '-', the name should in the format of 'Cd-115_m1' or 'Cd-114'" ) list_files . sort ( ) isotope_dict = { 'isotopes' : { 'list' : [ ] , 'file_names' : [ ] , 'density' : { 'value' : np . NaN , 'units' : 'g/cm3' } , 'mass' : { 'value' : [ ] , 'units' : 'g/mol' , } , 'isotopic_ratio' : [ ] , } , 'density' : { 'value' : np . NaN , 'units' : 'g/cm3' } , 'molar_mass' : { 'value' : np . NaN , 'units' : 'g/mol' } , } _isotopes_list = [ ] _isotopes_list_files = [ ] _isotopes_mass = [ ] _isotopes_density = [ ] _isotopes_atomic_ratio = [ ] _density = np . NaN _molar_mass = np . NaN for file in list_files : _basename = os . path . basename ( file ) filename = os . path . splitext ( _basename ) [ 0 ] if '-' in filename : [ _name , _number ] = filename . split ( '-' ) if '_' in _number : [ aaa , meta ] = _number . split ( '_' ) _number = aaa [ : ] else : _split_list = re . split ( r'(\d+)' , filename ) if len ( _split_list ) == 2 : [ _name , _number ] = _split_list else : _name = _split_list [ 0 ] _number = _split_list [ 1 ] if _number == '0' : _number = '12' _symbol = _number + '-' + _name isotope = str ( _symbol ) _isotopes_list . append ( isotope ) _isotopes_list_files . append ( _basename ) _isotopes_mass . append ( get_mass ( isotope ) ) _isotopes_atomic_ratio . append ( get_abundance ( isotope ) ) _isotopes_density . append ( get_density ( isotope ) ) _density = get_density ( element ) _molar_mass = get_mass ( element ) isotope_dict [ 'isotopes' ] [ 'list' ] = _isotopes_list isotope_dict [ 'isotopes' ] [ 'file_names' ] = _isotopes_list_files isotope_dict [ 'isotopes' ] [ 'mass' ] [ 'value' ] = _isotopes_mass isotope_dict [ 'isotopes' ] [ 'isotopic_ratio' ] = _isotopes_atomic_ratio isotope_dict [ 'isotopes' ] [ 'density' ] [ 'value' ] = _isotopes_density isotope_dict [ 'density' ] [ 'value' ] = _density isotope_dict [ 'molar_mass' ] [ 'value' ] = _molar_mass return isotope_dict
return a dictionary with list of isotopes found in database and name of database files
    
    Parameters:
    ===========
    element: string. Name of the element
      ex: 'Ag'
    database: string (default is ENDF_VII)
    
    Returns:
    ========
    dictionary with isotopes and files 
      ex: {'Ag': {'isotopes': ['107-Ag','109-Ag'],
                  'file_names': ['Ag-107.csv','Ag-109.csv']}}