Commit bdb24bd1 authored by payno's avatar payno

[refactoring] create the io module

parent 570c955e
......@@ -276,7 +276,7 @@
"metadata": {},
"outputs": [],
"source": [
"from xas.core.process.io import read_pymca_xas\n",
"from xas.io import read_pymca_xas\n",
"from silx.io.url import DataUrl\n",
"spec_url = DataUrl(file_path=data_file, scheme='PyMca')\n",
"print(spec_url.scheme())\n",
......@@ -380,10 +380,10 @@
"import xas.core.process.k_weight\n",
"import xas.core.process.exafs\n",
"import xas.core.process.ft\n",
"import xas.core.process.io\n",
"import xas.io\n",
"\n",
"\n",
"read_task = Node(callback=xas.core.process.io.read_pymca_xas)\n",
"read_task = Node(callback=xas.io.read_pymca_xas)\n",
"normalization_task = Node(callback=xas.core.process.normalization.pymca_normalization)\n",
"k_weight_task = Node(callback=xas.core.process.k_weight.pymca_k_weight)\n",
"exafs_task = Node(callback=xas.core.process.exafs.pymca_exafs)\n",
......
......@@ -37,7 +37,7 @@ from silx.io.url import DataUrl
import h5py
import os
import logging
import xas.core.process.io
import xas.io
_logger = logging.getLogger(__file__)
......@@ -60,7 +60,7 @@ class XASInputOW(OWWidget):
_input_file_setting = Setting(str())
process_function = xas.core.process.io.read_pymca_xas
process_function = xas.io.read_pymca_xas
def __init__(self):
super().__init__()
......@@ -134,15 +134,14 @@ class XASInputOW(OWWidget):
def _interpreteInput(self, file_path):
if file_path.endswith('.dat'):
return xas.core.process.io.read_pymca_xas(DataUrl(file_path=self._input_file_setting,
scheme='PyMca'))
return xas.io.read_pymca_xas(DataUrl(file_path=self._input_file_setting,
scheme='PyMca'))
elif h5py.is_hdf5(file_path):
return xas.core.process.io.read_pymca_xas(
spectrum_url=DataUrl(file_path=file_path,
scheme='PyMca',
data_path='spectrum'),
config_url=DataUrl(file_path=file_path,
scheme='silx',
data_path='configuration'))
return xas.io.read_pymca_xas(spectrum_url=DataUrl(file_path=file_path,
scheme='PyMca',
data_path='spectrum'),
config_url=DataUrl(file_path=file_path,
scheme='silx',
data_path='configuration'))
else:
raise ValueError('file type not managed, unable to load')
......@@ -34,7 +34,7 @@ from silx.gui import qt
from Orange.widgets.settings import Setting
from xas.core.types import XASBase
from xas.core.types import XASFactory
import xas.core.process.io
import xas.io
import logging
_logger = logging.getLogger(__file__)
......@@ -57,7 +57,7 @@ class XASOutputOW(OWWidget):
inputs = [("spectrum", XASBase, 'process')]
_output_file_setting = Setting(str())
process_function = xas.core.process.io.Writer_pymca_cas
process_function = xas.io.Writer_pymca_cas
def __init__(self):
super().__init__()
......
......@@ -28,7 +28,7 @@ __date__ = "06/11/2019"
import unittest
from xas.core.process.io import read_pymca_xas
from xas.io import read_pymca_xas
from silx.io.url import DataUrl
from PyMca5.PyMcaDataDir import PYMCA_DATA_DIR
from xas.core.types import PyMcaXAS, XASFactory
......
......@@ -33,7 +33,7 @@ from PyMca5.PyMcaDataDir import PYMCA_DATA_DIR
from silx.io.url import DataUrl
from xas.core.process.exafs import pymca_exafs, PyMca_exafs
from xas.core.process.ft import pymca_ft, PyMca_ft
from xas.core.process.io import read_pymca_xas
from xas.io import read_pymca_xas
from xas.core.process.k_weight import pymca_k_weight, PyMca_k_weight
from xas.core.process.normalization import pymca_normalization, PyMca_normalization
......
from .io import *
......@@ -32,13 +32,12 @@ from PyMca5.PyMcaDataDir import PYMCA_DATA_DIR
from xas.pushworkflow.scheme.node import Node
from xas.pushworkflow.scheme.link import Link
from xas.pushworkflow.scheme.scheme import Scheme
from xas.core.process.io import read_pymca_xas
from xas.app.process import exec_ as exec_workflow
import xas.core.process.normalization
import xas.core.process.k_weight
import xas.core.process.exafs
import xas.core.process.ft
import xas.core.process.io
import xas.io
import os
......@@ -47,7 +46,7 @@ class TestWorkflowFunctions(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
read_task = Node(callback=xas.core.process.io.read_pymca_xas)
read_task = Node(callback=xas.io.read_pymca_xas)
normalization_task = Node(
callback=xas.core.process.normalization.pymca_normalization)
k_weight_task = Node(callback=xas.core.process.k_weight.pymca_k_weight)
......@@ -84,7 +83,7 @@ class TestWorkflowCallableClasses(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
read_task = Node(callback=xas.core.process.io.read_pymca_xas)
read_task = Node(callback=xas.io.read_pymca_xas)
normalization_task = Node(
callback=xas.core.process.normalization.PyMca_normalization)
k_weight_task = Node(callback=xas.core.process.k_weight.PyMca_k_weight)
......
......@@ -36,6 +36,7 @@ def configuration(parent_package='', top_path=None):
config.add_subpackage('app')
config.add_subpackage('core')
config.add_subpackage('gui')
config.add_subpackage('io')
config.add_subpackage('pushworkflow')
config.add_subpackage('pushworkflowactors')
config.add_subpackage('resources')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment