FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
diffpy.morph/tests/test_morphscale.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_morphscale.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (27 loc) · 989 Bytes
Breadcrumbs
diffpy.morph
/
tests
/
test_morphscale.py
Copy path
File metadata and controls
37 lines (27 loc) · 989 Bytes
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
.
morphscale
import
MorphScale
# 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
):
self
.
x_morph
=
numpy
.
arange
(
0.01
,
5
,
0.01
)
self
.
y_morph
=
numpy
.
ones_like
(
self
.
x_morph
)
self
.
x_target
=
numpy
.
arange
(
0.01
,
5
,
0.01
)
self
.
y_target
=
3
*
numpy
.
ones_like
(
self
.
x_target
)
return
def
test_morph
(
self
,
setup
):
"""Check MorphScale.morph()"""
config
=
{
"scale"
:
2.0
}
morph
=
MorphScale
(
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
(
2
*
self
.
y_morph
,
y_morph
)
assert
numpy
.
allclose
(
self
.
y_target
,
y_target
)
return
Back
|
FazBrowse Home
|
New Git URL