src/graphnet/pisa/plotting.py
def plot_2D_contour(
    contour_data,
    xlim=(0.4, 0.6),
    ylim=(2.38 * 1e-3, 2.55 * 1e-3),
    chi2_critical_value=4.605,
    width=3.176,
    height=2.388,
):
    """Plots 2D contours from GraphNeT PISA fits.

    Args:
        contour_data (list): list of  dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_of_my_model_in_fit'}. One can specify optional fields in the dictionary: "label" - the legend label, "color" - the color of the contour, "linestyle" - the style of the contour line.
        xlim (tuple): tuple containing lower and upper bound of xaxis. Defaults to (0.4, 0.6)
        ylim (tuple): tuple containing lower and upper bound of xaxis. Defaults to (2.38*1e-3, 2.55*1e-3)
        chi2_critical_value (float, optional): The critical value of the chi2 fits. Defaults to 4.605 (90% CL).
        width (float, optional): width of figure in inches. Defaults to 3.176.
        height (float, optional): height of figure in inches. Defaults to 2.388.

    Returns:
        matplotlib.pyplot.figure: the figure with contours
    """
    fig, ax = plt.subplots(figsize=(width, height), constrained_layout=True)
    proxy = []
    labels = []
    for entry in contour_data:
        entry_data, model_name, label, ls, color = read_entry(entry)
        model_idx = entry_data["model"] == model_name
        model_data = entry_data.loc[model_idx]
        x = pd.unique(model_data.sort_values("theta23_fixed")["theta23_fixed"])
        y = pd.unique(model_data.sort_values("dm31_fixed")["dm31_fixed"])
        z = np.zeros((len(y), len(x)))
        for i in range(len(x)):
            for k in range(len(y)):
                idx = (model_data["theta23_fixed"] == x[i]) & (
                    model_data["dm31_fixed"] == y[k]
                )
                match = model_data["mod_chi2"][idx]
                if len(match) > 0:
                    if model_data["converged"][idx].values is True:
                        match = float(match)
                    else:
                        match = 10000  # Sets the z value very high to exclude it from contour
                else:
                    match = 10000  # Sets the z value very high to exclude it from contour
                z[k, i] = match

        CS = ax.contour(
            np.sin(np.deg2rad(x)) ** 2,
            y,
            z,
            levels=[chi2_critical_value],
            colors=color,
            label=label,
            linestyles=ls,
            linewidths=2,
        )
        # ax.clabel(CS, inline=1, fontsize=10)
        proxy.extend(
            [plt.Rectangle((0, 0), 1, 1, fc=color) for pc in CS.collections]
        )
        if chi2_critical_value == 4.605:
            label = label + " 90 $\\%$ CL"
        labels.append(label)
    plt.legend(proxy, labels, frameon=False, loc="upper right")
    plt.xlim(xlim[0], xlim[1])
    plt.ylim(ylim[0], ylim[1])
    plt.xlabel("$\\sin^2(\\theta_{23})$", fontsize=12)
    plt.ylabel("$\\Delta m_{31}^2 [eV^2]$", fontsize=12)
    plt.ticklabel_format(axis="y", style="sci", scilimits=(0, 0))
    plt.title("Sensitivity (Simplified Analysis)")
    return fig
Plots 2D contours from GraphNeT PISA fits.

    Args:
        contour_data (list): list of  dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_of_my_model_in_fit'}. One can specify optional fields in the dictionary: "label" - the legend label, "color" - the color of the contour, "linestyle" - the style of the contour line.
        xlim (tuple): tuple containing lower and upper bound of xaxis. Defaults to (0.4, 0.6)
        ylim (tuple): tuple containing lower and upper bound of xaxis. Defaults to (2.38*1e-3, 2.55*1e-3)
        chi2_critical_value (float, optional): The critical value of the chi2 fits. Defaults to 4.605 (90% CL).
        width (float, optional): width of figure in inches. Defaults to 3.176.
        height (float, optional): height of figure in inches. Defaults to 2.388.

    Returns:
        matplotlib.pyplot.figure: the figure with contours
    
Plots 2D contours from GraphNeT PISA fits.
Plots 2D contours from GraphNeT PISA fits .
def plot_2D_contour(
    contour_data,
    xlim=(0.4, 0.6),
    ylim=(2.38 * 1e-3, 2.55 * 1e-3),
    chi2_critical_value=4.605,
    width=3.176,
    height=2.388,
):
    fig, ax = plt.subplots(figsize=(width, height), constrained_layout=True)
    proxy = []
    labels = []
    for entry in contour_data:
        entry_data, model_name, label, ls, color = read_entry(entry)
        model_idx = entry_data["model"] == model_name
        model_data = entry_data.loc[model_idx]
        x = pd.unique(model_data.sort_values("theta23_fixed")["theta23_fixed"])
        y = pd.unique(model_data.sort_values("dm31_fixed")["dm31_fixed"])
        z = np.zeros((len(y), len(x)))
        for i in range(len(x)):
            for k in range(len(y)):
                idx = (model_data["theta23_fixed"] == x[i]) & (
                    model_data["dm31_fixed"] == y[k]
                )
                match = model_data["mod_chi2"][idx]
                if len(match) > 0:
                    if model_data["converged"][idx].values is True:
                        match = float(match)
                    else:
                        match = 10000  
                else:
                    match = 10000  
                z[k, i] = match
        CS = ax.contour(
            np.sin(np.deg2rad(x)) ** 2,
            y,
            z,
            levels=[chi2_critical_value],
            colors=color,
            label=label,
            linestyles=ls,
            linewidths=2,
        )
        proxy.extend(
            [plt.Rectangle((0, 0), 1, 1, fc=color) for pc in CS.collections]
        )
        if chi2_critical_value == 4.605:
            label = label + " 90 $\\%$ CL"
        labels.append(label)
    plt.legend(proxy, labels, frameon=False, loc="upper right")
    plt.xlim(xlim[0], xlim[1])
    plt.ylim(ylim[0], ylim[1])
    plt.xlabel("$\\sin^2(\\theta_{23})$", fontsize=12)
    plt.ylabel("$\\Delta m_{31}^2 [eV^2]$", fontsize=12)
    plt.ticklabel_format(axis="y", style="sci", scilimits=(0, 0))
    plt.title("Sensitivity (Simplified Analysis)")
    return fig
