Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New algorithm to save json data from workspace #10234

Closed
peterfpeterson opened this issue Apr 29, 2014 · 1 comment · Fixed by #13522
Closed

New algorithm to save json data from workspace #10234

peterfpeterson opened this issue Apr 29, 2014 · 1 comment · Fixed by #13522
Assignees
Labels
Framework Issues and pull requests related to components in the Framework

Comments

@peterfpeterson
Copy link
Member

This issue was originally TRAC 9391

This will be used with auto-reduction to write out data for interactive visualization in http://monitor.sns.gov/.

For a single curve

{
  "plot name": {"y": [0, 1, 2, 3...], "x": [0, 1, 2, 3...], "e": [0, 1, 2, 3...],
                       "xlabel": "x axis label", "ylabel": "y axis label", "title": "long plot title"} 
}

The plot name should be a short name that can be used as a handle for the plot. For instance, the web monitor will look for a "main_output" plot in the json file, so the plot name should be an algorithm input property.

For more than one curve, just add entries to the top-level dictionary.

{
  "plot name 1": {"y": [0, 1, 2, 3...], "x": [0, 1, 2, 3...], "e": [0, 1, 2, 3...], ...},
  "plot name 2": {"y": [0, 1, 2, 3...], "x": [0, 1, 2, 3...], "e": [0, 1, 2, 3...], ...} 
}

There still needs to be a way to have multiple sub-plots (e.g. stacked frames for S(Q) and G(r))

Only MatrixWorkspace needs to be supported.

@peterfpeterson
Copy link
Member Author

@OwenArnold (2014-05-01T08:15:32):
Does this ticket provide a full schema for the JSON? Should we capture the schema somewhere?

Also, I'm not sure if there's a portable JSON generator/parser for C++ that would help you here.


@stuartcampbell (2014-05-01T13:00:43):
There is [http://jsoncpp.sourceforge.net] and Qt5 has JSON support! :-) [http://qt-project.org/doc/qt-5/json.html]


@NickDraper (2014-05-07T08:48:30):
Stuart forgot to "Clarify"


@NickDraper (2014-05-07T08:57:22):
Of course I suspect we want something at the framework level, not the UI, so QT is probably out.

JSON is used in the Script Library and the remote algorithms

Take a look at MantidRemote/src/simplejson.cpp

Also the script repo uses <boost/property_tree/json_parser.hpp> in ScriptRepository\src\ScriptRepositoryImpl.cpp

Could you take a look at these to see if they fit the bill?


@NickDraper (2014-06-23T08:01:13):
Moved to Backlog at the code freeze of release 3.2


@NickDraper (2015-03-02T11:57:12):
Set to new at the end of Triage

@peterfpeterson peterfpeterson added the Framework Issues and pull requests related to components in the Framework label Jun 3, 2015
@mdoucet mdoucet assigned peterfpeterson and unassigned mdoucet Aug 26, 2015
yxqd added a commit that referenced this issue Sep 1, 2015
Added an altorightm to serialize 1D workspace data
into a json dictionary and save.
Added files into Framework/PythonInterface

 * plugins/algorithms/Save1DPlottableAsJson.py
 * test/python/plugins/algorithms/Save1DPlottableAsJsonTest.py

Tests include 3 cases:

 * single curve (point data)
 * single histogram
 * two curves

TODO:

 * Add validation into tests
 * Support optional property to assign a name to the plottable(s)
 * documentation
yxqd added a commit that referenced this issue Sep 1, 2015
yxqd added a commit that referenced this issue Sep 1, 2015
yxqd added a commit that referenced this issue Sep 1, 2015
forgot to commit changes to the source code at the last commit for this
yxqd added a commit that referenced this issue Sep 1, 2015
yxqd added a commit that referenced this issue Sep 2, 2015
System test failed: have to remove the assigment of "framework" category
Documentation test failed: now create the workspace on the fly
yxqd added a commit that referenced this issue Sep 3, 2015
yxqd added a commit that referenced this issue Sep 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues and pull requests related to components in the Framework
Projects
None yet
4 participants