\(\renewcommand\AA{\unicode{x212B}}\)

SavePlot1DAsJson v1

Summary

Plottable data file in Json format

See Also

SavePlot1D, StringToPng

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

Workspace that contains plottable data

JsonFilename

Input

string

Mandatory

Name of the output Json file. Allowed extensions: [‘.json’]

PlotName

Input

string

Name of the output plot

Description

This algorithm is to extract plottable 1-D dataset(s) with metadata from a MatrixWorkspace, serialize it into json format, and dump the result to a file.

It currently only support MatrixWorkspace

Note for usage with ORNL live monitor: The output file needs to be named <inst>_<runnumber>_plot_data.json to be cataloged and plotted.

Usage

Example:

import os, numpy as np
# prepare input
E = np.arange(-50, 50, 10.0)
I = 1000 * np.exp(-E**2/10**2)
err = I ** .5
dataws = CreateWorkspace(
    DataX = E, DataY = I, DataE = err, NSpec = 1,
    UnitX = "Energy")
# output path
out_json = "myplot.json"
# run algorithm
SavePlot1DAsJson(InputWorkspace=dataws, JsonFilename=out_json, PlotName="myplot")

Categories: AlgorithmIndex | DataHandling\Plots

Source

Python: SavePlot1DAsJson.py