def plot_2D_contour ( contour_data , xlim = ( 0.4 , 0.6 ) , ylim = ( 2.38 * 1e-3 , 2.55 * 1e-3 ) , chi2_critical_value = 4.605 , width = 3.176 , height = 2.388 , ) : fig , ax = plt . subplots ( figsize = ( width , height ) , constrained_layout = True ) proxy = [ ] labels = [ ] for entry in contour_data : entry_data , model_name , label , ls , color = read_entry ( entry ) model_idx = entry_data [ "model" ] == model_name model_data = entry_data . loc [ model_idx ] x = pd . unique ( model_data . sort_values ( "theta23_fixed" ) [ "theta23_fixed" ] ) y = pd . unique ( model_data . sort_values ( "dm31_fixed" ) [ "dm31_fixed" ] ) z = np . zeros ( ( len ( y ) , len ( x ) ) ) for i in range ( len ( x ) ) : for k in range ( len ( y ) ) : idx = ( model_data [ "theta23_fixed" ] == x [ i ] ) & ( model_data [ "dm31_fixed" ] == y [ k ] ) match = model_data [ "mod_chi2" ] [ idx ] if len ( match ) > 0 : if model_data [ "converged" ] [ idx ] . values is True : match = float ( match ) else : match = 10000 else : match = 10000 z [ k , i ] = match CS = ax . contour ( np . sin ( np . deg2rad ( x ) ) ** 2 , y , z , levels = [ chi2_critical_value ] , colors = color , label = label , linestyles = ls , linewidths = 2 , ) proxy . extend ( [ plt . Rectangle ( ( 0 , 0 ) , 1 , 1 , fc = color ) for pc in CS . collections ] ) if chi2_critical_value == 4.605 : label = label + " 90 $\\%$ CL" labels . append ( label ) plt . legend ( proxy , labels , frameon = False , loc = "upper right" ) plt . xlim ( xlim [ 0 ] , xlim [ 1 ] ) plt . ylim ( ylim [ 0 ] , ylim [ 1 ] ) plt . xlabel ( "$\\sin^2(\\theta_{23})$" , fontsize = 12 ) plt . ylabel ( "$\\Delta m_{31}^2 [eV^2]$" , fontsize = 12 ) plt . ticklabel_format ( axis = "y" , style = "sci" , scilimits = ( 0 , 0 ) ) plt . title ( "Sensitivity (Simplified Analysis)" ) return fig
Plots 2D contours from GraphNeT PISA fits.
Plots 2D contours from GraphNeT PISA fits .
"""Plots 2D contours from GraphNeT PISA fits.

    Args:
        contour_data (list): list of  dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_of_my_model_in_fit'}. One can specify optional fields in the dictionary: "label" - the legend label, "color" - the color of the contour, "linestyle" - the style of the contour line.
        xlim (tuple): tuple containing lower and upper bound of xaxis. Defaults to (0.4, 0.6)
        ylim (tuple): tuple containing lower and upper bound of xaxis. Defaults to (2.38*1e-3, 2.55*1e-3)
        chi2_critical_value (float, optional): The critical value of the chi2 fits. Defaults to 4.605 (90% CL).
        width (float, optional): width of figure in inches. Defaults to 3.176.
        height (float, optional): height of figure in inches. Defaults to 2.388.

    Returns:
        matplotlib.pyplot.figure: the figure with contours
    """ # Sets the z value very high to exclude it from contour # Sets the z value very high to exclude it from contour # ax.clabel(CS, inline=1, fontsize=10)
the figure with contours
the figure with contours
matplotlib.pyplot.figure
contour_data
list of  dictionaries with plotting information. Format is for each dictionary is: {'path':path_to_pisa_fit_result, 'model': 'name_of_my_model_in_fit'}. One can specify optional fields in the dictionary: "label" - the legend label, "color" - the color of the contour, "linestyle" - the style of the contour line.
list of dictionaries with plotting information . Format is for each dictionary is : { ' path ' : path_to_pisa_fit_result ' model ' : ' name_of_my_model_in_fit ' } . One can specify optional fields in the dictionary : " label " - the legend label " color " - the color of the contour " linestyle " - the style of the contour line .
xlim
tuple containing lower and upper bound of xaxis.
tuple containing lower and upper bound of xaxis .
(0.4, 0
ylim
tuple containing lower and upper bound of xaxis.
tuple containing lower and upper bound of xaxis .
(2.38*1e-3, 2
chi2_critical_value
The critical value of the chi2 fits.
The critical value of the chi2 fits .
4.605 (90% CL)
width
width of figure in inches.
width of figure in inches .
3.176
height
height of figure in inches.
height of figure in inches .
2.388