cleanup build scripts
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
include src/gui/DAMARIS.png
|
include src/gui/DAMARIS3.png
|
||||||
include src/gui/DAMARIS.ico
|
include src/gui/DAMARIS3.ico
|
||||||
include src/gui/damaris.glade
|
include src/gui/damaris.glade
|
||||||
include src/gui/damaris.gladep
|
include src/gui/damaris.gladep
|
||||||
include doc/index.html
|
include doc/index.html
|
||||||
|
|||||||
Vendored
+1
-1
@@ -2,7 +2,7 @@ Source: python3-damaris
|
|||||||
Section: science
|
Section: science
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Markus Rosenstihl <markus.rosenstihl@pkm.tu-darmstadt.de>
|
Maintainer: Markus Rosenstihl <markus.rosenstihl@pkm.tu-darmstadt.de>
|
||||||
Build-Depends: python3, debhelper, python3-dev, dh-sequence-python3, dpkg-dev
|
Build-Depends: python3, debhelper, python3-dev, dh-sequence-python3, dpkg-dev, pybuild-plugin-pyproject
|
||||||
Standards-Version: 3.7.3
|
Standards-Version: 3.7.3
|
||||||
X-Python3-Version: >= 3.5
|
X-Python3-Version: >= 3.5
|
||||||
Rules-Requires-Root: no
|
Rules-Requires-Root: no
|
||||||
|
|||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
python3-damaris_0.19_all.deb science optional
|
||||||
|
python3-damaris_0.19_amd64.buildinfo science optional
|
||||||
Vendored
+4
-1
@@ -10,7 +10,10 @@ PACKAGE_NAME=python3-damaris
|
|||||||
PYBUILD_NAME=python3-damaris
|
PYBUILD_NAME=python3-damaris
|
||||||
MODULE_NAME=damaris3
|
MODULE_NAME=damaris3
|
||||||
PYBASE=$(CURDIR)/debian/${PACKAGE_NAME}
|
PYBASE=$(CURDIR)/debian/${PACKAGE_NAME}
|
||||||
DH_ALWAYS_EXCLUDE=CVS:.git:venv
|
DH_ALWAYS_EXCLUDE=CVS:.git:venv:.venv:*.h5
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --buildsystem=pybuild
|
dh $@ --buildsystem=pybuild
|
||||||
|
|
||||||
|
override_dh_auto_test:
|
||||||
|
PYBUILD_TEST_ARGS="-v $(CURDIR)/tests" dh_auto_test
|
||||||
|
|||||||
+48
-8
@@ -1,23 +1,63 @@
|
|||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools"]
|
requires = [
|
||||||
|
"setuptools>=61.0", # provides the "setuptools.build_meta" backend
|
||||||
|
"wheel" # needed for the wheel building step
|
||||||
|
]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
requires-python = ">= 3.9"
|
requires-python = ">= 3.9"
|
||||||
name = "python3-damaris"
|
name = "python3-damaris"
|
||||||
dynamic = ["version",
|
version = "0.19"
|
||||||
"dependencies",
|
description = "Python version 3 frontend for DAMARIS (DArmstadt MAgnetic Resonance Instrument Software)"
|
||||||
"classifiers",
|
license = "GPL-2.0"
|
||||||
"keywords",
|
keywords = ["NMR", "data-processing"]
|
||||||
"license",
|
readme = {file = "README", content-type = "text/plain"}
|
||||||
"readme",
|
dependencies = [
|
||||||
|
"scipy >= 0.14.0",
|
||||||
|
"numpy >= 1.8.2, < 2.0",
|
||||||
|
"tables >= 3.1.1",
|
||||||
|
"matplotlib >= 1.4.1, <= 3.6",
|
||||||
|
"pyxdg",
|
||||||
|
"PyGObject >= 3.14.0, <= 3.51.0"
|
||||||
]
|
]
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Achim Gädke"},
|
{name = "Achim Gädke"},
|
||||||
{name = "Christopher Schmitt"},
|
{name = "Christopher Schmitt"},
|
||||||
{name = "Christian Tacke"},
|
{name = "Christian Tacke"},
|
||||||
{name = "Markus Rosenstihl", email = "markus.rosenstihl@pkm.tu-darmstadt.de"},
|
{name = "Joachim Beerwerth"},
|
||||||
|
{name = "Markus Rosenstihl", email = "markus.rosenstihl@pkm.tu-darmstadt.de"}
|
||||||
]
|
]
|
||||||
maintainers = [
|
maintainers = [
|
||||||
{name = "Markus Rosenstihl", email = "markus.rosenstihl@pkm.tu-darmstadt.de"}
|
{name = "Markus Rosenstihl", email = "markus.rosenstihl@pkm.tu-darmstadt.de"}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
DAMARIS3 = "damaris.__main__:main"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.setuptools]
|
||||||
|
packages = [
|
||||||
|
"damaris",
|
||||||
|
"damaris.data",
|
||||||
|
"damaris.experiments",
|
||||||
|
"damaris.gui",
|
||||||
|
"damaris.tools"
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.setuptools.package-dir]
|
||||||
|
"damaris" = "src"
|
||||||
|
"damaris.data" = "src/data"
|
||||||
|
"damaris.experiments" = "src/experiments"
|
||||||
|
"damaris.gui" = "src/gui"
|
||||||
|
"damaris.tools" = "src/tools"
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
"damaris.gui" = ["DAMARIS3.png", "DAMARIS3.ico", "damaris.xml", "python.xml"]
|
||||||
|
|
||||||
|
[tool.setuptools.data-files]
|
||||||
|
"share/python3-damaris/images" = ["src/gui/DAMARIS3.png", "src/gui/DAMARIS3.ico"]
|
||||||
|
"share/python3-damaris/doc" = ["doc/index.html"]
|
||||||
|
"share/python3-damaris/doc/reference-html" = ["doc/reference-html/*"]
|
||||||
|
"share/python3-damaris/doc/tutorial-html" = ["doc/tutorial-html/*"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = python3-damaris
|
|
||||||
version = 0.18.0
|
|
||||||
author = Achim Gädke, Christian, Tacke, Joachim Berwerth, Christopher Schmitt, Markus Rosenstihl
|
|
||||||
author_email = markus.rosenstihl@þkm.tu-darmstadt.de
|
|
||||||
url = https://gitea.pkm.physik.tu-darmstadt.de/IPKM/python3-damaris
|
|
||||||
description = DArmstadt MAgnetic Resonance Instrumentation Software
|
|
||||||
long_description = file: README.md
|
|
||||||
long_description_content_type = text/markdown
|
|
||||||
keywords = science, instrumentation
|
|
||||||
license = BSD 3-Clause License
|
|
||||||
classifiers =
|
|
||||||
License :: OSI Approved :: BSD License
|
|
||||||
Programming Language :: Python :: 3
|
|
||||||
|
|
||||||
[options]
|
|
||||||
packages = find:
|
|
||||||
zip_safe = True
|
|
||||||
include_package_data = True
|
|
||||||
install_requires =
|
|
||||||
scipy >= 0.14.0
|
|
||||||
numpy (>= 1.8.2 , < 2.0)
|
|
||||||
tables >= 3.1.1
|
|
||||||
matplotlib (>= 1.4.1, <= 3.6)
|
|
||||||
pyxdg
|
|
||||||
PyGObject (>= 3.14.0, <= 3.51.0) # girepository2.0-dev not available on bookworm
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import shutil
|
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import sys
|
|
||||||
from distutils.core import setup
|
|
||||||
from distutils.command.build_scripts import build_scripts as _build_scripts
|
|
||||||
from distutils import log
|
|
||||||
from distutils.util import convert_path
|
|
||||||
from distutils.dep_util import newer
|
|
||||||
|
|
||||||
#if sys.version_info < (2, 5, 3):
|
|
||||||
# log.error("**** ERROR: Install manually: python setup.py install ****")
|
|
||||||
# raise ValueError
|
|
||||||
|
|
||||||
class build_damaris_scripts(_build_scripts):
|
|
||||||
|
|
||||||
#user_options=_build_scripts.user_options[:]
|
|
||||||
#user_options.append(('install-dir=', 'd', "directory to install scripts to"))
|
|
||||||
|
|
||||||
def initialize_options (self):
|
|
||||||
_build_scripts.initialize_options(self)
|
|
||||||
self.damaris_dir = None
|
|
||||||
|
|
||||||
def finalize_options (self):
|
|
||||||
_build_scripts.finalize_options(self)
|
|
||||||
self.set_undefined_options('install',
|
|
||||||
('install_lib', 'damaris_dir'))
|
|
||||||
|
|
||||||
def run (self):
|
|
||||||
"change PYTHON_PATH for DAMARIS executable"
|
|
||||||
_build_scripts.run(self)
|
|
||||||
script="scripts/DAMARIS3"
|
|
||||||
script = convert_path(script)
|
|
||||||
outfile = os.path.join(self.build_dir, os.path.basename(script))
|
|
||||||
self.damaris_dir=os.path.normpath(self.damaris_dir)
|
|
||||||
if self.damaris_dir in sys.path:
|
|
||||||
log.debug("not changing %s (this path is on standard path)", script)
|
|
||||||
# nothing to do for us
|
|
||||||
return
|
|
||||||
|
|
||||||
# now change PATH in DAMARIS script
|
|
||||||
# copy backup
|
|
||||||
log.info("adapting DAMARIS script to use local installation")
|
|
||||||
shutil.copyfile(outfile, outfile+".bak")
|
|
||||||
# the file should keep all its attributes (executable...)
|
|
||||||
inf=open(outfile+".bak","r")
|
|
||||||
outf=open(outfile,"w")
|
|
||||||
l=inf.readline()
|
|
||||||
while not l.startswith("import sys") and l!="":
|
|
||||||
outf.write(l)
|
|
||||||
l=inf.readline()
|
|
||||||
|
|
||||||
if l!="":
|
|
||||||
outf.write(l)
|
|
||||||
l=inf.readline()
|
|
||||||
while l.endswith("# inserted by setup.py\n"):
|
|
||||||
l=inf.readline()
|
|
||||||
outf.write("sys.path.insert(0,\"%s\") # inserted by setup.py\n"%self.damaris_dir)
|
|
||||||
outf.write(l)
|
|
||||||
outf.writelines(inf.readlines())
|
|
||||||
inf.close()
|
|
||||||
outf.close()
|
|
||||||
os.remove(outfile+".bak")
|
|
||||||
|
|
||||||
# create doc data file information
|
|
||||||
distribution_doc_prefix=os.path.join("share","python3-damaris","doc")
|
|
||||||
distribution_data_files = [[ "share", []],
|
|
||||||
[os.path.join("share", "python3-damaris", "images"),
|
|
||||||
["src/gui/DAMARIS3.png", "src/gui/DAMARIS3.ico"]],
|
|
||||||
[os.path.join("share", "python3-damaris"), []],
|
|
||||||
[distribution_doc_prefix, ['doc/index.html']]]
|
|
||||||
|
|
||||||
if os.path.isdir(os.path.join("doc","reference-html")):
|
|
||||||
# no subdirs, work can be done in simple way
|
|
||||||
distribution_data_files.append([os.path.join(distribution_doc_prefix, 'reference-html'),
|
|
||||||
[os.path.join('doc', 'reference-html', f)
|
|
||||||
for f in os.listdir(os.path.join('doc', 'reference-html'))]])
|
|
||||||
|
|
||||||
if os.path.isdir(os.path.join("doc","tutorial-html")):
|
|
||||||
# here, modern style file and attachment directories should be handled
|
|
||||||
for d in os.walk(os.path.join("doc","tutorial-html")):
|
|
||||||
distribution_data_files.append([os.path.join(os.path.dirname(distribution_doc_prefix),d[0]),
|
|
||||||
[os.path.join(d[0], f) for f in d[2]]])
|
|
||||||
|
|
||||||
LONG_DESCRIPTION="""
|
|
||||||
DArmstadt MAgnetic Resonance Instrument Software
|
|
||||||
"""
|
|
||||||
|
|
||||||
GPL_LICENCE = "feed licence here"
|
|
||||||
|
|
||||||
setup (
|
|
||||||
name = 'python3-damaris',
|
|
||||||
version = "0.18.2",
|
|
||||||
description = 'python frontend for DAMARIS (DArmstadt MAgnetic Resonance Instrument Software)',
|
|
||||||
long_description = LONG_DESCRIPTION,
|
|
||||||
author = 'Achim Gaedke',
|
|
||||||
author_email = 'Achim.Gaedke@physik.tu-darmstadt.de',
|
|
||||||
maintainer = 'Achim Gaedke',
|
|
||||||
maintainer_email = 'markus.rosenstihl@pkm.tu-darmstadt.de',
|
|
||||||
url = 'http://www.fkp.physik.tu-darmstadt.de/damaris/',
|
|
||||||
license = GPL_LICENCE,
|
|
||||||
platforms = ['Any',],
|
|
||||||
keywords = ['NMR', 'data-processing'],
|
|
||||||
packages = [ 'damaris',
|
|
||||||
'damaris.data',
|
|
||||||
'damaris.experiments',
|
|
||||||
'damaris.gui',
|
|
||||||
'damaris.tools' ],
|
|
||||||
package_dir = { 'damaris': 'src',
|
|
||||||
'damaris.data': 'src/data',
|
|
||||||
'damaris.experiments': 'src/experiments',
|
|
||||||
'damaris.gui': 'src/gui',
|
|
||||||
'damaris.tools': 'src/tools' },
|
|
||||||
package_data = { 'damaris.gui': ['DAMARIS3.png', 'DAMARIS3.ico', 'damaris.xml', 'python.xml']},
|
|
||||||
scripts = ['scripts/DAMARIS3'],
|
|
||||||
cmdclass={"build_scripts": build_damaris_scripts},
|
|
||||||
data_files = distribution_data_files
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
DAMARISi3 command-line interface.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
# for numpy-1.1 and later: check the environment for LANG and LC_NUMERIC
|
||||||
|
# see: http://projects.scipy.org/scipy/numpy/ticket/902
|
||||||
|
if os.environ.get("LANG", "").startswith("de") or os.environ.get("LC_NUMERIC", "").startswith("de"):
|
||||||
|
os.environ["LC_NUMERIC"] = "C"
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Main entry point for DAMARIS."""
|
||||||
|
parser = argparse.ArgumentParser(description='DArmstadt MAgnetic Resonance Instrumentation Software')
|
||||||
|
|
||||||
|
parser.add_argument("--run", action="store_true", help="run DAMARIS immediately with given scripts")
|
||||||
|
parser.add_argument("--clean", action="store_true", help="cleanup DAMARIS run files")
|
||||||
|
parser.add_argument("--debug", action="store_true", help="run DAMARIS with DEBUG flag set")
|
||||||
|
parser.add_argument("--mpl", help="run DAMARIS with matplotlib backend",
|
||||||
|
choices=["GTK3Agg", "GTK3Cairo"], default="GTK3Agg")
|
||||||
|
parser.add_argument("exp_script", help="experiment script", nargs="?", metavar="EXP.py")
|
||||||
|
parser.add_argument("res_script", help="result script", nargs="?", metavar="RES.py")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
import matplotlib
|
||||||
|
if args.mpl:
|
||||||
|
matplotlib.use(args.mpl)
|
||||||
|
|
||||||
|
import damaris.gui.DamarisGUI
|
||||||
|
|
||||||
|
lockfile = os.path.expanduser('~/.damaris.lockdb')
|
||||||
|
if args.clean:
|
||||||
|
if os.path.exists(lockfile):
|
||||||
|
print("Removing lockfile: %s" % lockfile)
|
||||||
|
os.remove(lockfile)
|
||||||
|
else:
|
||||||
|
print("Lockfile does not exists: %s" % lockfile)
|
||||||
|
lockdb = sqlite3.connect(lockfile)
|
||||||
|
|
||||||
|
c = lockdb.cursor()
|
||||||
|
c.execute("CREATE TABLE IF NOT EXISTS damaris (uuid text, status text)")
|
||||||
|
lockdb.commit()
|
||||||
|
|
||||||
|
if args.debug:
|
||||||
|
damaris.gui.DamarisGUI.debug = True
|
||||||
|
print("debug flag set")
|
||||||
|
try:
|
||||||
|
import resource
|
||||||
|
resource.setrlimit(resource.RLIMIT_CORE, (-1, -1))
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
print(args)
|
||||||
|
d = damaris.gui.DamarisGUI.DamarisGUI(args.exp_script, args.res_script, start_immediately=args.run)
|
||||||
|
d.run()
|
||||||
|
|
||||||
|
sys.stdout = sys.__stdout__
|
||||||
|
sys.stderr = sys.__stderr__
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -56,7 +56,7 @@ class goniometer:
|
|||||||
|
|
||||||
def _recv(self):
|
def _recv(self):
|
||||||
retstr = self.serial.readline().strip().replace("\x00","")
|
retstr = self.serial.readline().strip().replace("\x00","")
|
||||||
search_result = re.search("<(\d+)>", retstr)
|
search_result = re.search(r"<(\d+)>", retstr)
|
||||||
if search_result != None:
|
if search_result != None:
|
||||||
angle = float(search_result.group(1))/36.0
|
angle = float(search_result.group(1))/36.0
|
||||||
self.current_angle = angle
|
self.current_angle = angle
|
||||||
|
|||||||
+6
-2
@@ -1,11 +1,15 @@
|
|||||||
def test():
|
import time
|
||||||
|
|
||||||
|
def test(i):
|
||||||
e=Experiment()
|
e=Experiment()
|
||||||
e.ttl_pulse(length=1e-6, value=1)
|
e.ttl_pulse(length=1e-6, value=1)
|
||||||
e.wait(1e-3)
|
e.wait(1e-3)
|
||||||
e.ttl_pulse(length=1e-6,value=1)
|
e.ttl_pulse(length=1e-6,value=1)
|
||||||
e.record(samples=1024,frequency=1e6,sensitivity=1)
|
e.record(samples=1024,frequency=1e6,sensitivity=1)
|
||||||
|
e.set_description("variable",i)
|
||||||
|
e.set_description("const", "test")
|
||||||
return e
|
return e
|
||||||
|
|
||||||
def experiment():
|
def experiment():
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
yield test()
|
yield test(i)
|
||||||
+18
-2
@@ -1,8 +1,24 @@
|
|||||||
|
import tables
|
||||||
|
|
||||||
|
r = MeasurementResult("test")
|
||||||
|
|
||||||
def result():
|
def result():
|
||||||
|
try:
|
||||||
|
h5 = tables.open_file("test.h5", "w")
|
||||||
|
except:
|
||||||
|
print("h5 already opened")
|
||||||
accu = Accumulation(error=False)
|
accu = Accumulation(error=False)
|
||||||
for num,ts in enumerate(results):
|
for num,ts in enumerate(results):
|
||||||
data["accu"] = accu
|
data["accu"] = accu
|
||||||
data["ts %i"%num] = ts+0
|
data["data/ts %i"%num] = ts+0
|
||||||
|
ts.write_to_hdf(h5, "/", f"adc_{num}", f"adc_{num}")
|
||||||
data["fft"] = (ts+0).fft()
|
data["fft"] = (ts+0).fft()
|
||||||
|
r[num] = ts.y[0][0]
|
||||||
|
data["test"] = r
|
||||||
accu+=ts
|
accu+=ts
|
||||||
print("ts")
|
accu.write_to_hdf(h5, "/", "name", "title")
|
||||||
|
print(accu)
|
||||||
|
try:
|
||||||
|
h5.close()
|
||||||
|
except:
|
||||||
|
print("h5 already closed")
|
||||||
@@ -4,7 +4,7 @@ import unittest
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from src.data.ADC_Result import ADC_Result
|
from damaris.data.ADC_Result import ADC_Result
|
||||||
|
|
||||||
|
|
||||||
class TestADCResult(unittest.TestCase):
|
class TestADCResult(unittest.TestCase):
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ from datetime import datetime
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from src.data.ADC_Result import ADC_Result
|
from damaris.data.ADC_Result import ADC_Result
|
||||||
from src.data.Accumulation import Accumulation
|
from damaris.data.Accumulation import Accumulation
|
||||||
|
|
||||||
|
|
||||||
class TestAccumulation(unittest.TestCase):
|
class TestAccumulation(unittest.TestCase):
|
||||||
|
|||||||
Reference in New Issue
Block a user