FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
diffpy.morph/tests/test_morphresolution.py at main · diffpy/diffpy.morph · GitHub
diffpy
diffpy.morph
Repository navigation
Code
Issues
18
(18)
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
diffpy.morph
/
tests
/
test_morphresolution.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (27 loc) · 1.06 KB
Breadcrumbs
diffpy.morph
/
tests
/
test_morphresolution.py
Copy path
File metadata and controls
37 lines (27 loc) · 1.06 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
import
os
import
numpy
import
pytest
from
diffpy
.
morph
.
morphs
.
morphresolution
import
MorphResolutionDamping
# useful variables
thisfile
=
locals
().
get
(
"__file__"
,
"file.py"
)
tests_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
thisfile
))
testdata_dir
=
os
.
path
.
join
(
tests_dir
,
"testdata"
)
class
TestMorphScale
:
@
pytest
.
fixture
def
setup
(
self
):
morph_file
=
os
.
path
.
join
(
testdata_dir
,
"ni_qmax25.cgr"
)
self
.
x_morph
,
self
.
y_morph
=
numpy
.
loadtxt
(
morph_file
,
unpack
=
True
)
target_file
=
os
.
path
.
join
(
testdata_dir
,
"ni_qmax25_qdamp0.01.cgr"
)
self
.
x_target
,
self
.
y_target
=
numpy
.
loadtxt
(
target_file
,
unpack
=
True
)
return
def
test_morph
(
self
,
setup
):
"""Check MorphScale.morph()"""
config
=
{
"qdamp"
:
0.01
}
morph
=
MorphResolutionDamping
(
config
)
x_morph
,
y_morph
,
x_target
,
y_target
=
morph
(
self
.
x_morph
,
self
.
y_morph
,
self
.
x_target
,
self
.
y_target
)
assert
numpy
.
allclose
(
self
.
y_target
,
y_target
)
assert
numpy
.
allclose
(
y_morph
,
y_target
)
return
Back
|
FazBrowse Home
|
New Git URL