Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
est
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
workflow
est
Commits
4fffba11
Commit
4fffba11
authored
Jul 03, 2019
by
payno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[core] remove the XASFactory
Conflicts: xas/core/types.py
parent
3580eb17
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
xas/core/test/test_types.py
xas/core/test/test_types.py
+3
-3
xas/core/types.py
xas/core/types.py
+6
-0
xas/io/io.py
xas/io/io.py
+1
-1
No files found.
xas/core/test/test_types.py
View file @
4fffba11
...
...
@@ -30,7 +30,7 @@ __date__ = "06/26/2019"
import
numpy
import
os
import
unittest
from
xas.core.types
import
Spectrum
,
XAS
Factory
,
XAS
Object
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
=
XAS
Factory
.
from_dict
(
ddict
)
obj2
=
XAS
Object
.
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
=
XAS
Factory
.
from_dict
(
ddict
)
obj2
=
XAS
Object
.
from_dict
(
ddict
)
self
.
assertEqual
(
self
.
xas_obj
.
n_spectrum
,
obj2
.
n_spectrum
)
self
.
assertEqual
(
obj2
,
self
.
xas_obj
)
...
...
xas/core/types.py
View file @
4fffba11
...
...
@@ -168,11 +168,15 @@ class XASObject(object):
return
self
<<<<<<<
HEAD
<<<<<<<
HEAD
=======
=======
>>>>>>>
5
b3e965
...
[
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):
>>>>>>>
854819
f
...
fix
b81fd6b08587923138a5156441340508914830ac
=======
>>>>>>>
5
b3e965
...
[
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
)
...
...
xas/io/io.py
View file @
4fffba11
...
...
@@ -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__
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment