Skip to content

Commit

Permalink
Feature: Adding bundle for ProbNum2025 (#155)
Browse files Browse the repository at this point in the history
* new tmlr2023 bundle

* Feature: Adding bundle for ProbNum25

* Fix: add missing test cases for ProbNum25, addressing comments by `pnkraemer`

---------

Co-authored-by: Philipp Hennig <phennig@tuebingen.mpg.de>
  • Loading branch information
philipphennig and Philipp Hennig authored Oct 17, 2024
1 parent a1e854c commit 0f970e8
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_rc_params_cases/case_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def case_bundles_tmlr2023():
return bundles.tmlr2023(nrows=2, ncols=2, family="serif")


@pytest_cases.parametrize(column=["full", "half"])
def case_bundles_probnum2025(column):
return bundles.probnum2025(column=column, nrows=1, ncols=1, family="sans-serif")


def case_bundles_beamer_moml():
return bundles.beamer_moml(rel_width=0.9, rel_height=0.9)

Expand Down
8 changes: 8 additions & 0 deletions tests/test_rc_params_cases/case_figsizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,13 @@ def case_figsizes_jmlr2001():
return figsizes.jmlr2001(nrows=2, ncols=3, height_to_width_ratio=1.0)


def case_figsizes_probnum2025_full():
return figsizes.probnum2025_full(nrows=2, ncols=3, height_to_width_ratio=1.0)


def case_figsizes_probnum2025_half():
return figsizes.probnum2025_half(nrows=2, ncols=3, height_to_width_ratio=1.0)


def case_beamer_169():
return figsizes.beamer_169(rel_width=0.5, rel_height=0.1)
4 changes: 4 additions & 0 deletions tests/test_rc_params_cases/case_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,7 @@ def case_fonts_cvpr2024_tex_default():

def case_fonts_cvpr2024_tex_custom():
return fonts.cvpr2024_tex(family="serif")


def case_fonts_probnum2025_tex_default():
return fonts.probnum2025_tex()
4 changes: 4 additions & 0 deletions tests/test_rc_params_cases/case_fontsizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,9 @@ def case_fontsizes_jmlr2001():
return fontsizes.jmlr2001()


def case_fontsizes_probnum2025():
return fontsizes.probnum2025()


def case_fontsizes_beamer():
return fontsizes.beamer()
14 changes: 14 additions & 0 deletions tueplots/bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ def iclr2024(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif"):
return {**font_config, **size, **fontsize_config}


def probnum2025(*, column="half", nrows=1, ncols=1, family="sans-serif"):
"""ProbNum 2025 bundle."""
if column == "half":
size = figsizes.probnum2025_half(nrows=nrows, ncols=ncols)
elif column == "full":
size = figsizes.probnum2025_full(nrows=nrows, ncols=ncols)
else:
msg = _msg_error_wrong_arg_column(column)
raise ValueError(msg)
font_config = fonts.probnum2025_tex(family=family)
fontsize_config = fontsizes.probnum2025()
return {**font_config, **size, **fontsize_config}


def _msg_error_wrong_arg_usetex(usetex):
msg = f"Argument usetex={usetex} unknown."
msg += "Either usetex=True or usetex=False expected."
Expand Down
51 changes: 51 additions & 0 deletions tueplots/figsizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,57 @@ def cvpr2024_full(
)


def probnum2025_half(
*,
nrows=1,
ncols=1,
constrained_layout=True,
tight_layout=False,
height_to_width_ratio=_GOLDEN_RATIO,
pad_inches=_PAD_INCHES,
):
"""Single-column (half-width) figures for ProbNum 2025."""
figsize = _from_base_pt(
base_width_pt=240,
rel_width=1.0,
height_to_width_ratio=height_to_width_ratio,
nrows=nrows,
ncols=ncols,
)
return _figsize_to_output_dict(
figsize=figsize,
constrained_layout=constrained_layout,
tight_layout=tight_layout,
pad_inches=pad_inches,
)


def probnum2025_full(
*,
rel_width=1.0,
nrows=1,
ncols=2,
constrained_layout=True,
tight_layout=False,
height_to_width_ratio=_GOLDEN_RATIO,
pad_inches=_PAD_INCHES,
):
"""Full-page (full-width) figures for ProbNum 2025."""
figsize = _from_base_pt(
base_width_pt=500,
rel_width=rel_width,
height_to_width_ratio=height_to_width_ratio,
nrows=nrows,
ncols=ncols,
)
return _figsize_to_output_dict(
figsize=figsize,
constrained_layout=constrained_layout,
tight_layout=tight_layout,
pad_inches=pad_inches,
)


# Single-column formats


Expand Down
5 changes: 5 additions & 0 deletions tueplots/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ def icml2024(*, family="serif"):
return _times(family=family)


def probnum2025_tex(*, family="serif"):
"""Fonts for ProbNum 2025. LaTeX version."""
return _computer_modern_tex(family=family)


def beamer_moml():
"""Fonts that are compatible with the beamer template of the method-of-machine-learning group in Tübingen."""
return {
Expand Down
5 changes: 5 additions & 0 deletions tueplots/fontsizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ def tmlr2023(*, default_smaller=1):
return _from_base(base=10 - default_smaller)


def probnum2025(*, default_smaller=1):
"""Font size for ProbNum 2025."""
return _from_base(base=10 - default_smaller)


def beamer_moml(**kwargs):
"""Font size for a beamer slide in aspectratio 16:9 with 10pt font.
Expand Down

0 comments on commit 0f970e8

Please sign in to comment.