diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index b92918d..94028a6 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,6 +1,14 @@ Changelog ========= +1.0.1 +----- + +* Fixes bug with saving spectra. + +* Fixes unintended spaces in chemical formula. + + 1.0.0 ----- diff --git a/nistchempy/__init__.py b/nistchempy/__init__.py index 7b54f80..db015a5 100644 --- a/nistchempy/__init__.py +++ b/nistchempy/__init__.py @@ -4,7 +4,7 @@ ''' -__version__ = '1.0.0' +__version__ = '1.0.1' __updated__ = 'September 25, 2024' __license__ = 'MIT' diff --git a/nistchempy/compound.py b/nistchempy/compound.py index bde8e14..45f4939 100644 --- a/nistchempy/compound.py +++ b/nistchempy/compound.py @@ -287,7 +287,9 @@ def save_spectra(self, spec_type, path_dir = './') -> None: if not _os.path.isdir(path_dir): raise ValueError(f'"{path_dir}" must be a directory') # save - for spec in getattr(self, spec_type): + key = 'thz' if spec_type == 'TZ' else spec_type.lower() + key = f'{key}_specs' + for spec in getattr(self, key): spec.save(f'{self.ID}_{spec_type}_{spec.spec_idx}.jdx', path_dir) diff --git a/nistchempy/nist_data.zip b/nistchempy/nist_data.zip index 3b2c56e..72983f5 100644 Binary files a/nistchempy/nist_data.zip and b/nistchempy/nist_data.zip differ diff --git a/nistchempy/parsing.py b/nistchempy/parsing.py index 1967a9e..c13a350 100644 --- a/nistchempy/parsing.py +++ b/nistchempy/parsing.py @@ -204,8 +204,9 @@ def get_compound_formula(soup: _bs4.BeautifulSoup) -> _tp.Optional[str]: # find chemical formula hits = info.findChildren(string = _re.compile('Formula')) if hits: - text = hits[0].findParent('li').text.replace('Formula:', '') - formula = _re.sub(r'(\d)([a-zA-Z])', r'\1 \2', text.strip()) + formula = hits[0].findParent('li').text.replace('Formula:', '').strip() + #formula = _re.sub(r'(\d)([a-zA-Z])', r'\1 \2', formula) + #formula = _re.sub(r'([a-zA-Z])([A-Z])', r'\1 \2', formula) return formula