Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Reading Sparky .save files#118

Merged
jjhelmus merged 5 commits into
jjhelmus:masterfrom
kaustubhmote:sparkysave
Mar 27, 2020
Merged

Reading Sparky .save files#118
jjhelmus merged 5 commits into
jjhelmus:masterfrom
kaustubhmote:sparkysave

Conversation

@kaustubhmote
Copy link
Copy Markdown
Collaborator

This PR adds to nmrglue the ability to read in .save files from Sparky. This reads in all annotations, annotation locations, labels, peak integrals, peak heights, and everything else associated with analysing data in Sparky. This is accessible by a single function ng.sparky.read_savefile(savefile, spectrum_file), which uses a custom parser (ng.sparky.SparkySaveParser) to parse the .save file.

Apart from giving access to all the peak analysis done in Sparky, a particularly nice use for this would be to automatically make "publication-ready" figures with peak annotations in matplotlib. A script to do so is included at examples/plotting/plot_sparky_savefile/plot_sparky.py, and it directly gives figures that (can) look like this:

bmrb_6209

Plus, this way you have the whole power of matplotlib to make additional subplots, annotations etc!
This PR does not change any of the current behaviour of nmrglue.

@kfritzsc
Copy link
Copy Markdown
Contributor

This is excellent @kaustubhmote!

I have wanted to do this for CCPN2 files for a while, but have not found the time.

In the future it might be helpful to come back and abstract out some of these ideas: for example both the Sparky and CCPN modules could share a common PeakAnnotation object.

@kaustubhmote
Copy link
Copy Markdown
Collaborator Author

That sounds great! Right now I am just looping over the dictionary to put in the annotations, but a PeakAnnotation object that's able to read in this dictionary or anything else from CCPN, pipe or any other format would be really useful. Then you can control peak size, label format and so many other things.

A thought along this line: more often than not, I seem to be using nmrglue for getting data to matplotlib for making the final figure (rather than actual processing, mostly because linear prediction is an issue). If that is a common use case, perhaps matplotlib can be added as a dependency and such plots can be made easy (without the boilerplate)...

@jjhelmus
Copy link
Copy Markdown
Owner

This looks great, merging.

@kaustubhmote You have made a number of contribution to nmrglue, would you be interested in being added as a owner to this repository so that you can help review and merge pull-requests?

@jjhelmus jjhelmus merged commit 2a6cb1f into jjhelmus:master Mar 27, 2020
@kaustubhmote
Copy link
Copy Markdown
Collaborator Author

@jjhelmus For sure! This is a library that I use practically everyday, so I would love to see it grow, and I will be glad to help in any way I can.

@kaustubhmote kaustubhmote deleted the sparkysave branch March 28, 2020 14:02
@jjhelmus
Copy link
Copy Markdown
Owner

@kaustubhmote I've added you as a collaborator to nmrglue. You should be able to review and merge PRs now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants