[xmds2] 01/01: Add patch for creating R files in xsil2graphics2
Rafael Laboissière
rlaboiss-guest at moszumanska.debian.org
Sat Jan 4 14:37:47 UTC 2014
This is an automated email from the git hooks/post-receive script.
rlaboiss-guest pushed a commit to branch r-import
in repository xmds2.
commit f4a54b1afea9938324768f6527ee4fe3c5920035
Author: Rafael Laboissiere <rafael at laboissiere.net>
Date: Sat Jan 4 15:33:44 2014 +0100
Add patch for creating R files in xsil2graphics2
---
debian/patches/r-import.patch | 108 ++++++++++++++++++++++++++++++++++++++++++
debian/patches/series | 2 +
2 files changed, 110 insertions(+)
diff --git a/debian/patches/r-import.patch b/debian/patches/r-import.patch
new file mode 100644
index 0000000..5990890
--- /dev/null
+++ b/debian/patches/r-import.patch
@@ -0,0 +1,108 @@
+Description: Add an exporter for the R language to xsil2graphics2
+Author: Rafael Laboissiere <rafael at laboissiere.net>
+Last-Update: 2014-01-04
+
+--- /dev/null
++++ xmds2-2.1.4/xpdeint/xsil2graphics2/RImport.tmpl
+@@ -0,0 +1,66 @@
++@*
++RImport.tmpl
++
++Created by Rafael Laboissiere on 2013-01-04.
++
++Based on MatlabOctaveImport.tmpl, which was:
++
++Created by Joe Hope on 2009-01-07.
++Modified by Gregory Bogomiagkov and Liam Madge on 2013-07-18.
++
++Copyright (c) 2009-2013, Joe Hope and Graham Dennis
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program. If not, see <http://www.gnu.org/licenses/>.
++
++*@
++
++ at def description: Creates text to import data from XSIL files into R.
++
++ at attr $defaultExtension = 'r'
++ at attr $stringFormat = '.12e'
++ at attr $name = 'R'
++
++ at def generateVariableName(xsilVariable, xsilObjectNumber)
++ @return c'${xsilVariable.name}_${xsilObjectNumber+1}'
++ at end def
++
++ at def loadXSILFile($xsilFile)
++ @for objectNum, xsilObject in enumerate(xsilFile.xsilObjects):
++ @if xsilObject.data.format == 'hdf5'
++${handleHDF5XSILObject(objectNum, xsilObject)}@slurp
++ @else
++ @raise Exception("No support for R output for XSIL format '%s'." % xsilObject.data.format)
++ @end if
++ @end for
++ at end def
++
++
++ at def handleHDF5XSILObject(objectNum, xsilObject)
++tryCatch (library (hdf5),
++ error = function (e) {
++ message (e)
++ message ("Install the hdf5 library for loading XSIL data")
++ return (NA)
++ })
++
++ @set $filename = xsilObject.data.filename
++hdf5load ("${filename}")
++ @for var in xsilObject.independentVariables:
++${var.name}.${objectNum+1} <- get ("${objectNum+1}")\$${var.name}
++ @end for
++ @for var in xsilObject.dependentVariables:
++${var.name}.${objectNum+1} <- get ("${objectNum+1}")\$${var.name}
++ @end for
++rm ("${objectNum+1}")
++ at end def
+--- a/xpdeint/xsil2graphicsParser.py
++++ b/xpdeint/xsil2graphicsParser.py
+@@ -39,6 +39,7 @@ if sys.platform == 'darwin':
+ from xpdeint.xsil2graphics2.MathematicaImport import MathematicaImport
+ from xpdeint.xsil2graphics2.MatlabOctaveImport import MatlabOctaveImport
+ from xpdeint.xsil2graphics2.PythonImport import PythonImport
++from xpdeint.xsil2graphics2.RImport import RImport
+
+
+ # The help message printed when --help is used as an argument
+@@ -57,6 +58,7 @@ Options:
+ -e/--mathematica: optional, produce mathematica output
+ -8/--octave: optional, produce octave output (identical to MATLAB output)
+ -p/--python: optional, produce Python/pylab/matplotlib script (HDF5 requires h5py)
++ -r/--R: optional, produce R output
+ -o/--outfile: optional, alternate output file name (one input file only)
+ --debug: Debug mode
+
+@@ -91,7 +93,7 @@ def main(argv=None):
+ argv = sys.argv
+ try:
+ try:
+- opts, args = getopt.gnu_getopt(argv[1:], "hm8epo:", ["help", "matlab", "octave", "mathematica", "python", "outfile=", "debug"])
++ opts, args = getopt.gnu_getopt(argv[1:], "hm8epro:", ["help", "matlab", "octave", "mathematica", "python", "R", "outfile=", "debug"])
+ except getopt.error, msg:
+ raise Usage(msg)
+
+@@ -104,6 +106,7 @@ def main(argv=None):
+ ("-8", "--octave", MatlabOctaveImport),
+ ("-e", "--mathematica", MathematicaImport),
+ ("-p", "--python", PythonImport),
++ ("-r", "--R", RImport),
+ ]
+
+ # option processing
diff --git a/debian/patches/series b/debian/patches/series
index 7543332..28592b6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,4 @@
interpreter-name-in-shebang.patch
operator-bashism.patch
+
+r-import.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/xmds2.git
More information about the debian-science-commits
mailing list