Loading Makefile +3 −3 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ PROJVER=$(shell $(PYTHON) -c "from pysen.revision import __version__; print(__ve PROJECT=$(PROJNAME)-$(PROJVER) # which module to run through pylint LINTMOD=$(PROJNAME) LINT=$(PROJNAME) all: build Loading @@ -41,13 +41,13 @@ runtest: @PYTHONPATH=. $(PYTHON) -m pytest ./test pylint: @PYTHONPATH=. pylint --rcfile=.pylint.rc $(LINTMOD) @PYTHONPATH=. pylint --rcfile=.pylint.rc $(LINT) clean: clean-docs @-$(PYTHON) setup.py clean distclean: clean @rm -rf build dist MANIFEST cachedir *.egg-info $(PROJECT).tar.gz @rm -rf build dist MANIFEST cachedir *.egg-info $(PROJECT).tar.gz test.log @find . -name '*~' | xargs rm -f @find . -name '*.py[co]' | xargs rm -f @find . -name '__pycache__' | xargs rm -rf Loading pysen/inout/hdf.py +1 −1 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ def convert_to_hdf(filename, outdir, **kwargs): reader = DATA_READER.get(data_type) if reader is None: raise RuntimeError(f"Don't know how to handle {file_type} file") converter.data = reader(filename) converter.data = reader(filename, outdir=outdir) converter.write(outfile, mode=mode, compression=compression) return outfile Loading pysen/inout/reader.py +3 −3 Original line number Diff line number Diff line Loading @@ -457,7 +457,7 @@ def read_echo_data(fdesc, newshape, **kwargs): logging.getLogger().debug('read echo data (maxcount=%d)', np.max(result.get('detector',0))) return result def read_echo(filename): def read_echo(filename, **_kwargs): """ Read echo file """ Loading Loading @@ -719,7 +719,7 @@ def read_xyz_info(fdesc): logging.getLogger().debug('ok') return result def read_xyz(filename): def read_xyz(filename, **_kwargs): "read xyz analysis .xyz file" result = OrderedDict() _log = logging.getLogger() Loading Loading @@ -753,7 +753,7 @@ def read_xyz(filename): result['data'] = data return result def read_magnetic(filename): def read_magnetic(filename, **_kwargs): "read magnetic up/down .dat file" result = OrderedDict() Loading test/test_inout_writer.py +13 −10 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ Python unit test cases for pysen.inout.writer module """ import unittest import os.path import tempfile from pysen.inout import writer Loading @@ -20,19 +21,21 @@ class InoutWriterTestCase(unittest.TestCase): def test_diffraction_writer(self): "test diffraction writer" with tempfile.TemporaryDirectory() as tmpdir: filename = os.path.join(TestDataDir, "NSE_16247.nxs.h5") wrt = writer.DiffractionWriter() self.assertTrue(wrt.read_nexus(filename, npix=32, ntof=42), "read nexus") outfile = wrt.save() self.assertEqual("./diffrun_16247.dat", outfile, "outfile") outfile = wrt.save(outdir=tmpdir) self.assertEqual(os.path.join(tmpdir,"diffrun_16247.dat"), outfile, "outfile") def test_echo_writer(self): "test echo writer" with tempfile.TemporaryDirectory() as tmpdir: filename = os.path.join(TestDataDir, "NSE_15617.nxs.h5") wrt = writer.EchoWriter() self.assertTrue(wrt.read_nexus(filename, npix=32, ntof=42), "read nexus") outfile = wrt.save() self.assertEqual("./s15617.echo", outfile, "outfile") outfile = wrt.save(outdir=tmpdir) self.assertEqual(os.path.join(tmpdir,"s15617.echo"), outfile, "outfile") if __name__ == "__main__": Loading Loading
Makefile +3 −3 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ PROJVER=$(shell $(PYTHON) -c "from pysen.revision import __version__; print(__ve PROJECT=$(PROJNAME)-$(PROJVER) # which module to run through pylint LINTMOD=$(PROJNAME) LINT=$(PROJNAME) all: build Loading @@ -41,13 +41,13 @@ runtest: @PYTHONPATH=. $(PYTHON) -m pytest ./test pylint: @PYTHONPATH=. pylint --rcfile=.pylint.rc $(LINTMOD) @PYTHONPATH=. pylint --rcfile=.pylint.rc $(LINT) clean: clean-docs @-$(PYTHON) setup.py clean distclean: clean @rm -rf build dist MANIFEST cachedir *.egg-info $(PROJECT).tar.gz @rm -rf build dist MANIFEST cachedir *.egg-info $(PROJECT).tar.gz test.log @find . -name '*~' | xargs rm -f @find . -name '*.py[co]' | xargs rm -f @find . -name '__pycache__' | xargs rm -rf Loading
pysen/inout/hdf.py +1 −1 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ def convert_to_hdf(filename, outdir, **kwargs): reader = DATA_READER.get(data_type) if reader is None: raise RuntimeError(f"Don't know how to handle {file_type} file") converter.data = reader(filename) converter.data = reader(filename, outdir=outdir) converter.write(outfile, mode=mode, compression=compression) return outfile Loading
pysen/inout/reader.py +3 −3 Original line number Diff line number Diff line Loading @@ -457,7 +457,7 @@ def read_echo_data(fdesc, newshape, **kwargs): logging.getLogger().debug('read echo data (maxcount=%d)', np.max(result.get('detector',0))) return result def read_echo(filename): def read_echo(filename, **_kwargs): """ Read echo file """ Loading Loading @@ -719,7 +719,7 @@ def read_xyz_info(fdesc): logging.getLogger().debug('ok') return result def read_xyz(filename): def read_xyz(filename, **_kwargs): "read xyz analysis .xyz file" result = OrderedDict() _log = logging.getLogger() Loading Loading @@ -753,7 +753,7 @@ def read_xyz(filename): result['data'] = data return result def read_magnetic(filename): def read_magnetic(filename, **_kwargs): "read magnetic up/down .dat file" result = OrderedDict() Loading
test/test_inout_writer.py +13 −10 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ Python unit test cases for pysen.inout.writer module """ import unittest import os.path import tempfile from pysen.inout import writer Loading @@ -20,19 +21,21 @@ class InoutWriterTestCase(unittest.TestCase): def test_diffraction_writer(self): "test diffraction writer" with tempfile.TemporaryDirectory() as tmpdir: filename = os.path.join(TestDataDir, "NSE_16247.nxs.h5") wrt = writer.DiffractionWriter() self.assertTrue(wrt.read_nexus(filename, npix=32, ntof=42), "read nexus") outfile = wrt.save() self.assertEqual("./diffrun_16247.dat", outfile, "outfile") outfile = wrt.save(outdir=tmpdir) self.assertEqual(os.path.join(tmpdir,"diffrun_16247.dat"), outfile, "outfile") def test_echo_writer(self): "test echo writer" with tempfile.TemporaryDirectory() as tmpdir: filename = os.path.join(TestDataDir, "NSE_15617.nxs.h5") wrt = writer.EchoWriter() self.assertTrue(wrt.read_nexus(filename, npix=32, ntof=42), "read nexus") outfile = wrt.save() self.assertEqual("./s15617.echo", outfile, "outfile") outfile = wrt.save(outdir=tmpdir) self.assertEqual(os.path.join(tmpdir,"s15617.echo"), outfile, "outfile") if __name__ == "__main__": Loading