Commit 4fffba11 authored by payno's avatar payno

[core] remove the XASFactory

Conflicts:
	xas/core/types.py
parent 3580eb17
......@@ -30,7 +30,7 @@ __date__ = "06/26/2019"
import numpy
import os
import unittest
from xas.core.types import Spectrum, XASFactory, XASObject
from xas.core.types import Spectrum, XASObject
from xas.core.utils.pymca import read_spectrum
from xas.io import read_pymca_xas
from PyMca5.PyMcaDataDir import PYMCA_DATA_DIR
......@@ -75,7 +75,7 @@ class TestXASObject(unittest.TestCase):
dim2=1)
self.assertEqual(obj.n_spectrum, 1)
ddict = obj.to_dict()
obj2 = XASFactory.from_dict(ddict)
obj2 = XASObject.from_dict(ddict)
self.assertEqual(obj2, obj)
def test_create_from_several_spectrums(self):
......@@ -96,7 +96,7 @@ class TestXASObject(unittest.TestCase):
data_path='/data/NXdata/data',
scheme='silx'))
numpy.testing.assert_array_equal(original_spectra, ddict['spectra'])
obj2 = XASFactory.from_dict(ddict)
obj2 = XASObject.from_dict(ddict)
self.assertEqual(self.xas_obj.n_spectrum, obj2.n_spectrum)
self.assertEqual(obj2, self.xas_obj)
......
......@@ -168,11 +168,15 @@ class XASObject(object):
return self
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> 5b3e965... [core] remove the XASFactory
@staticmethod
def from_dict(ddict):
return XASObject().load_frm_dict(ddict=ddict)
<<<<<<< HEAD
@staticmethod
def from_file(h5_file):
ddict = h5todict(h5file=h5_file)
......@@ -180,6 +184,8 @@ class XASObject(object):
>>>>>>> 854819f... fix b81fd6b08587923138a5156441340508914830ac
=======
>>>>>>> 5b3e965... [core] remove the XASFactory
def dump(self, h5_file):
"""dump the XAS object to a file_path"""
dicttoh5(treedict=self.to_dict(), h5file=h5_file)
......
......@@ -32,7 +32,7 @@ import h5py
from silx.io import utils
from silx.io.url import DataUrl
from xas.core.utils.pymca import read_spectrum
from xas.core.types import XASObject, XASFactory
from xas.core.types import XASObject
_logger = logging.getLogger(__name__)
......
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