Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Quack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
commul
Zeit.shift
Quack
Commits
0e61227a
Commit
0e61227a
authored
11 years ago
by
Toke Eskildsen
Browse files
Options
Downloads
Patches
Plain Diff
Resilience against varying identify outputs in histogram()
parent
b640fe1c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
analyze.sh
+10
-4
10 additions, 4 deletions
analyze.sh
with
10 additions
and
4 deletions
analyze.sh
+
10
−
4
View file @
0e61227a
...
...
@@ -107,13 +107,17 @@ function histogram() {
# into
# 0 78085
# 1 3410
GREYS
=
`
cat
"
$IDENTIFY
"
|
grep
-A
9999
" Histogram:"
|
grep
-o
"
\\
+[0-9]
\\
+: ( *[0-9]
\\
+, *[0-9]
\\
+, *[0-9]
\\
+)"
|
sed
's/ \\+\\([0-9]\\+\\): ( *\\([0-9]\\+\\).\\+/\\2 \\1/g'
`
if
[
"."
==
".
`
grep
\"
Colormap:
\"
\"
$IDENTIFY
\"
`
"
]
;
then
GREYS
=
`
cat
"
$IDENTIFY
"
|
grep
-A
256
" Histogram:"
|
grep
-o
"
\\
+[0-9]
\\
+: ( *[0-9]
\\
+, *[0-9]
\\
+, *[0-9]
\\
+)"
|
sed
's/ \\+\\([0-9]\\+\\): ( *\\([0-9]\\+\\).\\+/\\2 \\1/g'
`
else
GREYS
=
`
cat
"
$IDENTIFY
"
|
grep
-A
9999
" Histogram:"
|
grep
-B
256
"Colormap:"
|
grep
-o
"
\\
+[0-9]
\\
+: ( *[0-9]
\\
+, *[0-9]
\\
+, *[0-9]
\\
+)"
|
sed
's/ \\+\\([0-9]\\+\\): ( *\\([0-9]\\+\\).\\+/\\2 \\1/g'
`
fi
# Find lowest and highest for both intensity and count
local
MIN_GREY
=
255
local
MAX_GREY
=
0
local
MIN_COUNT
=
9999999
local
MAX_COUNT
=
0
local
TOTAL_COUNT
=
0
local
SAVEIFS
=
$IFS
IFS
=
$(
echo
-en
"
\n\b
"
)
...
...
@@ -121,6 +125,7 @@ function histogram() {
do
local
GREY
=
`
echo
"
$L
"
|
cut
-d
\
-f1
`
local
COUNT
=
`
echo
"
$L
"
|
cut
-d
\
-f2
`
local
TOTAL_COUNT
=
$((
TOTAL_COUNT+COUNT
))
if
[
$MIN_GREY
-gt
$GREY
]
;
then
local
MIN_GREY
=
$GREY
fi
...
...
@@ -134,8 +139,9 @@ function histogram() {
local
MAX_COUNT
=
$COUNT
fi
done
<<<
"
$GREYS
"
IFS
=
$SAVEIFS
#
echo "Grey: $MIN_GREY $MAX_GREY count: $MIN_COUNT $MAX_COUNT"
echo
"Grey:
$MIN_GREY
$MAX_GREY
count:
$MIN_COUNT
$MAX_COUNT
$TOTAL_COUNT
"
# Let SCALE map all counts from 0 to 1
if
[
".true"
==
".
$LOG
"
]
;
then
...
...
@@ -194,5 +200,5 @@ function histogram() {
rm
$HTMP
}
#
histogram $1 200 false
histogram
$1
200
false
# grey_stats $1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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