コード例 #1
0
ファイル: test_data_types.py プロジェクト: vwxyzjn/client
def test_matplotlib_plotly_with_multiple_axes():
    """Ensures that wandb.Plotly constructor can accept a plotly figure 
    reference in which the figure has multiple axes. Importantly, there is 
    no requirement that any of the axes have plotted data.
    """
    for fig in utils.matplotlib_multiple_axes_figures():
        wandb.Plotly(fig)  # this should not error.

    for fig in utils.matplotlib_multiple_axes_figures():
        wandb.Plotly(plt)  # this should not error.
コード例 #2
0
ファイル: test_data_types.py プロジェクト: vwxyzjn/client
def test_plotly_from_matplotlib_with_image():
    """Ensures that wandb.Plotly constructor properly errors when
    a pyplot with image is passed 
    """
    # try the figure version
    fig = utils.matplotlib_with_image()
    with pytest.raises(ValueError):
        wandb.Plotly(fig)
    plt.close()

    # try the plt version
    fig = utils.matplotlib_with_image()
    with pytest.raises(ValueError):
        wandb.Plotly(plt)
    plt.close()
コード例 #3
0
ファイル: wandb_logger.py プロジェクト: golmschenk/ramjet
    def log_figure(summary_name: str, figure: plotly.graph_objects.Figure,
                   epoch: int) -> None:
        """
        Logs a figure to wandb.

        :param summary_name: The name of the summary to use on wandb.
        :param figure: The figure to be logged.
        :param epoch: The current epoch to log with.
        """
        wandb.log({summary_name: wandb.Plotly(figure)}, step=epoch)
コード例 #4
0
def plot_all_output_sensitivities(jacobians: Mapping[str, OutputSensitivity]):
    """
    Create a plotly heatmap for each input sensitivity matrix for each model
    output.

    jacobians: mapping of each out variable to a sensitivity for each input
        e.g.,
        air_temperature_after_precpd:
            air_temperature_input: sensitivity matrix (nlev x nlev)
            specific_humidity_input: sensitivity matrix
        specific_humidity_after_precpd:
            ...
    """

    all_plots = {
        out_name: _plot_single_output_sensitivities(out_name,
                                                    out_sensitivities)
        for out_name, out_sensitivities in jacobians.items()
    }

    for out_name, fig in all_plots.items():
        wandb.log({f"jacobian/{out_name}": wandb.Plotly(fig)})
コード例 #5
0
 def func(ds):
     return {
         f"lat_p_skill/{field}":
         wandb.Plotly(plot_cloud_skill_zonal(ds, field, "mean"))
     }