Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jass
Manage
Activity
Members
Labels
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Statistical-Genetics
jass
Commits
9656e5de
Commit
9656e5de
authored
2 months ago
by
Véronique LEGRAND
Browse files
Options
Downloads
Patches
Plain Diff
changed test_global_plot to used pillow and numpy for image comparison
parent
46ad7c44
No related branches found
No related tags found
2 merge requests
!108
Fixing py 3.12
,
!107
Draft: changed the loading of data required to draw the global plot; now read only 3...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jass/test/test_plots.py
+19
-8
19 additions, 8 deletions
jass/test/test_plots.py
with
19 additions
and
8 deletions
jass/test/test_plots.py
+
19
−
8
View file @
9656e5de
...
...
@@ -3,8 +3,10 @@
from
__future__
import
absolute_import
import
os
,
shutil
,
tempfile
from
pathlib
import
Path
import
matplotlib
as
plt
from
jass.models
import
plots
from
PIL
import
Image
import
numpy
as
np
from
.
import
JassTestCase
...
...
@@ -13,6 +15,7 @@ class TestPlots(JassTestCase):
test_folder
=
"
data_real
"
expected_res_folder
=
"
expected_graphs
"
#expected_res_folder="baseline_images/test_plot"
def
setUp
(
self
):
# Create a temporary directory
...
...
@@ -26,15 +29,23 @@ class TestPlots(JassTestCase):
pass
def
test_create_global_plot
(
self
):
#import shutil
#print(plt.rcParams)
plots
.
create_global_plot
(
self
.
worktable_hdf_path
,
self
.
test_dir
/
"
global_plot.png
"
)
#plots.create_global_plot(self.worktable_hdf_path, "/Users/vlegrand/tmp/global_plot.png")
fnew
=
open
(
self
.
test_dir
/
"
global_plot.png
"
,
'
rb
'
)
fref
=
open
(
self
.
ref_res_dir
/
"
expected_global_plot.png
"
,
'
rb
'
)
content_new
=
fnew
.
read
()
content_ref
=
fref
.
read
()
assert
(
content_new
==
content_ref
)
fnew
.
close
()
fref
.
close
()
img_new
=
Image
.
open
(
self
.
test_dir
/
"
global_plot.png
"
)
#fnew=open(self.test_dir / "global_plot.png",'rb')
#fref=open(self.ref_res_dir / "expected_global_plot.png",'rb')
img_ref
=
Image
.
open
(
self
.
ref_res_dir
/
"
expected_global_plot.png
"
)
sum_sq_diff
=
np
.
sum
((
np
.
asarray
(
img_new
).
astype
(
'
float
'
)
-
np
.
asarray
(
img_ref
).
astype
(
'
float
'
))
**
2
)
print
(
"
sum_sq_diff=
"
,
sum_sq_diff
)
assert
(
sum_sq_diff
==
0.0
)
#content_new=fnew.read()
#content_ref=fref.read()
shutil
.
copyfile
(
self
.
test_dir
/
"
global_plot.png
"
,
"
/pasteur/gaia/homes/vlegrand/global_plot.png
"
)
#assert(content_new==content_ref)
#fnew.close()
#fref.close()
def
test_create_qq_plot
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment