diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml index d668c3a..f925e6b 100644 --- a/.github/workflows/push-master.yml +++ b/.github/workflows/push-master.yml @@ -16,4 +16,3 @@ jobs: needs: [python2_tests, python3_tests] uses: ./.github/workflows/bump-and-publish.yml secrets: inherit - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2c56732 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: name-tests-test + args: [ --pytest-test-first ] + exclude: '^(?!factories/)' + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.5.6 + hooks: + - id: ruff + args: [ --fix ] diff --git a/inspire_utils/config.py b/inspire_utils/config.py index 9c17634..e323fad 100644 --- a/inspire_utils/config.py +++ b/inspire_utils/config.py @@ -29,8 +29,8 @@ from __future__ import absolute_import, division, print_function import os -import six +import six DEFAULT_CONFIG_PATHS = ( './var/inspirehep-instance/inspirehep.cfg', diff --git a/inspire_utils/helpers.py b/inspire_utils/helpers.py index 410b837..36078c7 100644 --- a/inspire_utils/helpers.py +++ b/inspire_utils/helpers.py @@ -22,9 +22,8 @@ from __future__ import absolute_import, division, print_function -from lxml import etree - import six +from lxml import etree def force_list(data): diff --git a/inspire_utils/name.py b/inspire_utils/name.py index 6b36f1c..9fe5624 100644 --- a/inspire_utils/name.py +++ b/inspire_utils/name.py @@ -23,16 +23,16 @@ from __future__ import absolute_import, division, print_function import itertools -from itertools import product, chain import re +from itertools import chain, product +import six from nameparser import HumanName from nameparser.config import Constants -import six from unidecode import unidecode -from .logging import getStackTraceLogger -from .query import wrap_queries_in_bool_clauses_if_more_than_one +from inspire_utils.logging import getStackTraceLogger +from inspire_utils.query import wrap_queries_in_bool_clauses_if_more_than_one LOGGER = getStackTraceLogger(__name__) diff --git a/inspire_utils/parsers/arxiv.py b/inspire_utils/parsers/arxiv.py index 57c033c..6c24884 100644 --- a/inspire_utils/parsers/arxiv.py +++ b/inspire_utils/parsers/arxiv.py @@ -23,14 +23,12 @@ from __future__ import absolute_import, division, print_function -from itertools import chain import re +from itertools import chain import six from inspire_schemas.api import LiteratureBuilder from inspire_schemas.utils import classify_field, normalize_arxiv_category -from ..dedupers import dedupe_list -from ..helpers import maybe_int from pylatexenc.latex2text import ( EnvironmentTextSpec, LatexNodes2Text, @@ -38,7 +36,15 @@ get_default_latex_context_db, ) -from ..utils import CONFERENCE_WORDS, THESIS_WORDS, coll_cleanforthe, get_node, split_fullname +from inspire_utils.dedupers import dedupe_list +from inspire_utils.helpers import maybe_int +from inspire_utils.utils import ( + CONFERENCE_WORDS, + THESIS_WORDS, + coll_cleanforthe, + get_node, + split_fullname, +) RE_CONFERENCE = re.compile( r'\b(%s)\b' % '|'.join( diff --git a/inspire_utils/parsers/author_xml.py b/inspire_utils/parsers/author_xml.py index 0e06a9f..9acc26f 100644 --- a/inspire_utils/parsers/author_xml.py +++ b/inspire_utils/parsers/author_xml.py @@ -29,10 +29,10 @@ import re +from inspire_schemas.api import LiteratureBuilder from scrapy.selector import Selector from six import binary_type from six.moves import zip -from inspire_schemas.api import LiteratureBuilder from inspire_utils.name import normalize_name diff --git a/inspire_utils/parsers/crossref.py b/inspire_utils/parsers/crossref.py index ca29311..d732ebe 100644 --- a/inspire_utils/parsers/crossref.py +++ b/inspire_utils/parsers/crossref.py @@ -23,11 +23,13 @@ from __future__ import absolute_import, division, print_function import itertools + from inspire_schemas.api import LiteratureBuilder, ReferenceBuilder -from ..date import PartialDate -from ..helpers import force_list -from ..record import get_value -from ..dedupers import dedupe_list_of_dicts + +from inspire_utils.date import PartialDate +from inspire_utils.dedupers import dedupe_list_of_dicts +from inspire_utils.helpers import force_list +from inspire_utils.record import get_value """Document types for the crossref objects have been extracted from the following link: https://api.crossref.org/v1/types diff --git a/inspire_utils/parsers/elsevier.py b/inspire_utils/parsers/elsevier.py index 209c435..b6bd862 100644 --- a/inspire_utils/parsers/elsevier.py +++ b/inspire_utils/parsers/elsevier.py @@ -27,10 +27,10 @@ import six from inspire_schemas.api import LiteratureBuilder, ReferenceBuilder -from ..date import PartialDate -from ..helpers import maybe_int, remove_tags -from ..utils import get_node +from inspire_utils.date import PartialDate +from inspire_utils.helpers import maybe_int, remove_tags +from inspire_utils.utils import get_node DOCTYPE_MAPPING = { "abs": "abstract", @@ -669,13 +669,11 @@ def get_identifier(self): return self.dois[0]["doi"] def should_record_be_harvested(self): - if self.article_type in DOCTYPES_TO_HARVEST and all( + return self.article_type in DOCTYPES_TO_HARVEST and all( [ self.title, self.journal_title, self.journal_volume, (self.artid or self.page_start), ] - ): - return True - return False + ) diff --git a/inspire_utils/parsers/jats.py b/inspire_utils/parsers/jats.py index 5540065..fbe18b6 100644 --- a/inspire_utils/parsers/jats.py +++ b/inspire_utils/parsers/jats.py @@ -27,15 +27,13 @@ import itertools import six - from idutils import normalize_orcid from inspire_schemas.api import LiteratureBuilder, ReferenceBuilder from inspire_schemas.utils import split_page_artid -from ..date import PartialDate -from ..helpers import maybe_int, remove_tags - -from ..utils import get_node +from inspire_utils.date import PartialDate +from inspire_utils.helpers import maybe_int, remove_tags +from inspire_utils.utils import get_node JOURNAL_TITLES_MAPPING = { "Physics": "APS Physics" @@ -202,10 +200,7 @@ def dois(self): @property def document_type(self): - if self.is_conference_paper: - document_type = 'conference paper' - else: - document_type = 'article' + document_type = "conference paper" if self.is_conference_paper else "article" return document_type @@ -608,7 +603,7 @@ def get_reference(self, ref_node): builder.add_report_number ), ('./article-title/text()', builder.add_title), - ('../label/text()', lambda x: builder.set_label(x.strip('[].'))) + ('../label/text()', lambda x, builder=builder: builder.set_label(x.strip('[].'))) ] for xpath, field_handler in fields: diff --git a/inspire_utils/record.py b/inspire_utils/record.py index ec7e7b7..4e25369 100644 --- a/inspire_utils/record.py +++ b/inspire_utils/record.py @@ -26,7 +26,7 @@ from six import string_types -from .logging import getStackTraceLogger +from inspire_utils.logging import getStackTraceLogger LOGGER = getStackTraceLogger(__name__) SPLIT_KEY_PATTERN = re.compile(r"\.|\[") diff --git a/inspire_utils/urls.py b/inspire_utils/urls.py index d6cb9db..ea339d6 100644 --- a/inspire_utils/urls.py +++ b/inspire_utils/urls.py @@ -25,7 +25,7 @@ from __future__ import absolute_import, division, print_function from six import text_type -from six.moves.urllib.parse import urlsplit, urlunsplit, SplitResult +from six.moves.urllib.parse import SplitResult, urlsplit, urlunsplit def ensure_scheme(url, default_scheme='http'): diff --git a/inspire_utils/utils.py b/inspire_utils/utils.py index 511d1fc..6c6b67d 100644 --- a/inspire_utils/utils.py +++ b/inspire_utils/utils.py @@ -3,9 +3,10 @@ division, print_function, ) + import re -from scrapy.selector import Selector +from scrapy.selector import Selector RE_FOR_THE = re.compile( r'\b(?:for|on behalf of|representing)\b', diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..843a909 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,29 @@ +target-version = "py311" +[lint.flake8-tidy-imports] +ban-relative-imports = "all" + +[lint] +select = [ + # pycodestyle + "E", + # Pyflakes + "F", + # flake8-bugbear + "B", + # flake8-simplify + "SIM", + # isort + "I", + # flake8-tidy-imports + "TID", + # flake8-pytest-style + "PT", +] +ignore = ["B904", "E501"] + + +[lint.pycodestyle] +ignore-overlong-task-comments = true + +[lint.pydocstyle] +convention = "google" diff --git a/run-tests.sh b/run-tests.sh index 8caf506..073b5e5 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -21,6 +21,4 @@ # or submit itself to any jurisdiction. set -e - -flake8 inspire_utils tests py.test tests diff --git a/setup.py b/setup.py index 768e3f2..7043a4f 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of INSPIRE. # Copyright (C) 2014-2024 CERN. @@ -22,65 +21,64 @@ """INSPIRE-specific utils.""" -from __future__ import absolute_import, division, print_function - from setuptools import find_packages, setup +URL = "https://github.com/inspirehep/inspire-utils" -URL = 'https://github.com/inspirehep/inspire-utils' - -readme = open('README.rst').read() +with open("README.rst") as f: + readme = f.read() install_requires = [ - 'Unidecode~=1.0,>=1.0.22', - 'babel~=2.0,>=2.5.1', - 'lxml~=5.0', + "Unidecode~=1.0,>=1.0.22", + "babel~=2.0,>=2.5.1", + "lxml~=5.0", 'nameparser~=0.0,>=0.5.3; python_version <= "2.7"', 'nameparser~=1.1,>=1.1.3; python_version >= "3.6"', - 'python-dateutil~=2.0,>=2.6.1', - 'six~=1.0,>=1.10.0', - 'urllib3~=1.0,<=1.26.12', - 'inspire_schemas', - 'scrapy', - 'pylatexenc', + "python-dateutil~=2.0,>=2.6.1", + "six~=1.0,>=1.10.0", + "urllib3~=1.0,<=1.26.12", + "inspire_schemas", + "scrapy", + "pylatexenc", ] docs_require = [] -tests_require = [ - 'flake8-future-import~=0.0,>=0.4.3', - 'mock~=2.0,>=2.0.0', - 'deepdiff' +tests_require = ["flake8-future-import~=0.0,>=0.4.3", "mock~=2.0,>=2.0.0", "deepdiff"] + +dev_require = [ + "pre-commit==3.5.0", ] extras_require = { - 'docs': docs_require, - 'tests': tests_require, + "docs": docs_require, + "tests": tests_require, + "dev": dev_require, 'tests:python_version=="2.7"': [ - 'unicode-string-literal~=1.0,>=1.1', - 'pytest~=4.0,>=4.6.0', + "unicode-string-literal~=1.0,>=1.1", + "pytest~=4.0,>=4.6.0", ], 'tests:python_version>="3"': [ - 'pytest~=8.0,>=8.2.2', - ] + "pytest~=8.0,>=8.2.2", + ], } -extras_require['all'] = [] -for name, reqs in extras_require.items(): - extras_require['all'].extend(reqs) +extras_require["all"] = [] +for _name, reqs in extras_require.items(): + extras_require["all"].extend(reqs) -packages = find_packages(exclude=['docs']) +packages = find_packages(exclude=["docs"]) setup( - name='inspire-utils', + name="inspire-utils", url=URL, - license='GPLv3', - author='CERN', - author_email='admin@inspirehep.net', + license="GPLv3", + author="CERN", + author_email="admin@inspirehep.net", packages=packages, include_package_data=True, zip_safe=False, - platforms='any', + platforms="any", description=__doc__, long_description=readme, install_requires=install_requires, @@ -88,23 +86,23 @@ extras_require=extras_require, version="3.0.60", classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - 'Topic :: Software Development :: Libraries :: Python Modules', + "Development Status :: 4 - Beta", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", + "Topic :: Software Development :: Libraries :: Python Modules", ], ) diff --git a/tests/data/aps/PhysRevResearch.5.033093.xml b/tests/data/aps/PhysRevResearch.5.033093.xml index 2a3b59d..60d0dbd 100644 --- a/tests/data/aps/PhysRevResearch.5.033093.xml +++ b/tests/data/aps/PhysRevResearch.5.033093.xml @@ -308,4 +308,4 @@ 41J. Johansson, P. Nation, and F. Nori, QuTiP 2: A python framework for the dynamics of open quantum systems, Comput. Phys. Commun. 184, 1234 (2013)0010-465510.1016/j.cpc.2012.11.019. - \ No newline at end of file + diff --git a/tests/data/crossref/2018.3804742.json b/tests/data/crossref/2018.3804742.json index 3beedaa..5e1ab49 100644 --- a/tests/data/crossref/2018.3804742.json +++ b/tests/data/crossref/2018.3804742.json @@ -309,4 +309,4 @@ "page":"1-6" }, "message-type":"work" -} \ No newline at end of file +} diff --git a/tests/data/crossref/2018.3804742_expected.yml b/tests/data/crossref/2018.3804742_expected.yml index 4a50a18..aba89a9 100644 --- a/tests/data/crossref/2018.3804742_expected.yml +++ b/tests/data/crossref/2018.3804742_expected.yml @@ -102,7 +102,7 @@ references: - reference: dois: - 10.1007/PL00004219 -dois: +dois: - doi: 10.1155/2018/3804742 material: publication document_type: article diff --git a/tests/data/crossref/9781316535783.011.json b/tests/data/crossref/9781316535783.011.json index 1e13663..b11b223 100644 --- a/tests/data/crossref/9781316535783.011.json +++ b/tests/data/crossref/9781316535783.011.json @@ -124,4 +124,4 @@ "page":"206-227" }, "message-type":"work" -} \ No newline at end of file +} diff --git a/tests/data/crossref/9781316535783.011_expected.yml b/tests/data/crossref/9781316535783.011_expected.yml index 7826b8c..ea8ceb0 100644 --- a/tests/data/crossref/9781316535783.011_expected.yml +++ b/tests/data/crossref/9781316535783.011_expected.yml @@ -1,5 +1,5 @@ --- -dois: +dois: - doi: 10.1017/9781316535783.011 material: publication title: Testing Inflation diff --git a/tests/data/crossref/PhysRevB.33.3547.2.json b/tests/data/crossref/PhysRevB.33.3547.2.json index 0ebca9b..a3152de 100644 --- a/tests/data/crossref/PhysRevB.33.3547.2.json +++ b/tests/data/crossref/PhysRevB.33.3547.2.json @@ -156,4 +156,4 @@ "page":"3547-3548" }, "message-type":"work" -} \ No newline at end of file +} diff --git a/tests/data/crossref/PhysRevB.33.3547.2_expected.yml b/tests/data/crossref/PhysRevB.33.3547.2_expected.yml index 04ec975..431cb67 100644 --- a/tests/data/crossref/PhysRevB.33.3547.2_expected.yml +++ b/tests/data/crossref/PhysRevB.33.3547.2_expected.yml @@ -3,7 +3,7 @@ license: - url: http://link.aps.org/licenses/aps-default-license imposing: American Physical Society (APS) material: erratum -dois: +dois: - doi: 10.1103/physrevb.33.3547.2 material: erratum title: 'Erratum: Polaronic behavior of electrons on a liquid-helium film' diff --git a/tests/data/crossref/s1463-4988(99)00060-3.json b/tests/data/crossref/s1463-4988(99)00060-3.json index 0410ad9..ad5b07a 100644 --- a/tests/data/crossref/s1463-4988(99)00060-3.json +++ b/tests/data/crossref/s1463-4988(99)00060-3.json @@ -1 +1 @@ -{"status": "ok", "message-version": "1.0.0", "message": {"DOI": "10.1016/s1463-4988(99)00060-3", "subtitle": [], "reference": [{"DOI": "10.4319/lo.1996.41.1.0041", "first-page": "41", "author": "Amon", "doi-asserted-by": "crossref", "article-title": "Bacterial utilization of different size classes of dissolved organic matter", "volume": "41", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB1", "year": "1996"}, {"DOI": "10.1126/science.255.5051.1561", "first-page": "1561", "author": "Benner", "doi-asserted-by": "crossref", "article-title": "Bulk chemical characteristics of dissolved organic matter in the ocean", "volume": "255", "journal-title": "Science", "key": "10.1016/S1463-4988(99)00060-3_BIB2", "year": "1992"}, {"DOI": "10.1093/plankt/5.4.477", "first-page": "477", "author": "Chrost", "doi-asserted-by": "crossref", "article-title": "Organic carbon release by phytoplankton: its composition and utilization by bacterioplankton", "volume": "5", "journal-title": "J. Plankton Res.", "key": "10.1016/S1463-4988(99)00060-3_BIB3", "year": "1983"}, {"DOI": "10.4319/lo.1996.41.4.0698", "first-page": "698", "author": "Graneli", "doi-asserted-by": "crossref", "article-title": "Photo-oxidative production of dissolved inorganic carbon in lakes of different humic content", "volume": "41", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB4", "year": "1996"}, {"DOI": "10.1139/m62-029", "first-page": "229", "author": "Guillard", "doi-asserted-by": "crossref", "article-title": "Studies of marine planktonic diatoms I. Cyclotella nana Hustedt and Detonula confervacea (Cleve) Gran", "volume": "8", "journal-title": "Can. J. Microbiol.", "key": "10.1016/S1463-4988(99)00060-3_BIB5", "year": "1962"}, {"DOI": "10.1038/341637a0", "first-page": "637", "author": "Kieber", "doi-asserted-by": "crossref", "article-title": "Photochemical source of biological substrates in sea water: implications for carbon cycling", "volume": "341", "journal-title": "Nature", "key": "10.1016/S1463-4988(99)00060-3_BIB6", "year": "1989"}, {"DOI": "10.4319/lo.1995.40.1.0195", "first-page": "195", "author": "Lindell", "doi-asserted-by": "crossref", "article-title": "Enhanced bacterial growth in response to photochemical transformation of dissolved organic matter", "volume": "40", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB7", "year": "1995"}, {"DOI": "10.1038/382445a0", "first-page": "445", "author": "Lovley", "doi-asserted-by": "crossref", "article-title": "Humic substances as electron acceptors for microbial respiration", "volume": "382", "journal-title": "Nature", "key": "10.1016/S1463-4988(99)00060-3_BIB8", "year": "1996"}, {"DOI": "10.1029/94GL03344", "first-page": "417", "author": "Miller", "doi-asserted-by": "crossref", "article-title": "Photochemical production of dissolved inorganic carbon from terrestrial organic matter: significance to the oceanic organic carbon cycle", "volume": "22", "journal-title": "Geophys. Res. Lett.", "key": "10.1016/S1463-4988(99)00060-3_BIB9", "year": "1995"}, {"first-page": "31", "author": "Menzel", "series-title": "Organic Matter in Natural Waters", "article-title": "Distribution and cycling of organic matter in the oceans", "key": "10.1016/S1463-4988(99)00060-3_BIB10", "year": "1970"}, {"DOI": "10.1038/353060a0", "first-page": "60", "author": "Mopper", "doi-asserted-by": "crossref", "article-title": "Photochemical degradation of dissolved organic carbon and its impact on the oceanic carbon cycle", "volume": "353", "journal-title": "Nature", "key": "10.1016/S1463-4988(99)00060-3_BIB11", "year": "1991"}, {"DOI": "10.4319/lo.1995.40.8.1381", "first-page": "1381", "author": "Morris", "doi-asserted-by": "crossref", "article-title": "The attenuation of solar UV radiation in lakes and the role of dissolved organic carbon", "volume": "40", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB12", "year": "1995"}, {"unstructured": "Murakami, Y., 1999. Effects of a bacterial siderophore on microalgal proliferation. MSc thesis, School of Biosphere Science, Hiroshima University.", "key": "10.1016/S1463-4988(99)00060-3_BIB13"}, {"first-page": "435", "author": "Naganuma", "article-title": "Abundance, production and viability of bacterioplankton in the Seto Inland Sea, Japan", "volume": "53", "journal-title": "J. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB14", "year": "1997"}, {"DOI": "10.3354/meps135309", "first-page": "309", "author": "Naganuma", "doi-asserted-by": "crossref", "article-title": "Photodegradation or photoalteration? Microbial assay of the effect of UV-B on dissolved organic matter", "volume": "135", "journal-title": "Mar. Ecol. Prog. Ser.", "key": "10.1016/S1463-4988(99)00060-3_BIB15", "year": "1996"}, {"DOI": "10.1093/plankt/19.6.783", "first-page": "783", "author": "Naganuma", "doi-asserted-by": "crossref", "article-title": "Photoreactivation of UV-induced damage to embryos of a planktonic copepod", "volume": "19", "journal-title": "J. Plankton Res", "key": "10.1016/S1463-4988(99)00060-3_BIB16", "year": "1997"}, {"DOI": "10.3354/meps116247", "first-page": "247", "author": "Obernosterer", "doi-asserted-by": "crossref", "article-title": "Phytoplankton extracellular release and bacterial growth: dependence on the inorganic N:P ratio", "volume": "116", "journal-title": "Mar. Ecol. Prog. Ser.", "key": "10.1016/S1463-4988(99)00060-3_BIB17", "year": "1995"}, {"first-page": "2938", "author": "Sundh", "article-title": "Biochemical composition of dissolved organic carbon derived from phytoplankton and used by heterotrophic bacteria", "volume": "58", "journal-title": "Appl. Environ. Microbiol.", "key": "10.1016/S1463-4988(99)00060-3_BIB18", "year": "1992"}, {"DOI": "10.3354/meps116309", "first-page": "309", "author": "Thomas", "doi-asserted-by": "crossref", "article-title": "Photodegradation of algal dissolved organic carbon", "volume": "116", "journal-title": "Mar. Ecol. Prog. Ser.", "key": "10.1016/S1463-4988(99)00060-3_BIB19", "year": "1995"}, {"DOI": "10.4319/lo.1995.40.8.1369", "first-page": "1369", "author": "Wetzel", "doi-asserted-by": "crossref", "article-title": "Natural photolysis by ultraviolet irradiance of recalcitrant dissolved organic matter to simple substrates for rapid bacterial metabolism", "volume": "40", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB20", "year": "1995"}], "issued": {"date-parts": [[2000, 1]]}, "short-title": [], "prefix": "10.1080", "relation": {"cites": []}, "subject": ["Ecology", "Aquatic Science", "Management, Monitoring, Policy and Law"], "author": [{"affiliation": [], "given": "T", "family": "Naganuma"}], "reference-count": 20, "ISSN": ["1463-4988"], "member": "301", "source": "Crossref", "score": 1.0, "deposited": {"timestamp": 1508328066000, "date-time": "2017-10-18T12:01:06Z", "date-parts": [[2017, 10, 18]]}, "indexed": {"timestamp": 1508788844498, "date-time": "2017-10-23T20:00:44Z", "date-parts": [[2017, 10, 23]]}, "type": "journal-article", "URL": "http://dx.doi.org/10.1016/s1463-4988(99)00060-3", "is-referenced-by-count": 0, "volume": "3", "issn-type": [{"type": "print", "value": "1463-4988"}], "link": [{"URL": "http://api.elsevier.com/content/article/PII:S1463-4988(99)00060-3?httpAccept=text/xml", "intended-application": "text-mining", "content-version": "vor", "content-type": "text/xml"}, {"URL": "http://api.elsevier.com/content/article/PII:S1463-4988(99)00060-3?httpAccept=text/plain", "intended-application": "text-mining", "content-version": "vor", "content-type": "text/plain"}], "published-print": {"date-parts": [[2000, 1]]}, "references-count": 20, "original-title": [], "short-container-title": [], "publisher": "Informa UK Limited", "content-domain": {"domain": [], "crossmark-restriction": "False"}, "license": [{"URL": "http://www.elsevier.com/tdm/userlicense/1.0/", "start": {"timestamp": 946684800000, "date-time": "2000-01-01T00:00:00Z", "date-parts": [[2000, 1, 1]]}, "content-version": "tdm", "delay-in-days": 0}], "created": {"timestamp": 1027651124000, "date-time": "2002-07-26T02:38:44Z", "date-parts": [[2002, 7, 26]]}, "issue": "1", "title": ["Effect of ultraviolet radiation on the bioavailability of marine diatom-derived low-molecular-weight dissolved organic matter"], "alternative-id": ["S1463-4988(99)00060-3"], "container-title": ["Aquatic Ecosystem Health and Management"], "page": "163-166"}, "message-type": "work"} \ No newline at end of file +{"status": "ok", "message-version": "1.0.0", "message": {"DOI": "10.1016/s1463-4988(99)00060-3", "subtitle": [], "reference": [{"DOI": "10.4319/lo.1996.41.1.0041", "first-page": "41", "author": "Amon", "doi-asserted-by": "crossref", "article-title": "Bacterial utilization of different size classes of dissolved organic matter", "volume": "41", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB1", "year": "1996"}, {"DOI": "10.1126/science.255.5051.1561", "first-page": "1561", "author": "Benner", "doi-asserted-by": "crossref", "article-title": "Bulk chemical characteristics of dissolved organic matter in the ocean", "volume": "255", "journal-title": "Science", "key": "10.1016/S1463-4988(99)00060-3_BIB2", "year": "1992"}, {"DOI": "10.1093/plankt/5.4.477", "first-page": "477", "author": "Chrost", "doi-asserted-by": "crossref", "article-title": "Organic carbon release by phytoplankton: its composition and utilization by bacterioplankton", "volume": "5", "journal-title": "J. Plankton Res.", "key": "10.1016/S1463-4988(99)00060-3_BIB3", "year": "1983"}, {"DOI": "10.4319/lo.1996.41.4.0698", "first-page": "698", "author": "Graneli", "doi-asserted-by": "crossref", "article-title": "Photo-oxidative production of dissolved inorganic carbon in lakes of different humic content", "volume": "41", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB4", "year": "1996"}, {"DOI": "10.1139/m62-029", "first-page": "229", "author": "Guillard", "doi-asserted-by": "crossref", "article-title": "Studies of marine planktonic diatoms I. Cyclotella nana Hustedt and Detonula confervacea (Cleve) Gran", "volume": "8", "journal-title": "Can. J. Microbiol.", "key": "10.1016/S1463-4988(99)00060-3_BIB5", "year": "1962"}, {"DOI": "10.1038/341637a0", "first-page": "637", "author": "Kieber", "doi-asserted-by": "crossref", "article-title": "Photochemical source of biological substrates in sea water: implications for carbon cycling", "volume": "341", "journal-title": "Nature", "key": "10.1016/S1463-4988(99)00060-3_BIB6", "year": "1989"}, {"DOI": "10.4319/lo.1995.40.1.0195", "first-page": "195", "author": "Lindell", "doi-asserted-by": "crossref", "article-title": "Enhanced bacterial growth in response to photochemical transformation of dissolved organic matter", "volume": "40", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB7", "year": "1995"}, {"DOI": "10.1038/382445a0", "first-page": "445", "author": "Lovley", "doi-asserted-by": "crossref", "article-title": "Humic substances as electron acceptors for microbial respiration", "volume": "382", "journal-title": "Nature", "key": "10.1016/S1463-4988(99)00060-3_BIB8", "year": "1996"}, {"DOI": "10.1029/94GL03344", "first-page": "417", "author": "Miller", "doi-asserted-by": "crossref", "article-title": "Photochemical production of dissolved inorganic carbon from terrestrial organic matter: significance to the oceanic organic carbon cycle", "volume": "22", "journal-title": "Geophys. Res. Lett.", "key": "10.1016/S1463-4988(99)00060-3_BIB9", "year": "1995"}, {"first-page": "31", "author": "Menzel", "series-title": "Organic Matter in Natural Waters", "article-title": "Distribution and cycling of organic matter in the oceans", "key": "10.1016/S1463-4988(99)00060-3_BIB10", "year": "1970"}, {"DOI": "10.1038/353060a0", "first-page": "60", "author": "Mopper", "doi-asserted-by": "crossref", "article-title": "Photochemical degradation of dissolved organic carbon and its impact on the oceanic carbon cycle", "volume": "353", "journal-title": "Nature", "key": "10.1016/S1463-4988(99)00060-3_BIB11", "year": "1991"}, {"DOI": "10.4319/lo.1995.40.8.1381", "first-page": "1381", "author": "Morris", "doi-asserted-by": "crossref", "article-title": "The attenuation of solar UV radiation in lakes and the role of dissolved organic carbon", "volume": "40", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB12", "year": "1995"}, {"unstructured": "Murakami, Y., 1999. Effects of a bacterial siderophore on microalgal proliferation. MSc thesis, School of Biosphere Science, Hiroshima University.", "key": "10.1016/S1463-4988(99)00060-3_BIB13"}, {"first-page": "435", "author": "Naganuma", "article-title": "Abundance, production and viability of bacterioplankton in the Seto Inland Sea, Japan", "volume": "53", "journal-title": "J. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB14", "year": "1997"}, {"DOI": "10.3354/meps135309", "first-page": "309", "author": "Naganuma", "doi-asserted-by": "crossref", "article-title": "Photodegradation or photoalteration? Microbial assay of the effect of UV-B on dissolved organic matter", "volume": "135", "journal-title": "Mar. Ecol. Prog. Ser.", "key": "10.1016/S1463-4988(99)00060-3_BIB15", "year": "1996"}, {"DOI": "10.1093/plankt/19.6.783", "first-page": "783", "author": "Naganuma", "doi-asserted-by": "crossref", "article-title": "Photoreactivation of UV-induced damage to embryos of a planktonic copepod", "volume": "19", "journal-title": "J. Plankton Res", "key": "10.1016/S1463-4988(99)00060-3_BIB16", "year": "1997"}, {"DOI": "10.3354/meps116247", "first-page": "247", "author": "Obernosterer", "doi-asserted-by": "crossref", "article-title": "Phytoplankton extracellular release and bacterial growth: dependence on the inorganic N:P ratio", "volume": "116", "journal-title": "Mar. Ecol. Prog. Ser.", "key": "10.1016/S1463-4988(99)00060-3_BIB17", "year": "1995"}, {"first-page": "2938", "author": "Sundh", "article-title": "Biochemical composition of dissolved organic carbon derived from phytoplankton and used by heterotrophic bacteria", "volume": "58", "journal-title": "Appl. Environ. Microbiol.", "key": "10.1016/S1463-4988(99)00060-3_BIB18", "year": "1992"}, {"DOI": "10.3354/meps116309", "first-page": "309", "author": "Thomas", "doi-asserted-by": "crossref", "article-title": "Photodegradation of algal dissolved organic carbon", "volume": "116", "journal-title": "Mar. Ecol. Prog. Ser.", "key": "10.1016/S1463-4988(99)00060-3_BIB19", "year": "1995"}, {"DOI": "10.4319/lo.1995.40.8.1369", "first-page": "1369", "author": "Wetzel", "doi-asserted-by": "crossref", "article-title": "Natural photolysis by ultraviolet irradiance of recalcitrant dissolved organic matter to simple substrates for rapid bacterial metabolism", "volume": "40", "journal-title": "Limnol. Oceanogr.", "key": "10.1016/S1463-4988(99)00060-3_BIB20", "year": "1995"}], "issued": {"date-parts": [[2000, 1]]}, "short-title": [], "prefix": "10.1080", "relation": {"cites": []}, "subject": ["Ecology", "Aquatic Science", "Management, Monitoring, Policy and Law"], "author": [{"affiliation": [], "given": "T", "family": "Naganuma"}], "reference-count": 20, "ISSN": ["1463-4988"], "member": "301", "source": "Crossref", "score": 1.0, "deposited": {"timestamp": 1508328066000, "date-time": "2017-10-18T12:01:06Z", "date-parts": [[2017, 10, 18]]}, "indexed": {"timestamp": 1508788844498, "date-time": "2017-10-23T20:00:44Z", "date-parts": [[2017, 10, 23]]}, "type": "journal-article", "URL": "http://dx.doi.org/10.1016/s1463-4988(99)00060-3", "is-referenced-by-count": 0, "volume": "3", "issn-type": [{"type": "print", "value": "1463-4988"}], "link": [{"URL": "http://api.elsevier.com/content/article/PII:S1463-4988(99)00060-3?httpAccept=text/xml", "intended-application": "text-mining", "content-version": "vor", "content-type": "text/xml"}, {"URL": "http://api.elsevier.com/content/article/PII:S1463-4988(99)00060-3?httpAccept=text/plain", "intended-application": "text-mining", "content-version": "vor", "content-type": "text/plain"}], "published-print": {"date-parts": [[2000, 1]]}, "references-count": 20, "original-title": [], "short-container-title": [], "publisher": "Informa UK Limited", "content-domain": {"domain": [], "crossmark-restriction": "False"}, "license": [{"URL": "http://www.elsevier.com/tdm/userlicense/1.0/", "start": {"timestamp": 946684800000, "date-time": "2000-01-01T00:00:00Z", "date-parts": [[2000, 1, 1]]}, "content-version": "tdm", "delay-in-days": 0}], "created": {"timestamp": 1027651124000, "date-time": "2002-07-26T02:38:44Z", "date-parts": [[2002, 7, 26]]}, "issue": "1", "title": ["Effect of ultraviolet radiation on the bioavailability of marine diatom-derived low-molecular-weight dissolved organic matter"], "alternative-id": ["S1463-4988(99)00060-3"], "container-title": ["Aquatic Ecosystem Health and Management"], "page": "163-166"}, "message-type": "work"} diff --git a/tests/data/crossref/s1463-4988(99)00060-3_expected.yml b/tests/data/crossref/s1463-4988(99)00060-3_expected.yml index bc0e4e6..ab5c0ae 100644 --- a/tests/data/crossref/s1463-4988(99)00060-3_expected.yml +++ b/tests/data/crossref/s1463-4988(99)00060-3_expected.yml @@ -3,7 +3,7 @@ license: - url: http://www.elsevier.com/tdm/userlicense/1.0/ imposing: Informa UK Limited material: publication -dois: +dois: - doi: 10.1016/s1463-4988(99)00060-3 material: publication title: Effect of ultraviolet radiation on the bioavailability of marine diatom-derived low-molecular-weight dissolved organic matter @@ -262,4 +262,4 @@ year: 2000 page_start: '163' journal_issue: '1' document_type: article -imprints: 2000-01 \ No newline at end of file +imprints: 2000-01 diff --git a/tests/data/crossref/tasc.2017.2776938.json b/tests/data/crossref/tasc.2017.2776938.json index 6b18af0..808ff63 100644 --- a/tests/data/crossref/tasc.2017.2776938.json +++ b/tests/data/crossref/tasc.2017.2776938.json @@ -236,4 +236,4 @@ "page":"1-5" }, "message-type":"work" -} \ No newline at end of file +} diff --git a/tests/data/crossref/tasc.2017.2776938_expected.yml b/tests/data/crossref/tasc.2017.2776938_expected.yml index 991f58f..cd994aa 100644 --- a/tests/data/crossref/tasc.2017.2776938_expected.yml +++ b/tests/data/crossref/tasc.2017.2776938_expected.yml @@ -1,5 +1,5 @@ --- -dois: +dois: - doi: 10.1109/tasc.2017.2776938 material: publication title: Quench Protection Heater Study With the 2-m Model Magnet of Beam Separation Dipole for the HL-LHC Upgrade diff --git a/tests/data/elsevier/j.nuclphysa.2020.121992.xml b/tests/data/elsevier/j.nuclphysa.2020.121992.xml index b4b6665..8f821f1 100644 --- a/tests/data/elsevier/j.nuclphysa.2020.121992.xml +++ b/tests/data/elsevier/j.nuclphysa.2020.121992.xml @@ -79,6 +79,6 @@ Corresponding author. -AbstractWe have investigated the composition of nuclear matter under thermodynamic conditions relevant for the core-collapse of massive stars, with a focus on quantum-statistical effects for light clusters. We find that deviations in the number densities of light clusters between Boltzmann and quantum statistics are small at sub-nuclear densities and temperatures 1–3 MeV, ≈0.2% at most. The formation of heavy clusters in stellar matter leads to a reduction in the number densities of light clusters. As a result, quantum-statistical effects such as the Bose–Einstein condensation of deuterons and α-particles are suppressed. The condensation of α-particles in iso-symmetric nuclear matter is predicted under the assumptions that it is composed solely of nucleons and light clusters and that no heavy clusters are present. We also find that Coulomb screening hardly affects the critical baryon densities for alpha condensation, although it modifies the masses and chemical potentials of the α-particles.KeywordsNuclear matterEquation of stateSupernovaeNuclear statistical equilibriumQuantum statistical effectBose–Einstein condensation1IntroductionHot and dense stellar matter appears in such astrophysical phenomena as core-collapse supernovae and neutron-star mergers. Nuclear matter at sub-nuclear densities consists of a mixture of unbound nucleons, light clusters, and heavy clusters in chemical and thermal equilibrium +AbstractWe have investigated the composition of nuclear matter under thermodynamic conditions relevant for the core-collapse of massive stars, with a focus on quantum-statistical effects for light clusters. We find that deviations in the number densities of light clusters between Boltzmann and quantum statistics are small at sub-nuclear densities and temperatures 1–3 MeV, ≈0.2% at most. The formation of heavy clusters in stellar matter leads to a reduction in the number densities of light clusters. As a result, quantum-statistical effects such as the Bose–Einstein condensation of deuterons and α-particles are suppressed. The condensation of α-particles in iso-symmetric nuclear matter is predicted under the assumptions that it is composed solely of nucleons and light clusters and that no heavy clusters are present. We also find that Coulomb screening hardly affects the critical baryon densities for alpha condensation, although it modifies the masses and chemical potentials of the α-particles.KeywordsNuclear matterEquation of stateSupernovaeNuclear statistical equilibriumQuantum statistical effectBose–Einstein condensation1IntroductionHot and dense stellar matter appears in such astrophysical phenomena as core-collapse supernovae and neutron-star mergers. Nuclear matter at sub-nuclear densities consists of a mixture of unbound nucleons, light clusters, and heavy clusters in chemical and thermal equilibrium [1]. The nuclear equation of state (EOS) determines the number densities of all these nuclear species as well as thermodynamic quantities as functions of temperature, baryon density, and charge fraction. The dynamical evolution and observable signatures of such compact-star phenomena are very sensitive to the EOS. In addition, weak interactions among the nuclear species play an important role, especially in core-collapse supernovae (see e.g., [2]). The roles of light clusters in core-collapse supernovae have not been completely clarified, although their potential influence on the dynamics, neutrino spectrum, and nucleosynthesis has been pointed out by many researchers [3–13].Modern EOSs for clustered nuclear matter at sub-nuclear densities are usually obtained for astrophysical simulations by using statistical models, e.g., [14–24]. Recently we have developed a self-consistent statistical approach where individual nuclear ground state properties and the full-ensemble distributions of nuclei are calculated consistently by minimizing the free energy density [25,26]. In most statistical models, the thermodynamic quantities for light clusters are calculated using Boltzmann statistics. This assumption is actually valid at high temperatures and low densities. However, it is a priori unclear whether this assumption is valid for conditions encountered in supernovae and neutron-star mergers. Certainly, at low temperatures and at high densities, they should be regarded as Fermi or Bose particles.The purpose of this work is to investigate such quantum-statistical effects for light clusters in stellar environments using realistic nuclear ensembles. The possibility of alpha condensation in nuclear matter has been analyzed previously by several authors. In ref. [27], the authors used a diagrammatic quantum-statistical approach to describe four-nucleon correlations in nuclear matter. They demonstrated the possibility of α condensation at sub-saturation densities, below a critical temperature of about 6 MeV. However, the calculations were done assuming a uniform nucleonic background; i.e., the presence of other light clusters in the system was completely ignored. Other previous studies [28–33] also did not consider the full nuclear ensemble of light and heavy clusters. In the present study, we generalize classical models of light clusters to a quantum-statistical description in the framework of our statistical approach, including the full-ensemble of nuclei. This paper is organized as follows. In Sec. 2, we formulate the modified statistical model, with a focus on the quantum-statistical effects of light clusters. The results of calculations with the full statistical ensemble, including both light and heavy clusters in some typical astrophysical conditions, are discussed in Sec. 3. For comparison, clustered nuclear matter consisting only of nucleons and light clusters is considered in Sec 4 in order to demonstrate the crucial role played by heavy clusters. Our conclusions are presented in Sec. 5.2Statistical model of clustered nuclear matter with quantum statisticsTo describe multi-component nuclear matter containing both light and heavy clusters, we use the same models as in our previous work [26]. The free energy density of uniformly distributed nucleons is evaluated with Skyrme-type interactions [34,35], using finite temperature expressions for the kinetic energies. The free energies of heavy clusters are given by expressions for Boltzmann gases, including excluded-volume effects and with mass free energies that are based on the compressible liquid-drop model. In previous works, Maxwell–Boltzmann statistics was employed to evaluate the free energies of both light and heavy clusters. In the present work, Bose–Einstein and Fermi–Dirac statistics are applied to light clusters with odd and even mass numbers, respectively.The total free energy density of the system is represented as(1)f=fnp+jflj+ini(Fit+Mi), where fnp is the free energy densities of dripped nucleons and flj represents the free energies of light clusters j with atomic numbers Zj5. The index i in the third term runs over all nuclear species of heavy clusters with 6Zi1000. In Eq. (1), ni, Fit, and Mi are the number densities, translational free energies, and mass free energies of nuclei i. The calculations of fnp, ni, Fit, and Mi are the same as in ref. [26], where one can also find all the details.For light clusters with atomic numbers Zj5 or neutron numbers Nj5, we include only those nuclides with available experimental mass data. The light clusters with even/odd mass numbers are assumed to obey Bose/Fermi statistics. The main thermodynamic quantities—the free energy density, particle density, and pressure of species j at temperature T—can then be expressed asaaBelow the units ħ=c=1 are used.(2)flj=njμjpj,(3)nj=gjλj32F1/2(ηj)π,(4)pj=gjλj5F3/2(ηj)6πMj. Here μj is the chemical potential, gj is the ground state degeneracy factor, ηj=(μjMj)/T, λj=2π/(MjT) is the thermal wavelength, and(5)Fk(η)=0zk[exp(zη)±1]1dz are the Fermi (+) and Bose () integrals. In the low-density and high-temperature limit (njλj3), the free energy is equal to that of a Boltzmann gas, as was assumed in our previous works [25,26]. The masses of the light clusters are assumed to be the experimental masses, Mjex, with Coulomb energy shifts, ΔEjC; see details in refs. [25,26]:(6)Mj=Mjex+ΔEjC,(7)ΔEjC(np,ne)=35(34π)1/3e2n02Vj5/3×[(ZjnpVjAj)2(132uj1/3+12uj)(ZjAj)2], where Aj=Zj+Nj, Vj=Aj/n0, uj=(nenp)/(Zj/Vjnp), ne is the electron density, and np is the local proton density in the vapor; see details in refs. [16,25]. The same formula for the Coulomb energy is also applied for heavy clusters in stellar environments. Excluded-volume effects are not implemented for light clusters in this work.Bose particles form a condensate under the condition, nj>njC, where the critical density, njC is given by Eq. (3) after substituting ηj=0 (or Mj=μj). The critical temperature below which Bose particles form a condensate can be expressed as(8)TjC=2πMj(njgjζ(3/2))2/3, where ζ(x) is the zeta function, and ζ(3/2)=2.612. Fig. 1 displays the critical lines in the (Ajnj, T) plane for deuterons (d) and α-particles (α). As one can see, at high densities and low temperatures, α-particle condensation can occur. Here we ignore the existence of electrons and dripped protons, which affect the nuclear Coulomb energies. The critical baryon number densities, AjnjC, are lower for deuterons than for α-particles at the same temperature, because the deuterons have a smaller value of Mj. However, the condensation of deuterons is less likely to occur, because their number density and binding energy are considerably smaller than those of α-particles, as shown later and as discussed in ref. [27].3Warm clustered matter with a realistic nuclear ensembleThe number densities of dripped protons and neutrons, deuterons, tritons (t), helions (h), α-particles, and other light and heavy clusters are shown in Fig. 2. We find that Bose-Einstein condensation of light bosonic clusters is unlikely because free nucleons and/or heavy clusters are the dominant components of nuclear matter under the considered conditions. As also shown in Fig. 1, the maximum values of the baryon densities for deuterons and α-particles over the whole density range are lower than the critical baryon densities, AjnjC, at which Bose–Einstein condensation may occur. In other words, almost all the nucleons are consumed, making the densities of light bosonic clusters insufficient to create a condensate. This result means that the inclusion of heavy clusters is crucial for a realistic description of stellar matter at sub-nuclear densities. Figs. 3 and 4 show the relative change (njQnjC)/njC in the densities of light clusters calculated with Bose or Fermi statistics, njQ, as compared to those obtained with Boltzmann statistics, njC. In multi-component nuclear matter, we find little difference in the number densities of light clusters between the quantum and classical statistics; the deviations are less than 0.20%. In neutron-rich matter, Yp=0.2, and at high densities, nB103 fm−3, the chemical potentials of the neutrons are substantially larger than those of the protons, and as a result, the quantum-statistical effects for tritons are stronger than those for α-particles.In some previous works, the contributions of heavy clusters have been neglected or were represented by a single-nucleus such as Fe56[29,30] or by an optimized nucleus [23]. The single-nucleus approximation considerably underestimates the total mass fraction of heavy clusters and overestimates the average mass number of heavy clusters, even if the mass and proton numbers of the representative nucleus are optimized, as shown in ref. [25]. In the single-nucleus approximation, the free energy density is expressed as f=fnp+jflj+nrepFrep(Arep,Zrep) instead of Eq. (1), where nrep and Frep are, respectively, the number density and free energy of a representative nucleus. Its mass and proton numbers, Arep and Zrep, are optimized by the conditions Frep/Arep|Zrep=μn and Frep/Zrep|Arep=μpμn. In addition, we assume chemical equilibrium among nucleons, light clusters, and the representative nuclei subject to the conservation of baryon number and charge (see details in ref. [25]). Here μp and μn are the chemical potentials of protons and neutrons, respectively.Fig. 5 shows the mass fractions of α-particles for a realistic nuclear ensemble, the single-nucleus approximation, and a model of light-cluster matter that is discussed in more detail in the next section, with no clusters having Z>2 or N>2. As one can see from the figure, the mass fraction of α-particles in the more realistic ensemble is considerably smaller than in the other more restrictive models, due to the larger population of heavy clusters. Indeed, the mass fractions of heavy clusters other than the representative nucleus in single-nucleus model, and the mass fractions of nuclei other than d, t, h, and α in light-cluster matter, are strictly zero. As a result, the mass fractions of α-particles in these two models are larger than in the full-ensemble model.4Warm light-cluster matter with a restricted nuclear ensembleIn this section, we consider clustered nuclear matter where heavy and some light elements with Z>2 or N>2 are artificially suppressed, e.g., only d, t, h, and α are allowed in the chemical equilibrium. Then we can discuss the possibility of alpha condensation under the same assumptions as in ref. [33]. Fig. 6 shows the number densities of nucleons and light clusters in the model where heavy clusters are suppressed. As one can see, in this more constrained ensemble, the α-particles may condense at nB0.02 fm−3 (T=1 MeV) and 0.09 fm−3 (T=3 MeV) in iso-symmetric matter (Yp=0.5). The free energy model for the light clusters in this work, however, is simple and lacks some in-medium effects such as interactions among nucleons and light and heavy clusters as will be noted in next section. Hence, at these high densities, α-condensation may be suppressed, as discussed in ref. [27].For neutron-rich matter (Yp=0.2), light clusters are less abundant, and α-particles do not condense even if the existence of heavy clusters is ignored. This is because the proton chemical potentials are much lower than those for Yp=0.5, especially at high densities, as also shown in Fig. 3. Fig. 7 displays the chemical potentials of nucleons for Yp=0.2 and 0.5 and the critical lines at which the chemical potentials of tritons and α-particles are equal to their rest masses (without Coulomb-energy shifts): μp+2μn=mt and 2μp+2μn=mα. Around and above these lines, the differences in number densities between classical and quantum statistics become large for each light cluster. For Yp=0.5, α-particles start to condense around this line, while for Yp=0.2, the quantum statistical effects for tritons become strong, μp+2μnmt at a lower density than the critical densities for α-condensation.To investigate the impact of the Coulomb energy, we also present the results obtained without the ΔEjC shift. Fig. 8 gives the chemical potential of α-particle relative to the α-particle rest mass, μα=2(μn+μpmnmp) together with the negative value of its binding energy, Bα=Mα2(mn+mp). Obviously, condensation starts when the chemical potential becomes equal to the mass. We find that the Coulomb-energy shifts actually reduce both the chemical potential and the effective mass of the α-particles. Therefore, the critical densities at which α-particles may condense depend very weakly on the electron distribution.As shown in ref. [26], the ground state minimum in the bulk free energy disappears at temperatures around 14 MeV. At this point, heavy clusters disappear from the nuclear ensemble but the abundance of α-particles increases significantly. However, these temperatures are already too high for light-cluster condensation.5Concluding remarksWe have investigated the nuclear compositions of hot and dense stellar matter within a self-consistent model that includes a full nuclear ensemble. In contrast to previous works, here quantum statistics is used for bosonic clusters, while classical statistics is employed for heavier nuclei. We have demonstrated that the differences in the number densities of light clusters are small between quantum and classical statistics, at most 0.20%. The presence of heavy clusters leads to a reduction in the number densities of light clusters, and as a result, the condensation of bosonic clusters does not occur. On the other hand, if we assume that iso-symmetric nuclear matter is composed only of nucleons and light clusters that are treated as ideal Fermi or Bose particles, α-particles reach the threshold of Bose–Einstein condensation at rather high densities, nB 0.01 fm−3 for T=1–3 MeV. It is difficult to expect such light clusters to exist in such dense stellar matter, where heavy clusters have already formed. For warm neutron-rich matter (T=1–3 MeV and Yp=0.2), the chemical potentials of the α-particles are too small for α-condensation, even when heavy clusters are suppressed.Our approach takes into account some in-medium modifications of the individual clusters: they include Coulomb-energy shifts for light clusters as well as excluded-volume corrections and shifts in the bulk, surface, and Coulomb energies for heavy clusters. In ref. [27], four-nucleon correlations were calculated more rigorously by solving the Schrödinger equation for four nucleons, and the possibility of α-condensation was predicted at sub-nuclear densities and T≲ 6 MeV. In the present work, strong-interaction effects are to some extent also taken into account by the Skyrme-like terms in the energy-density functionals used for dripped nucleons and for the bulk energies of heavy clusters. In a more realistic approach, one should introduce similar mean fields also for light clusters, as was done in refs. [31,32]. In addition, paring corrections [27] are not incorporated in our approach. However, they are considered to be washed out at T2–3 MeV [36], and therefore they may be relevant only to the late phase of core-collapse supernovae and the subsequent cooling of the neutron star.In the statistical models, the calculation of light-cluster energies e.g., the introduction of self-energy shifts [37], affects their number densities above nB105 fm−3 and at temperatures below T=5 MeV for Yp=0.3 and 0.5 [18]. Furthermore, calculations of dripped nucleons and heavy nuclei (e.g., nuclear interactions among dripped nucleons and nuclear excitations) also alter them due to baryon number conservation below T=3 MeV at any density [21]. In that sense, the number densities of light clusters obtained in Sec. 3 may change somewhat, say by the order of 103 fm−3, but the main conclusion of this paper—that light-cluster condensations are disturbed by heavy-cluster formation—would not be modified. As shown in ref. [37], the densities of light clusters in symmetric nuclear matter depend significantly on the interactions between nucleons and light clusters at nB103 fm−3. Hence, the results of Sec. 4, in which nuclear interactions among nucleons and light clusters are neglected, may be too crude, and the possibility of α-condensation in light-cluster matter should be considered within more realistic models.Reference [38] demonstrated for iso-symmetric nuclear matter that for strong enough α-N attractive interactions, an α-condensate appears even in the nuclear ground state. In relation to the present work, this means that an α-condensate may be present inside of heavy clusters. Another interesting possibility studied in ref. [32] is that pure nucleonic matter and α-matter are separated by a potential barrier. One may then expect the existence of nuclei made of α-particles. Such metastable α-nuclei also may be formed in dense stellar matter. In the future, we are planning to investigate these interesting possibilities for isospin-asymmetric nuclear matter.CRediT authorship contribution statementShun Furusawa: Data curation, Investigation, Software, Writing - original draft. Igor Mishustin: Conceptualization, Methodology, Supervision, Writing - review & editing.Declaration of Competing InterestThe authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.AcknowledgementsS.F. acknowledges H. Tajima and T. Hatsuda for useful discussion. This work was supported by JSPS KAKENHI (Grant Number JP17H06365, 19K14723) and HPCI Strategic Program of Japanese MEXT (Project ID: hp170304, 180111). A part of the numerical calculations was carried out on PC cluster at Center for Computational Astrophysics, National Astronomical Observatory of Japan. I. M. acknowledges fruitful discussions with L. M. Satarov and financial support from Frankfurt Institute for Advanced Studies (FIAS).References[1]S.FurusawaNuclei in central engine of core-collapse supernovaePhys. Scr.95202007400210.1088/1402-4896/ab8c15S. Furusawa, Nuclei in central engine of core-collapse supernovae, Physica Scripta 95 (2020) 074002. 10.1088/1402-4896/ab8c15.[2]S.FurusawaH.NagakuraK.SumiyoshiC.KatoS.YamadaDependence of weak interaction rates on the nuclear composition during stellar core collapsePhys. Rev. C95201702580910.1103/PhysRevC.95.025809S. Furusawa, H. Nagakura, K. Sumiyoshi, C. Kato, S. Yamada, Dependence of weak interaction rates on the nuclear composition during stellar core collapse, Phys. Rev. C 95 (2017) 025809. doi:10.1103/PhysRevC.95.025809.[3]W.C.HaxtonNeutrino heating in supernovaePhys. Rev. Lett.6019881999200210.1103/PhysRevLett.60.1999W. C. Haxton, Neutrino heating in supernovae, Physical Review Letters 60 (1988) 1999–2002. doi:10.1103/PhysRevLett.60.1999.[4]E.O'ConnorD.GazitC.J.HorowitzA.SchwenkN.BarneaNeutrino breakup of A=3 nuclei in supernovaePhys. Rev. C755200705580310.1103/PhysRevC.75.055803arXiv:nucl-th/0702044E. O'Connor, D. Gazit, C. J. Horowitz, A. Schwenk, N. Barnea, Neutrino breakup of A=3 nuclei in supernovae, Phys. Rev. C75 (5) (2007) 055803. arXiv:nucl-th/0702044, doi:10.1103/PhysRevC.75.055803.[5]N.OhnishiK.KotakeS.YamadaInelastic neutrino-helium scatterings and standing accretion shock instability in core-collapse supernovaeAstrophys. J.667200737538110.1086/520755arXiv:astro-ph/0606187N. Ohnishi, K. Kotake, S. Yamada, Inelastic Neutrino-Helium Scatterings and Standing Accretion Shock Instability in Core-Collapse Supernovae, Astrophys. J. 667 (2007) 375–381. doi:10.1086/520755, arXiv:astro-ph/0606187[6]K.SumiyoshiG.RöpkeAppearance of light clusters in post-bounce evolution of core-collapse supernovaePhys. Rev. C77200805580410.1103/PhysRevC.77.055804K. Sumiyoshi, G. Röpke, Appearance of light clusters in post-bounce evolution of core-collapse supernovae, Phys. Rev. C 77 (2008) 055804. doi:10.1103/PhysRevC.77.055804.[7]A.ArconesG.Martínez-PinedoE.O'ConnorA.SchwenkH.-T.JankaC.J.HorowitzK.LangankeInfluence of light nuclei on neutrino-driven supernova outflowsPhys. Rev. C781200801580610.1103/PhysRevC.78.015806arXiv:0805.3752A. Arcones, G. Martínez-Pinedo, E. O'Connor, A. Schwenk, H.-T. Janka, C. J. Horowitz, K. Langanke, Influence of light nuclei on neutrino-driven supernova outflows, Phys. Rev. C78 (1) (2008) 015806. arXiv:0805.3752, doi:10.1103/PhysRevC.78.015806.[8]K.LangankeG.Martínez-PinedoB.MüllerH.-T.JankaA.MarekW.R.HixA.JuodagalvisJ.M.SampaioEffects of inelastic neutrino-nucleus scattering on supernova dynamics and radiated neutrino spectraPhys. Rev. Lett.1001200801110110.1103/PhysRevLett.100.011101arXiv:0706.1687K. Langanke, G. Martínez-Pinedo, B. Müller, H.-T. Janka, A. Marek, W. R. Hix, A. Juodagalvis, J. M. Sampaio, Effects of Inelastic Neutrino-Nucleus Scattering on Supernova Dynamics and Radiated Neutrino Spectra, Physical Review Letters 100 (1) (2008) 011101. arXiv:0706.1687, doi:10.1103/PhysRevLett.100.011101.[9]N.BarneaD.GazitInelastic neutrino reactions with light nuclei in a core-collapse supernovaFew-Body Syst.43200851110.1007/s00601-008-0201-2N. Barnea, D. Gazit, Inelastic neutrino reactions with light nuclei in a core-collapse supernova, Few-Body Systems 43 (2008) 5–11. doi:10.1007/s00601-008-0201-2.[10]S.FurusawaH.NagakuraK.SumiyoshiS.YamadaThe influence of inelastic neutrino reactions with light nuclei on the standing accretion shock instability in core-collapse supernovaeAstrophys. J.77420137810.1088/0004-637X/774/1/78arXiv:1305.1510S. Furusawa, H. Nagakura, K. Sumiyoshi, S. Yamada, The Influence of Inelastic Neutrino Reactions with Light Nuclei on the Standing Accretion Shock Instability in Core-collapse Supernovae, Astrophys. J. 774 (2013) 78. arXiv:1305.1510, doi:10.1088/0004-637X/774/1/78.[11]S.NasuS.X.NakamuraK.SumiyoshiT.SatoF.MyhrerK.KuboderaNeutrino emissivities from deuteron breakup and formation in supernovaeAstrophys. J.80120157810.1088/0004-637X/801/2/78arXiv:1402.0959S. Nasu, S. X. Nakamura, K. Sumiyoshi, T. Sato, F. Myhrer, K. Kubodera, Neutrino Emissivities from Deuteron Breakup and Formation in Supernovae, Astrophys. J. 801 (2015) 78. arXiv:1402.0959, doi:10.1088/0004-637X/801/2/78.[12]T.FischerG.Martínez-PinedoM.HempelL.HutherG.RöpkeS.TypelA.LohsExpected impact from weak reactions with light nuclei in corecollapse supernova simulationsEuropean Physical Journal Web of ConferencesEuropean Physical Journal Web of Conferencesvol. 10920160600210.1051/epjconf/201610906002arXiv:1512.00193T. Fischer, G. Martínez-Pinedo, M. Hempel, L. Huther, G. Röpke, S. Typel, A. Lohs, Expected impact from weak reactions with light nuclei in corecollapse supernova simulations, in: European Physical Journal Web of Conferences, Vol. 109 of European Physical Journal Web of Conferences, 2016, p. 06002. arXiv:1512.00193, doi:10.1051/epjconf/201610906002.[13]H.NagakuraS.FurusawaH.TogashiS.RichersK.SumiyoshiS.YamadaAstrophys. J. Suppl. Ser.240220193810.3847/1538-4365/aafac9H. Nagakura, S. Furusawa, H. Togashi, S. Richers, K. Sumiyoshi, S. Yamada 240 (2) (2019) 38. doi:10.3847/1538-4365/aafac9, [link]. URL https://doi.org/10.3847%2F1538-4365%2Faafac9[14]A.S.BotvinaI.N.MishustinStatistical approach for supernova matterNucl. Phys. A84320109813210.1016/j.nuclphysa.2010.05.052arXiv:0811.2593A. S. Botvina, I. N. Mishustin, Statistical approach for supernova matter, Nuclear Physics A 843 (2010) 98–132. arXiv:0811.2593, doi:10.1016/j.nuclphysa.2010.05.052.[15]M.HempelJ.Schaffner-BielichA statistical model for a complete supernova equation of stateNucl. Phys. A837201021025410.1016/j.nuclphysa.2010.02.010arXiv:0911.4073M. Hempel, J. Schaffner-Bielich, A statistical model for a complete supernova equation of state, Nuclear Physics A 837 (2010) 210–254. arXiv:0911.4073, doi:10.1016/j.nuclphysa.2010.02.010.[16]S.FurusawaS.YamadaK.SumiyoshiH.SuzukiA new baryonic equation of state at sub-nuclear densities for core-collapse simulationsAstrophys. J.738201117810.1088/0004-637X/738/2/178S. Furusawa, S. Yamada, K. Sumiyoshi, H. Suzuki, A New Baryonic Equation of State at Sub-nuclear Densities for Core-collapse Simulations, Astrophys. J. 738 (2011) 178. doi:10.1088/0004-637X/738/2/178.[17]N.BuyukcizmeciA.S.BotvinaI.N.MishustinTabulated equation of state for supernova matter including full nuclear ensembleAstrophys. J.78920143310.1088/0004-637X/789/1/33N. Buyukcizmeci, A. S. Botvina, I. N. Mishustin, Tabulated Equation of State for Supernova Matter Including Full Nuclear Ensemble, Astrophys. J. 789 (2014) 33. doi:10.1088/0004-637X/789/1/33.[18]S.FurusawaK.SumiyoshiS.YamadaH.SuzukiNew equations of state based on the liquid drop model of heavy nuclei and quantum approach to light nuclei for core-collapse supernova simulationsAstrophys. J.77220139510.1088/0004-637X/772/2/95S. Furusawa, K. Sumiyoshi, S. Yamada, H. Suzuki, New Equations of State Based on the Liquid Drop Model of Heavy Nuclei and Quantum Approach to Light Nuclei for Core-collapse Supernova Simulations, Astrophys. J. 772 (2013) 95. doi:10.1088/0004-637X/772/2/95.[19]S.FurusawaK.SumiyoshiS.YamadaH.SuzukiSupernova equations of state including full nuclear ensemble with in-medium effectsNucl. Phys. A957201718820710.1016/j.nuclphysa.2016.09.002S. Furusawa, K. Sumiyoshi, S. Yamada, H. Suzuki, Supernova equations of state including full nuclear ensemble with in-medium effects, Nuclear Physics A 957 (2017) 188 – 207. doi:http://dx.doi.org/10.1016/j.nuclphysa.2016.09.002.[20]S.FurusawaH.TogashiH.NagakuraK.SumiyoshiS.YamadaH.SuzukiM.TakanoA new equation of state for core-collapse supernovae based on realistic nuclear forces and including a full nuclear ensembleJ. Phys. G, Nucl. Part. Phys.4492017094001http://stacks.iop.org/0954-3899/44/i=9/a=094001S. Furusawa, H. Togashi, H. Nagakura, K. Sumiyoshi, S. Yamada, H. Suzuki, M. Takano, A new equation of state for core-collapse supernovae based on realistic nuclear forces and including a full nuclear ensemble, Journal of Physics G: Nuclear and Particle Physics 44 (9) (2017) 094001. URL http://stacks.iop.org/0954-3899/44/i=9/a=094001[21]S.FurusawaSensitivity of nuclear statistical equilibrium to nuclear uncertainties during stellar core collapsePhys. Rev. C98201806580210.1103/PhysRevC.98.065802S. Furusawa, Sensitivity of nuclear statistical equilibrium to nuclear uncertainties during stellar core collapse, Phys. Rev. C 98 (2018) 065802. doi:10.1103/PhysRevC.98.065802.[22]A.S.SchneiderL.F.RobertsC.D.OttOpen-source nuclear equation of state framework based on the liquid-drop model with skyrme interactionPhys. Rev. C96201706580210.1103/PhysRevC.96.065802A. S. Schneider, L. F. Roberts, C. D. Ott, Open-source nuclear equation of state framework based on the liquid-drop model with skyrme interaction, Phys. Rev. C 96 (2017) 065802. doi:10.1103/PhysRevC.96.065802.[23]H.PaisF.GulminelliC.m.c. ProvidênciaG.RöpkeFull distribution of clusters with universal couplings and in-medium effectsPhys. Rev. C99201905580610.1103/PhysRevC.99.055806H. Pais, F. Gulminelli, C. m. c. Providência, G. Röpke, Full distribution of clusters with universal couplings and in-medium effects, Phys. Rev. C 99 (2019) 055806. doi:10.1103/PhysRevC.99.055806.[24]S.FurusawaH.TogashiK.SumiyoshiK.SaitoS.YamadaH.SuzukiNuclear statistical equilibrium equation of state with a parametrized Dirac-Brückner Hartree-Fock calculationProg. Theor. Exp. Phys.202012020013D0510.1093/ptep/ptz135https://academic.oup.com/ptep/article-pdf/2020/1/013D05/32290084/ptz135.pdfS. Furusawa, H. Togashi, K. Sumiyoshi, K. Saito, S. Yamada, H. Suzuki, Nuclear statistical equilibrium equation of state with a parametrized Dirac-Brückner Hartree-Fock calculation, Progress of Theoretical and Experimental Physics 2020 (1), 013D05 (2020). doi:10.1093/ptep/ptz135. https://academic.oup.com/ptep/article-pdf/2020/1/013D05/32290084/ptz135.pdf,[25]S.FurusawaI.MishustinSelf-consistent calculation of the nuclear composition in hot and dense stellar matterPhys. Rev. C95201703580210.1103/PhysRevC.95.035802S. Furusawa, I. Mishustin, Self-consistent calculation of the nuclear composition in hot and dense stellar matter, Phys. Rev. C 95 (2017) 035802. doi:10.1103/PhysRevC.95.035802.[26]S.FurusawaI.MishustinEquilibrium nuclear ensembles taking into account vaporization of hot nuclei in dense stellar matterPhys. Rev. C97201802580410.1103/PhysRevC.97.025804S. Furusawa, I. Mishustin, Equilibrium nuclear ensembles taking into account vaporization of hot nuclei in dense stellar matter, Phys. Rev. C 97 (2018) 025804. doi:10.1103/PhysRevC.97.025804.[27]G.RöpkeA.SchnellP.SchuckP.NozièresFour-particle condensate in strongly coupled fermion systemsPhys. Rev. Lett.8019983177318010.1103/PhysRevLett.80.3177G. Röpke, A. Schnell, P. Schuck, P. Nozières, Four-particle condensate in strongly coupled fermion systems, Phys. Rev. Lett. 80 (1998) 3177–3180. doi:10.1103/PhysRevLett.80.3177.[28]S.MisicuI.N.MishustinW.GreinerQ-balls of clusterized baryonic matterMod. Phys. Lett. A32012017175001010.1142/S0217732317500109S. Misicu, I. N. Mishustin, W. Greiner, Q-balls of clusterized baryonic matter, Modern Physics Letters A 32 (01) (2017) 1750010. doi:10.1142/S0217732317500109.[29]A.SedrakianJ.W.ClarkE.KrotscheckSuperfluidity and pairing phenomena from cold atomic gases to neutron starsJ. Low Temp. Phys.1895201723123310.1007/s10909-017-1819-6A. Sedrakian, J. W. Clark, E. Krotscheck, Superfluidity and pairing phenomena from cold atomic gases to neutron stars, Journal of Low Temperature Physics 189 (5) (2017) 231–233. doi:10.1007/s10909-017-1819-6.[30]X.-H.WuS.-B.WangA.SedrakianG.RöpkeComposition of nuclear matter with light clusters and Bose–Einstein condensation of α particlesJ. Low Temp. Phys.1893201713314610.1007/s10909-017-1795-xX.-H. Wu, S.-B. Wang, A. Sedrakian, G. Röpke, Composition of nuclear matter with light clusters and bose–einstein condensation of α particles, Journal of Low Temperature Physics 189 (3) (2017) 133–146. doi:10.1007/s10909-017-1795-x.[31]L.M.SatarovM.I.GorensteinA.MotornenkoV.VovchenkoI.N.MishustinH.StoeckerBose-Einstein condensation and liquid-gas phase transition in strongly interacting matter composed of α particlesJ. Phys. G, Nucl. Part. Phys.4412201712510210.1088/1361-6471/aa8c5darXiv:1704.08039L. M. Satarov, M. I. Gorenstein, A. Motornenko, V. Vovchenko, I. N. Mishustin, H. Stoecker, Bose-Einstein condensation and liquid-gas phase transition in strongly interacting matter composed of α particles, Journal of Physics G Nuclear Physics 44 (12) (2017) 125102. arXiv:1704.08039, doi:10.1088/1361-6471/aa8c5d.[32]L.M.SatarovI.N.MishustinA.MotornenkoV.VovchenkoM.I.GorensteinH.StoeckerPhase transitions and Bose-Einstein condensation in α-nucleon matterPhys. Rev. C99201902490910.1103/PhysRevC.99.024909L. M. Satarov, I. N. Mishustin, A. Motornenko, V. Vovchenko, M. I. Gorenstein, H. Stoecker, Phase transitions and bose-einstein condensation in α-nucleon matter, Phys. Rev. C 99 (2019) 024909. doi:10.1103/PhysRevC.99.024909.[33]Z.-W.ZhangL.-W.ChenCold dilute nuclear matter with α-particle condensation in a generalized nonlinear relativistic mean-field modelPhys. Rev. C100201905430410.1103/PhysRevC.100.054304Z.-W. Zhang, L.-W. Chen, Cold dilute nuclear matter with α-particle condensation in a generalized nonlinear relativistic mean-field model, Phys. Rev. C 100 (2019) 054304. doi:10.1103/PhysRevC.100.054304.[34]K.OyamatsuK.IidaSaturation of nuclear matter and radii of unstable nucleiProg. Theor. Phys.109200363165010.1143/PTP.109.631arXiv:nucl-th/0204033K. Oyamatsu, K. Iida, Saturation of nuclear matter and radii of unstable nuclei, Prog. Theor. Phys. 109 (2003) 631–650. arXiv:nucl-th/0204033, doi:10.1143/PTP.109.631.[35]K.OyamatsuK.IidaSymmetry energy at subnuclear densities and nuclei in neutron star crustsPhys. Rev. C751200701580110.1103/PhysRevC.75.015801arXiv:nucl-th/0609040K. Oyamatsu, K. Iida, Symmetry energy at subnuclear densities and nuclei in neutron star crusts, Phys. Rev. C75 (1) (2007) 015801. arXiv:nucl-th/0609040, doi:10.1103/PhysRevC.75.015801.[36]M.BrackP.QuentinSelfconsistent calculations of highly excited nucleiPhys. Lett. B52197415916210.1016/0370-2693(74)90077-XM. Brack, P. Quentin, Selfconsistent calculations of highly excited nuclei, Physics Letters B 52 (1974) 159–162. doi:10.1016/0370-2693(74)90077-X.[37]S.TypelG.RöpkeT.KlähnD.BlaschkeH.H.WolterComposition and thermodynamics of nuclear matter with light clustersPhys. Rev. C811201001580310.1103/PhysRevC.81.015803S. Typel, G. Röpke, T. Klähn, D. Blaschke, H. H. Wolter, Composition and thermodynamics of nuclear matter with light clusters, Phys. Rev. C81 (1) (2010) 015803. doi:10.1103/PhysRevC.81.015803.[38]L.M.SatarovM.I.GorensteinI.N.MishustinH.StoeckerPossible Bose-Einstein condensate of alpha particles in the ground state of nuclear matter?Phys. Rev. C1012202002491310.1103/PhysRevC.101.024913L. M. Satarov, M. I. Gorenstein, I. N. Mishustin, H. Stoecker, Possible Bose-Einstein condensate of alpha particles in the ground state of nuclear matter? Phys. Rev. C101 (2) (2020) 024913. 10.1103/PhysRevC.101.024913. diff --git a/tests/test_config.py b/tests/test_config.py index ff6f0ad..525d6e2 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -25,13 +25,14 @@ from __future__ import absolute_import, division, print_function import os + import pytest -from inspire_utils.config import Config, load_config, MalformedConfig +from inspire_utils.config import Config, MalformedConfig, load_config -@pytest.fixture -def restore_cwd(): +@pytest.fixture() +def _restore_cwd(): cwd = os.getcwd() yield os.chdir(cwd) @@ -70,7 +71,7 @@ def test_config_inexistent_file(tmpdir): config = Config() - with pytest.raises(IOError): + with pytest.raises(IOError, match="No such file or directory"): config.load_pyfile(mock_config.strpath) @@ -83,8 +84,8 @@ def test_config_invalid_file(tmpdir): with pytest.raises(MalformedConfig): config.load_pyfile(mock_config.strpath) - -def test_load_config(restore_cwd, tmpdir): +@pytest.mark.usefixtures(name="_restore_cwd") +def test_load_config(tmpdir): mock_inspirehep_var_cfg = tmpdir.mkdir('var').mkdir('inspirehep-instance').join("inspirehep.cfg") mock_inspirehep_var_cfg.write("SERVER_NAME = '0.0.0.0'") diff --git a/tests/test_date.py b/tests/test_date.py index 1086f02..66b1eff 100644 --- a/tests/test_date.py +++ b/tests/test_date.py @@ -27,29 +27,29 @@ from inspire_utils.date import ( PartialDate, earliest_date, + fill_missing_date_parts, format_date, normalize_date, - fill_missing_date_parts ) def test_loads_validate_dates_day(): - with pytest.raises(ValueError): + with pytest.raises(ValueError, match='Day must be in DD format'): PartialDate.loads('2015-10-1') def test_loads_validate_dates_day_when_day_is_00(): - with pytest.raises(ValueError): + with pytest.raises(ValueError, match='Day must be in DD format'): PartialDate.loads('2015-10-00') def test_loads_validate_dates_month_when_month_is_00(): - with pytest.raises(ValueError): + with pytest.raises(ValueError, match='Month must be in MM format'): PartialDate.loads('2015-00') def test_loads_validate_dates_month(): - with pytest.raises(ValueError): + with pytest.raises(ValueError, match='Month must be in MM format'): PartialDate.loads('2015-1-10') @@ -58,17 +58,17 @@ def test_partial_date_accepts_valid_dates(): def test_partial_date_raises_on_invalid_dates(): - with pytest.raises(ValueError): + with pytest.raises(ValueError, match='day is out of range for month'): PartialDate(1686, 1, 42) def test_partial_date_raises_on_day_with_no_month(): - with pytest.raises(TypeError): + with pytest.raises(TypeError, match='month must not be None if day is not None'): PartialDate(1686, None, 30) def test_partial_date_raises_on_wrong_types(): - with pytest.raises(TypeError): + with pytest.raises(TypeError, match='arguments to PartialDate must be of type int or None'): PartialDate('1686', '6', '30') @@ -170,12 +170,12 @@ def test_normalize_date_handles_human_friendly_dates(): def test_normalize_date_raises_on_dates_without_year(): - with pytest.raises(ValueError): + with pytest.raises(ValueError, match='date does not contain a year'): normalize_date('Fri June 30') def test_normalize_date_raises_on_unparseable_dates(): - with pytest.raises(ValueError): + with pytest.raises(ValueError, match='Unknown string format'): normalize_date('Foo') diff --git a/tests/test_dedupers.py b/tests/test_dedupers.py index 0981619..9769b87 100644 --- a/tests/test_dedupers.py +++ b/tests/test_dedupers.py @@ -22,7 +22,7 @@ from __future__ import absolute_import, division, print_function -from inspire_utils.dedupers import dedupe_list, dedupe_list_of_dicts, dedupe_all_lists +from inspire_utils.dedupers import dedupe_all_lists, dedupe_list, dedupe_list_of_dicts def test_dedupe_list(): diff --git a/tests/test_name.py b/tests/test_name.py index 2044ff1..af0a3da 100644 --- a/tests/test_name.py +++ b/tests/test_name.py @@ -23,11 +23,16 @@ from __future__ import absolute_import, division, print_function import pytest -from inspire_utils.name import (ParsedName, format_name, - generate_name_variations, normalize_name) -from inspire_utils.query import ordered from mock import patch +from inspire_utils.name import ( + ParsedName, + format_name, + generate_name_variations, + normalize_name, +) +from inspire_utils.query import ordered + def test_normalize_name_full(): expected = "Smith, John Peter" @@ -97,7 +102,7 @@ def test_normalize_name_converts_unicode_apostrophe_to_normal_apostrophe(): @pytest.mark.parametrize( - "input_author_name,expected", + ("input_author_name", "expected"), [ ("Smith, John Jr", "Smith, John, Jr."), ("Smith, John Jr.", "Smith, John, Jr."), @@ -114,7 +119,7 @@ def test_normalize_name_handles_suffixes(input_author_name, expected): @pytest.mark.parametrize( - "input_author_name,expected", + ("input_author_name", "expected"), [("Sir John Smith", "Smith, John"), ("Bao, Hon", "Bao, Hon"), ("ed witten", "Witten, Ed")], ) @@ -433,7 +438,7 @@ def test_parsed_name_initials(): @pytest.mark.parametrize( - "input_author_name,expected", + ("input_author_name", "expected"), [("Lieber, Ed", "E. Lieber"), ('Lieber, Ed Viktor', "E. V. Lieber"), ('Lieber, Ed Jr.', "E. Lieber, Jr."), @@ -469,7 +474,7 @@ def test_first_names_are_never_printed_with_initials_only_if_no_last_name(): def test_first_name_with_dash_is_initialized_correctly(): - assert u"Z. Y. Yin" == format_name("Zhao-Yu Yin", initials_only=True) + assert format_name("Zhao-Yu Yin", initials_only=True) == u"Z. Y. Yin" def test_first_name_with_dash_is_printed_with_dash_and_initialized_correctly(): @@ -480,13 +485,13 @@ def test_first_name_with_dash_is_printed_with_dash_and_initialized_correctly(): def test_first_name_initials_without_whitespace_is_initialized_correctly(): - assert u"M. A. M. G. Garcia" == format_name( + assert format_name( "Miguel A-M.G. Garcia", initials_only=True - ) + ) == u"M. A. M. G. Garcia" def test_last_name_recognized_correctly_regression_test(): - assert u"De Sousa Vieira" == ParsedName.loads("De Sousa Vieira, M.C.").last + assert ParsedName.loads("De Sousa Vieira, M.C.").last == u"De Sousa Vieira" def test_generate_es_query_lastname_firstname_with_commas_and_initials(): diff --git a/tests/test_parsers_crossref.py b/tests/test_parsers_crossref.py index f6b32c5..2c12cc5 100644 --- a/tests/test_parsers_crossref.py +++ b/tests/test_parsers_crossref.py @@ -27,12 +27,13 @@ ) import json + import pytest import yaml - +from fixtures import get_test_suite_path from inspire_schemas.utils import validate + from inspire_utils.parsers.crossref import CrossrefParser -from fixtures import get_test_suite_path def get_parsed_from_file(filename): @@ -94,7 +95,7 @@ def records(request): def test_data_completeness(records): all_fields = REQUIRED_FIELDS + UNREQUIRED_FIELDS - for field in records['expected'].keys(): + for field in records['expected']: assert field in all_fields diff --git a/tests/test_parsers_elsevier.py b/tests/test_parsers_elsevier.py index 0800d7e..234e67e 100644 --- a/tests/test_parsers_elsevier.py +++ b/tests/test_parsers_elsevier.py @@ -26,14 +26,15 @@ print_function, ) -import pytest -import yaml import sys +import pytest +import yaml from deepdiff import DeepDiff +from fixtures import get_test_suite_path from inspire_schemas.utils import validate + from inspire_utils.parsers.elsevier import ElsevierParser -from fixtures import get_test_suite_path def get_parsed_from_file(filename): @@ -105,7 +106,7 @@ def records(request): def test_data_completeness(records): tested_fields = FIELDS_TO_CHECK + FIELDS_TO_CHECK_SEPARATELY - for field in records['expected'].keys(): + for field in records['expected']: assert field in tested_fields diff --git a/tests/test_parsers_jats.py b/tests/test_parsers_jats.py index 3f842d7..d222dab 100644 --- a/tests/test_parsers_jats.py +++ b/tests/test_parsers_jats.py @@ -26,14 +26,15 @@ print_function, ) -import pytest -import yaml import sys +import pytest +import yaml from deepdiff import DeepDiff +from fixtures import get_test_suite_path from inspire_schemas.utils import validate + from inspire_utils.parsers.jats import JatsParser -from fixtures import get_test_suite_path def get_parsed_from_file(filename): @@ -100,7 +101,7 @@ def records(request): def test_data_completeness(records): tested_fields = FIELDS_TO_CHECK + FIELDS_TO_CHECK_SEPARATELY - for field in records['expected'].keys(): + for field in records['expected']: assert field in tested_fields diff --git a/tests/test_urls.py b/tests/test_urls.py index 57ae966..aac1c37 100644 --- a/tests/test_urls.py +++ b/tests/test_urls.py @@ -30,7 +30,7 @@ @pytest.mark.parametrize( - 'url,scheme,expected', + ('url', 'scheme', 'expected'), [ ('http://inspirehep.net', None, 'http://inspirehep.net'), ('http://inspirehep.net', 'https', 'http://inspirehep.net'), @@ -64,7 +64,7 @@ def test_ensure_scheme(url, scheme, expected): @pytest.mark.parametrize( - 'pattern,recid,expected', + ('pattern', 'recid', 'expected'), [ ( 'http://inspirehep.net/record/{recid}',