• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LSSTDESC / CLMM / 25192257180

30 Apr 2026 10:22PM UTC coverage: 99.65% (-0.4%) from 100.0%
25192257180

Pull #603

github

web-flow
Merge 017cf7832 into 270e9a549
Pull Request #603: issue/591/triaxiality: Build scripts in examples/triaxiality [version:1.18.0]

194 of 194 new or added lines in 7 files covered. (100.0%)

9 existing lines in 1 file now uncovered.

2561 of 2570 relevant lines covered (99.65%)

1.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

43.75
/clmm/utils/plotting.py
1
"""A collection of scripts that can be used to plot the various quantities that CLMM models."""
2

3
# Set mpl backend run plots on github actions
4
import os
1✔
5

6
import matplotlib as mpl
1✔
7

8
# pylint: disable=wrong-import-position
9
if os.environ.get("DISPLAY", "") == "test":
1✔
10
    print("no display found. Using non-interactive Agg backend")
1✔
11
    mpl.use("Agg")
1✔
12
import matplotlib.pyplot as plt
1✔
13

14

15
def plot_profiles(
1✔
16
    rbins,
17
    tangential_component,
18
    tangential_component_error,
19
    cross_component,
20
    cross_component_error,
21
    r_units=None,
22
    xscale="linear",
23
    yscale="linear",
24
    tangential_component_label="Tangential component",
25
    cross_component_label="Cross component",
26
):
27
    """Plot shear profiles
28

29
    Parameters
30
    ----------
31
    rbins: array_like
32
        The centers of the radial bins that was used to compute the shears.
33
    tangential_component: array_like
34
        The tangential component at the radii of `rbins`
35
    tangential_component_error: array_like
36
        The uncertainty in the tangential component
37
    cross_component: array_like
38
        The cross component at the radii of `rbins`
39
    cross_component_error: array_like
40
        The uncertainty in the cross component
41
    r_units: str
42
        Units of `rbins` for x-axis label
43
    xscale:
44
        matplotlib.pyplot.xscale parameter to set x-axis scale (e.g. to logarithmic axis)
45
    yscale:
46
        matplotlib.pyplot.yscale parameter to set y-axis scale (e.g. to logarithmic axis)
47

48
    Returns
49
    -------
50
    fig:
51
        The matplotlib figure object that has been plotted to.
52
    axes:
53
        The matplotlib axes object that has been plotted to.
54
    """
55
    # Plot the tangential shears
UNCOV
56
    fig, axes = plt.subplots()
×
UNCOV
57
    axes.errorbar(
×
58
        rbins,
59
        tangential_component,
60
        yerr=tangential_component_error,
61
        fmt="bo-",
62
        label=tangential_component_label,
63
        lw=0.2,
64
        markersize=1.5,
65
        elinewidth=0.5,
66
        capthick=3,
67
    )
68
    # Plot the cross shears
UNCOV
69
    axes.errorbar(
×
70
        rbins,
71
        cross_component,
72
        yerr=cross_component_error,
73
        fmt="ro-",
74
        label=cross_component_label,
75
        lw=0.2,
76
        markersize=1.5,
77
        elinewidth=0.5,
78
        capthick=3,
79
    )
80
    # format
UNCOV
81
    axes.set_xscale(xscale)
×
UNCOV
82
    axes.set_yscale(yscale)
×
UNCOV
83
    axes.legend()
×
UNCOV
84
    axes.set_xlabel(f"Radius [{r_units}]")
×
UNCOV
85
    axes.set_ylabel(rf"{tangential_component_label} | {cross_component_label}")
×
86

UNCOV
87
    return fig, axes
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc