xcpy: Interfacing with external scripts from Topspin#103
Merged
Conversation
Owner
|
@kaustubhmote This is really neat. I don't know they best location for this file in nmrglue but for the time being nmrglue/util seems fine. |
Collaborator
Author
|
Thanks! I actually thought I will have time for a couple of additions to improve the usability a bit before this is merged. I'll open a separate PR for that then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bruker-Topspin now being freely available under an academic licence, this is a feature request that comes up often for me, and has popped up on the
nmrglue-discussgroup as well. The filexcpy.py, which is included in thenmrglue/utilfolder, will allow the use of nmrglue (and any other cpython script) from within Topspin. It is a lightly polished version of what has been sitting in one of my repositories for sometime now, and takes some suggestions from the nmrglue-discuss thread. This should go nicely with the ability of nmrglue to read and write (#85, #88) bruker datasets, and also with the philosophy of nmrglue of being the 'glue'. I am including a simple "Hello World" script as well (xcpy_test.py), but some real world examples can be found here.The documentation on how to use this file are given in the file docstring itself. The TLDR version is:
Copy or symlink
xcpy.pyto the<topspin>/exp/stan/nmr/py/userdirectory, where is the directory where your topspin is located. If you now typexcpyorxcpy -hfrom within Topspin, the documentation should pop up and is hopefully self-explanatory regarding the various options and initial set up.A simple GIF on how this should look like:
This approach is, of course, not restricted to
nmrglue; other programs likenmrpipe,matnmr, etc can all be accessed from within Topspin in a similar fashion (xcpy uses thesubprocessmodule of the internal Jython to call an external script). I am inclined to start with just this, and see whether any bugs pop up before including other things in there. Currently, this is tested with Linux and Windows, and Topspin 3.6 and 4.0.