Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Caillat Michel
yafits
Commits
9ce59720
Commit
9ce59720
authored
Nov 18, 2019
by
Caillat Michel
Browse files
Keep trying to fix the contour measurements problems
parent
ef7a8b4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
yafitss/DataBlock.py
View file @
9ce59720
...
...
@@ -1123,7 +1123,8 @@ class DataBlock:
# Produce the contours.
features
=
[]
fig
,
ax
=
pp
.
subplots
()
CS
=
ax
.
contour
(
np
.
arange
(
slice
.
shape
[
1
]),
np
.
arange
(
slice
.
shape
[
0
]),
slice
,
levels
)
#CS = ax.contour(np.arange(slice.shape[1]), np.arange(slice.shape[0]), slice, levels)
CS
=
ax
.
contour
(
slice
,
levels
)
for
level
,
set
in
zip
(
CS
.
levels
,
CS
.
allsegs
):
...
...
@@ -1152,16 +1153,14 @@ class DataBlock:
if
theMask
[
j
][
i
]
:
numpix
+=
1
self
.
__logger
.
debug
(
"numpix = %d"
%
numpix
)
result
=
{}
result
[
"sum"
]
=
np
.
nansum
(
slice
[
theMask
]).
item
()
result
[
"min"
]
=
np
.
nanmin
(
slice
[
theMask
]).
item
()
result
[
"max"
]
=
np
.
nanmax
(
slice
[
theMask
]).
item
()
result
[
"mean"
]
=
np
.
nanmean
(
slice
[
theMask
]).
item
()
result
[
"var"
]
=
np
.
nanvar
(
slice
[
theMask
]).
item
()
result
[
"sum"
]
=
"%11.4g"
%
(
np
.
nansum
(
slice
[
theMask
]).
item
()
/
self
.
__convert
*
self
.
__cdelt
);
result
[
"min"
]
=
"%11.4g"
%
(
np
.
nanmin
(
slice
[
theMask
]).
item
()
)
result
[
"max"
]
=
"%11.4g"
%
(
np
.
nanmax
(
slice
[
theMask
]).
item
()
)
result
[
"mean"
]
=
"%11.4g"
%
(
np
.
nanmean
(
slice
[
theMask
]).
item
()
)
result
[
"var"
]
=
"%11.4g"
%
(
np
.
nanvar
(
slice
[
theMask
]).
item
()
)
result
[
"numpix"
]
=
numpix
result
[
"percent"
]
=
numpix
/
(
shape
[
0
]
*
shape
[
1
])
*
100
result
[
"percent"
]
=
"%9.2g"
%
(
numpix
/
(
shape
[
0
]
*
shape
[
1
])
*
100
)
result
[
"boundingRect"
]
=
cv2
.
boundingRect
(
contour
)
result
=
{
"status"
:
True
,
"message"
:
""
,
"result"
:
result
}
...
...
Write
Preview
Supports
Markdown
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