When I run:-
ffmpeg -v quiet -i "${INPUT}" -c:v libx265 -crf 23 "${OUTPUT}"
I'm still getting output from the command even though the loglevel is set to silent (see the example of the output below)
x265 [info]: HEVC encoder version 3.5+20-17839cc0d
x265 [info]: build info [Mac OS X][clang 11.0.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-3 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 2 / wpp(9 rows)
x265 [warning]: Source height < 720p; disabling lookahead-slices
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias : 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-23.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing deblock sao
I'm using v5 of ffmpeg
ffmpeg version 5.0-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
How do I get ffmpeg to be really quiet?
Add -x265-params log-level=none.
I am trying to create models using multiple variables using bash loop. I need to run several predictions using different r2 and p-value cutoff for the same data. The r2 and value parameters are
cat parameters
0.2 1
0.2 5e-1
0.2 5e-2
0.2 5e-4
0.2 5e-6
0.2 5e-8
0.4 1
0.4 5e-1
0.4 5e-2
0.4 5e-4
0.4 5e-6
0.4 5e-8
0.6 1
0.6 5e-1
0.6 5e-2
0.6 5e-4
0.6 5e-6
0.6 5e-8
0.8 1
0.8 5e-1
0.8 5e-2
0.8 5e-4
0.8 5e-6
0.8 5e-8
The bash loop script I am using test.sh
RSQ=$(cat parameters | awk '{print $1}')
PVAL=$(cat parameters | awk '{print $2}')
season=("spring summer fall winter")
for i in $season;
do
echo prediction_${i}_${RSQ}_${PVAL}
done
the present output is
prediction_spring_0.2 0.2 0.2 0.2 0.2 0.2 0.4 0.4 0.4 0.4 0.4 0.4 0.6 0.6 0.6 0.6 0.6 0.6 0.8 0.8 0.8 0.8 0.8 0.8_1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8
prediction_summer_0.2 0.2 0.2 0.2 0.2 0.2 0.4 0.4 0.4 0.4 0.4 0.4 0.6 0.6 0.6 0.6 0.6 0.6 0.8 0.8 0.8 0.8 0.8 0.8_1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8
prediction_fall_0.2 0.2 0.2 0.2 0.2 0.2 0.4 0.4 0.4 0.4 0.4 0.4 0.6 0.6 0.6 0.6 0.6 0.6 0.8 0.8 0.8 0.8 0.8 0.8_1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8
prediction_winter_0.2 0.2 0.2 0.2 0.2 0.2 0.4 0.4 0.4 0.4 0.4 0.4 0.6 0.6 0.6 0.6 0.6 0.6 0.8 0.8 0.8 0.8 0.8 0.8_1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8 1 5e-1 5e-2 5e-4 5e-6 5e-8
The desired output is
prediction_spring_0.2_1
prediction_spring_0.2_5e-1
prediction_spring_0.2_5e-2
prediction_spring_0.2_5e-4
prediction_spring_0.2_5e-6
prediction_spring_0.2_5e-8
prediction_spring_0.4_1
.......
prediction_winter_0.2_1
prediction_winter_0.2_5e-1
prediction_winter_0.2_5e-2
prediction_winter_0.2_5e-4
prediction_winter_0.2_5e-6
prediction_winter_0.2_5e-8
prediction_winter_0.4_1
..........
Your sample output is not complete enough. I can imagine two solutions: 1) you intend every season to be paired with every RSQ value to be paired with every PVAL value; or, 2) you want the stated R/P pairs to be matched with the seasons.
Solution for #1: you need to loop over the R & P lists
for i in $season; do
for r in $RSQ; do
for p in $PVAL; do
echo prediction_${i}_${r}_${p}
done
done
done
Solution for #2: read the file line by line
for i in $season; do
while read r p; do
echo prediction_${i}_${r}_${p}
done < parameters
done
If SVG element has any filter the vector image in FF not rendered clearly.
See example in FF and in Google Chrome:
http://jsfiddle.net/7cuwP/1/
<div id="1">
<svg version="1.1" style="width: 150px; height: 50px;" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<defs>
<g id=":m12-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M-2.4 -9.9 L1.8 -9.9 1.8 11.75 -2.4 11.75 -2.4 -9.9 Z"/>
</g>
<g id=":m23-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M0 -6.5 Q2 -6.5 3.65 -5.6 5.3 -4.7 6.25 -3.1 7.25 -1.45 7.3 0.75 7.25 2.95 6.25 4.6 5.3 6.25 3.65 7.15 2 8.05 0 8.05 -2 8.05 -3.65 7.15 -5.3 6.25 -6.25 4.6 -7.25 2.95 -7.25 0.75 -7.25 -1.45 -6.25 -3.1 -5.3 -4.7 -3.65 -5.6 -2 -6.5 0 -6.5 M2.25 -1.55 Q1.35 -2.4 0 -2.4 -1.3 -2.4 -2.25 -1.55 -3.1 -0.7 -3.15 0.75 -3.1 2.25 -2.25 3.1 -1.3 3.95 0 3.95 1.35 3.95 2.25 3.1 3.15 2.25 3.15 0.75 3.15 -0.7 2.25 -1.55"/>
</g>
<g id=":m24-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M2.6 -1.05 L1.35 -2.2 -0.3 -2.6 -2 -2.2 -3.25 -1.05 Q-3.8 -0.3 -3.8 0.7 L-3.8 0.75 Q-3.8 1.75 -3.25 2.5 L-2 3.65 -0.3 4.05 1.35 3.7 2.6 2.55 Q3.1 1.8 3.1 0.7 3.1 -0.35 2.6 -1.05 M0.25 -6.45 L1.75 -5.85 Q2.55 -5.45 3.1 -4.7 L3.1 -6.25 7.25 -6.25 7.25 7.75 3.1 7.75 3.1 6.15 1.85 7.25 0.35 7.85 -1 8.05 Q-2.8 8 -4.4 7.15 -6.05 6.25 -7.05 4.65 -8.1 3 -8.1 0.75 -8.1 -1.55 -7.05 -3.15 -6.05 -4.8 -4.4 -5.65 -2.8 -6.55 -1 -6.55 L0.25 -6.45"/>
</g>
<g id=":m25-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M-0.4 1.4 Q-1.75 1.45 -2.65 2.3 -3.6 3.2 -3.6 4.75 -3.6 6.3 -2.65 7.25 -1.75 8.15 -0.4 8.15 L1.25 7.7 2.4 6.55 Q2.85 5.75 2.85 4.75 2.85 3.7 2.4 2.95 1.95 2.2 1.2 1.8 0.5 1.4 -0.4 1.4 M1.3 -2 Q2.4 -1.45 2.95 -0.5 L2.95 -9.85 7.1 -9.85 7.1 11.8 2.95 11.8 2.95 10.05 Q2.4 11.05 1.3 11.55 0.2 12.1 -1.15 12.1 -3 12.1 -4.5 11.2 -6.05 10.3 -7 8.7 -7.9 7.05 -7.95 4.85 -7.9 2.55 -7 0.95 -6.05 -0.7 -4.5 -1.6 -3 -2.5 -1.15 -2.5 L1.3 -2"/>
</g>
<g id=":m26-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.8 -2.8 L1.8 11.2 -2.35 11.2 -2.35 -2.8 1.8 -2.8 M1.55 -9.75 Q2.25 -9.05 2.3 -8 2.25 -6.95 1.55 -6.25 0.8 -5.55 -0.25 -5.55 -1.35 -5.55 -2.1 -6.25 -2.85 -6.95 -2.85 -8 -2.85 -9.05 -2.1 -9.75 -1.35 -10.4 -0.25 -10.45 0.8 -10.4 1.55 -9.75"/>
</g>
<g id=":m27-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.35 -6.45 Q3.75 -6.45 5.1 -5 6.45 -3.5 6.5 -0.55 L6.5 7.85 5.65 7.85 4.4 7.85 3.15 7.85 2.3 7.85 2.3 0.4 Q2.3 -1.05 1.6 -1.7 0.95 -2.4 -0.15 -2.4 -1.25 -2.45 -1.95 -1.8 -2.7 -1.15 -2.7 0.45 L-2.7 7.85 -6.9 7.85 -6.9 -6.15 -2.7 -6.15 -2.7 -4.15 Q-2.1 -5.2 -1 -5.8 0.1 -6.45 1.35 -6.45 Z"/>
</g>
<g id=":m28-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.4 -9.75 Q2.55 -9.25 3.1 -8.25 L3.1 -10 7.15 -10 7.15 2.05 Q7.15 6.55 5.05 8.8 3 11 -0.75 11 -3.1 10.95 -4.9 9.8 -6.75 8.65 -7.65 6.65 L-5.95 5.8 -4.3 5 Q-4.05 5.65 -3.45 6.15 L-2.2 6.95 -0.75 7.25 Q0.85 7.2 1.7 6.55 2.6 5.9 2.9 4.8 3.2 3.7 3.1 2.25 L2.1 3.35 Q1.45 3.8 0.65 4.05 L-1.1 4.3 Q-2.9 4.3 -4.5 3.4 -6.05 2.5 -7.05 0.9 -8.05 -0.75 -8.05 -2.95 -8.05 -5.25 -7.05 -6.85 -6.05 -8.5 -4.5 -9.4 -2.9 -10.3 -1.1 -10.3 0.25 -10.3 1.4 -9.75 M3 -3.05 Q3 -4.1 2.55 -4.85 L1.3 -5.95 Q0.5 -6.35 -0.35 -6.35 L-2 -5.95 -3.25 -4.8 Q-3.7 -4.05 -3.7 -3.05 -3.7 -2 -3.25 -1.2 -2.8 -0.45 -2 -0.05 L-0.35 0.4 1.3 -0.05 2.5 -1.25 Q3 -2 3 -3.05"/>
</g>
</defs>
<g>
<filter id="18t4a8dd8-2">
<feComponentTransfer color-interpolation-filters="sRGB">
<feFuncA type="linear" intercept="0" slope="1"/>
<feFuncR type="linear" intercept="1" slope="0"/>
<feFuncG type="linear" intercept="0" slope="1"/>
<feFuncB type="linear" intercept="1" slope="0"/>
</feComponentTransfer>
</filter>
<g transform="matrix(1 0 0 1 50 20)" filter="url(#18t4a8dd8-2)">
<g>
<use id="s29d1m12" x="0" y="0" xlink:href="#:m12-18svjv0b7" transform="matrix(1 0 0 1 -29.1 -1.25)"></use>
<use id="s29d2m23" x="0" y="0" xlink:href="#:m23-18svjv0b7" transform="matrix(1 0 0 1 -17 2.7)"></use>
<use id="s29d3m24" x="0" y="0" xlink:href="#:m24-18svjv0b7" transform="matrix(0.9962 -0.0839 0.0781 0.9273 0.55 0.2)"></use>
<use id="s29d4m25" x="0" y="0" xlink:href="#:m25-18svjv0b7" transform="matrix(0.9998 0.0179 -0.0179 0.9998 18.75 -2)"></use>
<use id="s29d5m26" x="0" y="0" xlink:href="#:m26-18svjv0b7" transform="matrix(1 0 0 1 32 -0.65)"></use>
<use id="s29d6m27" x="0" y="0" xlink:href="#:m27-18svjv0b7" transform="matrix(1 0 0 1 44.6 2.65)"></use>
<use id="s29d7m28" x="0" y="0" xlink:href="#:m28-18svjv0b7" transform="matrix(1 0 0 1 61.95 6.45)"></use>
</g>
</g>
</g>
</svg>
</div>
<div id="2" style="-webkit-transform: matrix(2,0,0,2,400,50); transform: matrix(2,0,0,2,400,50);">
<svg version="1.1" style="width: 150px; height: 100px;" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<defs>
<g id=":m12-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M-2.4 -9.9 L1.8 -9.9 1.8 11.75 -2.4 11.75 -2.4 -9.9 Z"/>
</g>
<g id=":m23-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M0 -6.5 Q2 -6.5 3.65 -5.6 5.3 -4.7 6.25 -3.1 7.25 -1.45 7.3 0.75 7.25 2.95 6.25 4.6 5.3 6.25 3.65 7.15 2 8.05 0 8.05 -2 8.05 -3.65 7.15 -5.3 6.25 -6.25 4.6 -7.25 2.95 -7.25 0.75 -7.25 -1.45 -6.25 -3.1 -5.3 -4.7 -3.65 -5.6 -2 -6.5 0 -6.5 M2.25 -1.55 Q1.35 -2.4 0 -2.4 -1.3 -2.4 -2.25 -1.55 -3.1 -0.7 -3.15 0.75 -3.1 2.25 -2.25 3.1 -1.3 3.95 0 3.95 1.35 3.95 2.25 3.1 3.15 2.25 3.15 0.75 3.15 -0.7 2.25 -1.55"/>
</g>
<g id=":m24-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M2.6 -1.05 L1.35 -2.2 -0.3 -2.6 -2 -2.2 -3.25 -1.05 Q-3.8 -0.3 -3.8 0.7 L-3.8 0.75 Q-3.8 1.75 -3.25 2.5 L-2 3.65 -0.3 4.05 1.35 3.7 2.6 2.55 Q3.1 1.8 3.1 0.7 3.1 -0.35 2.6 -1.05 M0.25 -6.45 L1.75 -5.85 Q2.55 -5.45 3.1 -4.7 L3.1 -6.25 7.25 -6.25 7.25 7.75 3.1 7.75 3.1 6.15 1.85 7.25 0.35 7.85 -1 8.05 Q-2.8 8 -4.4 7.15 -6.05 6.25 -7.05 4.65 -8.1 3 -8.1 0.75 -8.1 -1.55 -7.05 -3.15 -6.05 -4.8 -4.4 -5.65 -2.8 -6.55 -1 -6.55 L0.25 -6.45"/>
</g>
<g id=":m25-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M-0.4 1.4 Q-1.75 1.45 -2.65 2.3 -3.6 3.2 -3.6 4.75 -3.6 6.3 -2.65 7.25 -1.75 8.15 -0.4 8.15 L1.25 7.7 2.4 6.55 Q2.85 5.75 2.85 4.75 2.85 3.7 2.4 2.95 1.95 2.2 1.2 1.8 0.5 1.4 -0.4 1.4 M1.3 -2 Q2.4 -1.45 2.95 -0.5 L2.95 -9.85 7.1 -9.85 7.1 11.8 2.95 11.8 2.95 10.05 Q2.4 11.05 1.3 11.55 0.2 12.1 -1.15 12.1 -3 12.1 -4.5 11.2 -6.05 10.3 -7 8.7 -7.9 7.05 -7.95 4.85 -7.9 2.55 -7 0.95 -6.05 -0.7 -4.5 -1.6 -3 -2.5 -1.15 -2.5 L1.3 -2"/>
</g>
<g id=":m26-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.8 -2.8 L1.8 11.2 -2.35 11.2 -2.35 -2.8 1.8 -2.8 M1.55 -9.75 Q2.25 -9.05 2.3 -8 2.25 -6.95 1.55 -6.25 0.8 -5.55 -0.25 -5.55 -1.35 -5.55 -2.1 -6.25 -2.85 -6.95 -2.85 -8 -2.85 -9.05 -2.1 -9.75 -1.35 -10.4 -0.25 -10.45 0.8 -10.4 1.55 -9.75"/>
</g>
<g id=":m27-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.35 -6.45 Q3.75 -6.45 5.1 -5 6.45 -3.5 6.5 -0.55 L6.5 7.85 5.65 7.85 4.4 7.85 3.15 7.85 2.3 7.85 2.3 0.4 Q2.3 -1.05 1.6 -1.7 0.95 -2.4 -0.15 -2.4 -1.25 -2.45 -1.95 -1.8 -2.7 -1.15 -2.7 0.45 L-2.7 7.85 -6.9 7.85 -6.9 -6.15 -2.7 -6.15 -2.7 -4.15 Q-2.1 -5.2 -1 -5.8 0.1 -6.45 1.35 -6.45 Z"/>
</g>
<g id=":m28-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.4 -9.75 Q2.55 -9.25 3.1 -8.25 L3.1 -10 7.15 -10 7.15 2.05 Q7.15 6.55 5.05 8.8 3 11 -0.75 11 -3.1 10.95 -4.9 9.8 -6.75 8.65 -7.65 6.65 L-5.95 5.8 -4.3 5 Q-4.05 5.65 -3.45 6.15 L-2.2 6.95 -0.75 7.25 Q0.85 7.2 1.7 6.55 2.6 5.9 2.9 4.8 3.2 3.7 3.1 2.25 L2.1 3.35 Q1.45 3.8 0.65 4.05 L-1.1 4.3 Q-2.9 4.3 -4.5 3.4 -6.05 2.5 -7.05 0.9 -8.05 -0.75 -8.05 -2.95 -8.05 -5.25 -7.05 -6.85 -6.05 -8.5 -4.5 -9.4 -2.9 -10.3 -1.1 -10.3 0.25 -10.3 1.4 -9.75 M3 -3.05 Q3 -4.1 2.55 -4.85 L1.3 -5.95 Q0.5 -6.35 -0.35 -6.35 L-2 -5.95 -3.25 -4.8 Q-3.7 -4.05 -3.7 -3.05 -3.7 -2 -3.25 -1.2 -2.8 -0.45 -2 -0.05 L-0.35 0.4 1.3 -0.05 2.5 -1.25 Q3 -2 3 -3.05"/>
</g>
</defs>
<g>
<filter id="18t4a8dd8-2">
<feComponentTransfer color-interpolation-filters="sRGB">
<feFuncA type="linear" intercept="0" slope="1"/>
<feFuncR type="linear" intercept="1" slope="0"/>
<feFuncG type="linear" intercept="0" slope="1"/>
<feFuncB type="linear" intercept="1" slope="0"/>
</feComponentTransfer>
</filter>
<g transform="matrix(1 0 0 1 50 20)" filter="url(#18t4a8dd8-2)">
<g>
<use id="s29d1m12" x="0" y="0" xlink:href="#:m12-18svjv0b7" transform="matrix(1 0 0 1 -29.1 -1.25)"></use>
<use id="s29d2m23" x="0" y="0" xlink:href="#:m23-18svjv0b7" transform="matrix(1 0 0 1 -17 2.7)"></use>
<use id="s29d3m24" x="0" y="0" xlink:href="#:m24-18svjv0b7" transform="matrix(0.9962 -0.0839 0.0781 0.9273 0.55 0.2)"></use>
<use id="s29d4m25" x="0" y="0" xlink:href="#:m25-18svjv0b7" transform="matrix(0.9998 0.0179 -0.0179 0.9998 18.75 -2)"></use>
<use id="s29d5m26" x="0" y="0" xlink:href="#:m26-18svjv0b7" transform="matrix(1 0 0 1 32 -0.65)"></use>
<use id="s29d6m27" x="0" y="0" xlink:href="#:m27-18svjv0b7" transform="matrix(1 0 0 1 44.6 2.65)"></use>
<use id="s29d7m28" x="0" y="0" xlink:href="#:m28-18svjv0b7" transform="matrix(1 0 0 1 61.95 6.45)"></use>
</g>
</g>
<g transform="matrix(1 0 0 1 50 50)">
<g>
<use id="s29d1m12" x="0" y="0" xlink:href="#:m12-18svjv0b7" transform="matrix(1 0 0 1 -29.1 -1.25)"></use>
<use id="s29d2m23" x="0" y="0" xlink:href="#:m23-18svjv0b7" transform="matrix(1 0 0 1 -17 2.7)"></use>
<use id="s29d3m24" x="0" y="0" xlink:href="#:m24-18svjv0b7" transform="matrix(0.9962 -0.0839 0.0781 0.9273 0.55 0.2)"></use>
<use id="s29d4m25" x="0" y="0" xlink:href="#:m25-18svjv0b7" transform="matrix(0.9998 0.0179 -0.0179 0.9998 18.75 -2)"></use>
<use id="s29d5m26" x="0" y="0" xlink:href="#:m26-18svjv0b7" transform="matrix(1 0 0 1 32 -0.65)"></use>
<use id="s29d6m27" x="0" y="0" xlink:href="#:m27-18svjv0b7" transform="matrix(1 0 0 1 44.6 2.65)"></use>
<use id="s29d7m28" x="0" y="0" xlink:href="#:m28-18svjv0b7" transform="matrix(1 0 0 1 61.95 6.45)"></use>
</g>
</g>
</g>
</svg>
</div>
1-st element has filter and no css-transforms
2-nd element has filter and css-transform (scale and translate)
3-rd element has no filter and has css-transform (scale and translate)
How fix this bug in FF?
PS: This behavior not depend on css-transforms, its made just for an example.
SVG Filters convert vector graphics to bitmaps. When you apply a scale transform higher in the nesting hierarchy, you're going to see the result as if a bitmap is scaled up - hence the blurriness
Fix this by scaling the SVG path with an SVG transform before, or at the same time as you apply the filter.
In this case, remove the CSS transform scale which is applied to the div wrapper, and adjust the transform that's on the same element as the filter to scale the element without the blurry bitmapped result.
Something like the following:
http://codepen.io/anon/pen/HbzhK?editors=100
<div id="2" >
<svg version="1.1" style="width: 150px; height: 100px;" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<defs>
<g id=":m12-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M-2.4 -9.9 L1.8 -9.9 1.8 11.75 -2.4 11.75 -2.4 -9.9 Z"/>
</g>
<g id=":m23-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M0 -6.5 Q2 -6.5 3.65 -5.6 5.3 -4.7 6.25 -3.1 7.25 -1.45 7.3 0.75 7.25 2.95 6.25 4.6 5.3 6.25 3.65 7.15 2 8.05 0 8.05 -2 8.05 -3.65 7.15 -5.3 6.25 -6.25 4.6 -7.25 2.95 -7.25 0.75 -7.25 -1.45 -6.25 -3.1 -5.3 -4.7 -3.65 -5.6 -2 -6.5 0 -6.5 M2.25 -1.55 Q1.35 -2.4 0 -2.4 -1.3 -2.4 -2.25 -1.55 -3.1 -0.7 -3.15 0.75 -3.1 2.25 -2.25 3.1 -1.3 3.95 0 3.95 1.35 3.95 2.25 3.1 3.15 2.25 3.15 0.75 3.15 -0.7 2.25 -1.55"/>
</g>
<g id=":m24-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M2.6 -1.05 L1.35 -2.2 -0.3 -2.6 -2 -2.2 -3.25 -1.05 Q-3.8 -0.3 -3.8 0.7 L-3.8 0.75 Q-3.8 1.75 -3.25 2.5 L-2 3.65 -0.3 4.05 1.35 3.7 2.6 2.55 Q3.1 1.8 3.1 0.7 3.1 -0.35 2.6 -1.05 M0.25 -6.45 L1.75 -5.85 Q2.55 -5.45 3.1 -4.7 L3.1 -6.25 7.25 -6.25 7.25 7.75 3.1 7.75 3.1 6.15 1.85 7.25 0.35 7.85 -1 8.05 Q-2.8 8 -4.4 7.15 -6.05 6.25 -7.05 4.65 -8.1 3 -8.1 0.75 -8.1 -1.55 -7.05 -3.15 -6.05 -4.8 -4.4 -5.65 -2.8 -6.55 -1 -6.55 L0.25 -6.45"/>
</g>
<g id=":m25-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M-0.4 1.4 Q-1.75 1.45 -2.65 2.3 -3.6 3.2 -3.6 4.75 -3.6 6.3 -2.65 7.25 -1.75 8.15 -0.4 8.15 L1.25 7.7 2.4 6.55 Q2.85 5.75 2.85 4.75 2.85 3.7 2.4 2.95 1.95 2.2 1.2 1.8 0.5 1.4 -0.4 1.4 M1.3 -2 Q2.4 -1.45 2.95 -0.5 L2.95 -9.85 7.1 -9.85 7.1 11.8 2.95 11.8 2.95 10.05 Q2.4 11.05 1.3 11.55 0.2 12.1 -1.15 12.1 -3 12.1 -4.5 11.2 -6.05 10.3 -7 8.7 -7.9 7.05 -7.95 4.85 -7.9 2.55 -7 0.95 -6.05 -0.7 -4.5 -1.6 -3 -2.5 -1.15 -2.5 L1.3 -2"/>
</g>
<g id=":m26-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.8 -2.8 L1.8 11.2 -2.35 11.2 -2.35 -2.8 1.8 -2.8 M1.55 -9.75 Q2.25 -9.05 2.3 -8 2.25 -6.95 1.55 -6.25 0.8 -5.55 -0.25 -5.55 -1.35 -5.55 -2.1 -6.25 -2.85 -6.95 -2.85 -8 -2.85 -9.05 -2.1 -9.75 -1.35 -10.4 -0.25 -10.45 0.8 -10.4 1.55 -9.75"/>
</g>
<g id=":m27-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.35 -6.45 Q3.75 -6.45 5.1 -5 6.45 -3.5 6.5 -0.55 L6.5 7.85 5.65 7.85 4.4 7.85 3.15 7.85 2.3 7.85 2.3 0.4 Q2.3 -1.05 1.6 -1.7 0.95 -2.4 -0.15 -2.4 -1.25 -2.45 -1.95 -1.8 -2.7 -1.15 -2.7 0.45 L-2.7 7.85 -6.9 7.85 -6.9 -6.15 -2.7 -6.15 -2.7 -4.15 Q-2.1 -5.2 -1 -5.8 0.1 -6.45 1.35 -6.45 Z"/>
</g>
<g id=":m28-18svjv0b7">
<path stroke="none" fill="rgb(255,0,255)" d="M1.4 -9.75 Q2.55 -9.25 3.1 -8.25 L3.1 -10 7.15 -10 7.15 2.05 Q7.15 6.55 5.05 8.8 3 11 -0.75 11 -3.1 10.95 -4.9 9.8 -6.75 8.65 -7.65 6.65 L-5.95 5.8 -4.3 5 Q-4.05 5.65 -3.45 6.15 L-2.2 6.95 -0.75 7.25 Q0.85 7.2 1.7 6.55 2.6 5.9 2.9 4.8 3.2 3.7 3.1 2.25 L2.1 3.35 Q1.45 3.8 0.65 4.05 L-1.1 4.3 Q-2.9 4.3 -4.5 3.4 -6.05 2.5 -7.05 0.9 -8.05 -0.75 -8.05 -2.95 -8.05 -5.25 -7.05 -6.85 -6.05 -8.5 -4.5 -9.4 -2.9 -10.3 -1.1 -10.3 0.25 -10.3 1.4 -9.75 M3 -3.05 Q3 -4.1 2.55 -4.85 L1.3 -5.95 Q0.5 -6.35 -0.35 -6.35 L-2 -5.95 -3.25 -4.8 Q-3.7 -4.05 -3.7 -3.05 -3.7 -2 -3.25 -1.2 -2.8 -0.45 -2 -0.05 L-0.35 0.4 1.3 -0.05 2.5 -1.25 Q3 -2 3 -3.05"/>
</g>
</defs>
<g>
<filter id="18t4a8dd8-2">
<feComponentTransfer color-interpolation-filters="sRGB">
<feFuncA type="linear" intercept="0" slope="1"/>
<feFuncR type="linear" intercept="1" slope="0"/>
<feFuncG type="linear" intercept="0" slope="1"/>
<feFuncB type="linear" intercept="1" slope="0"/>
</feComponentTransfer>
</filter>
<g transform="matrix(2 0 0 2 50 20)" filter="url(#18t4a8dd8-2)">
etc.
I want to round my float variables in order for the sum of these variables to be equal 1. Here is my program :
for float in 0.0 0.001 0.01 0.025 0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 0.25; do
w1=`echo "1.0 - $float" | bc -l`
w2=`echo "$w1/3" | bc -l`
echo "$w2 0.0 $w2 0.0 0.0 0.0 $w2 $float 0.0 0.0 0.0 0.0"
done
Where the sum 3*$w2 + $float has to be 1.00.
I'm a beginner but I need this to compute some results.
I tried already what I found on the internet to round w2, but I didn't manage to make it work. And it has to be rounded and not truncated for the final result to be 1.00.
bc lets you use variables, so you can say:
for float in 0.0 0.001 0.01 0.025 0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 0.25; do
{ read w2; read f; } < <(
bc -l <<< "scale=5; w2=(1.0-$float)/3; w2; 1.0-3*w2"
)
echo "$w2 0.0 $w2 0.0 0.0 0.0 $w2 $f 0.0 0.0 0.0 0.0"
done
.33333 0.0 .33333 0.0 0.0 0.0 .33333 .00001 0.0 0.0 0.0 0.0
.33300 0.0 .33300 0.0 0.0 0.0 .33300 .00100 0.0 0.0 0.0 0.0
.33000 0.0 .33000 0.0 0.0 0.0 .33000 .01000 0.0 0.0 0.0 0.0
.32500 0.0 .32500 0.0 0.0 0.0 .32500 .02500 0.0 0.0 0.0 0.0
.31666 0.0 .31666 0.0 0.0 0.0 .31666 .05002 0.0 0.0 0.0 0.0
.30833 0.0 .30833 0.0 0.0 0.0 .30833 .07501 0.0 0.0 0.0 0.0
.30000 0.0 .30000 0.0 0.0 0.0 .30000 .10000 0.0 0.0 0.0 0.0
.29166 0.0 .29166 0.0 0.0 0.0 .29166 .12502 0.0 0.0 0.0 0.0
.28333 0.0 .28333 0.0 0.0 0.0 .28333 .15001 0.0 0.0 0.0 0.0
.27500 0.0 .27500 0.0 0.0 0.0 .27500 .17500 0.0 0.0 0.0 0.0
.26666 0.0 .26666 0.0 0.0 0.0 .26666 .20002 0.0 0.0 0.0 0.0
.25833 0.0 .25833 0.0 0.0 0.0 .25833 .22501 0.0 0.0 0.0 0.0
.25000 0.0 .25000 0.0 0.0 0.0 .25000 .25000 0.0 0.0 0.0 0.0
Adjust scale=? as required.
From your comment in your OP you say it's acceptable to alter the float variable so as to have a sum equal to 1. In this, case, first compute the w2 and then re-compute float from that:
w2=$(bc -l <<< "(1-($float))/3")
float=$(bc -l <<< "1-3*($w2)")
The whole thing, written in a better style:
floats=( 0.0 0.001 0.01 0.025 0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 0.25 )
for float in "${floats[#]}"; do
w2=$(bc -l <<< "(1-($float))/3")
float=$(bc -l <<< "1-3*($w2)")
printf "%s 0.0 %s 0.0 0.0 0.0 %s %s 0.0 0.0 0.0 0.0\n" "$w2" "$w2" "$w2" "$float"
done
This uses the precision provided by bc -l (20 decimal digits after the decimal point). If you don't want that accuracy, you may round the w2 before recomputing float as so:
floats=( 0.0 0.001 0.01 0.025 0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 0.25 )
for float in "${floats[#]}"; do
w2=$(bc -l <<< "scale=3; (1-($float))/3")
float=$(bc <<< "1-3*($w2)")
printf "%s 0.0 %s 0.0 0.0 0.0 %s %s 0.0 0.0 0.0 0.0\n" "$w2" "$w2" "$w2" "$float"
done
Note that the last bc isn't called with the -l option: it will use whatever significant digits are in w2. Change the scale to suit your needs. Proceeding thus will guarantee that your numbers add up to 1, as you can check from the output of the previous snippet:
.333 0.0 .333 0.0 0.0 0.0 .333 .001 0.0 0.0 0.0 0.0
.333 0.0 .333 0.0 0.0 0.0 .333 .001 0.0 0.0 0.0 0.0
.330 0.0 .330 0.0 0.0 0.0 .330 .010 0.0 0.0 0.0 0.0
.325 0.0 .325 0.0 0.0 0.0 .325 .025 0.0 0.0 0.0 0.0
.316 0.0 .316 0.0 0.0 0.0 .316 .052 0.0 0.0 0.0 0.0
.308 0.0 .308 0.0 0.0 0.0 .308 .076 0.0 0.0 0.0 0.0
.300 0.0 .300 0.0 0.0 0.0 .300 .100 0.0 0.0 0.0 0.0
.291 0.0 .291 0.0 0.0 0.0 .291 .127 0.0 0.0 0.0 0.0
.283 0.0 .283 0.0 0.0 0.0 .283 .151 0.0 0.0 0.0 0.0
.275 0.0 .275 0.0 0.0 0.0 .275 .175 0.0 0.0 0.0 0.0
.266 0.0 .266 0.0 0.0 0.0 .266 .202 0.0 0.0 0.0 0.0
.258 0.0 .258 0.0 0.0 0.0 .258 .226 0.0 0.0 0.0 0.0
.250 0.0 .250 0.0 0.0 0.0 .250 .250 0.0 0.0 0.0 0.0
You have to use the bc utility to process floating point numbers in bash.
For example consider the code given below,
a=15
b=2
echo "$a / $b"
will give you 7 as result.
Where as,
a=15
b=2
echo "$a / $b" | bc -l
Will give 7.500000 as results
You can use printf to round the output of bc:
printf '%.2f\n' $( bc -l <<< "3 * $w2 + $float" )
I am trying to use join to add a column onto a file with about 4.5M lines. The files are sorted by their first column. All the numbers in the first column in file 1 are in the first column in file 2. when I use "join FILE1 FILE2 > output" it works for the first 1000 lines or so and then stops...
I am not married to the idea of join (program never seems to work right) and open to other ways to join these files. I tried grep, but doing this by grep for 4*10^6 records is very slow. Below is a sample of the data I'm working with.
FILE 1
964 0 0.0 0.0 0.0 0.0 1.0 -
965 0 0.0 1.0 0.0 0.0 0.0 -
966 0 0.0 0.0 0.0 0.0 1.0 -
967 0 0.0 0.0 0.0 0.0 1.0 -
968 0 0.0 1.0 0.0 0.0 0.0 -
969 0 0.0 0.0 0.0 1.0 0.0 -
970 0 0.0 0.0 1.0 0.0 0.0 -
971 0 0.0 1.0 0.0 0.0 0.0 -
1075 3 4.0 0.0 0.0 0.0 0.0 -
1076 0 4.0 0.0 0.0 0.0 0.0 -
1077 0 0.0 0.0 4.0 0.0 0.0 -
1078 0 0.0 0.0 0.0 4.0 0.0 -
File 2
964 T
965 C
966 T
967 G
968 C
969 T
970 G
971 C
972 G
973 G
974 T
975 G
976 C
977 T
978 G
979 G
980 C
981 T
982 G
output (Last few lines)
965 0 0.0 1.0 0.0 0.0 0.0 - C
966 0 0.0 0.0 0.0 0.0 1.0 - T
967 0 0.0 0.0 0.0 0.0 1.0 - G
968 0 0.0 1.0 0.0 0.0 0.0 - C
969 0 0.0 0.0 0.0 1.0 0.0 - T
970 0 0.0 0.0 1.0 0.0 0.0 - G
971 0 0.0 1.0 0.0 0.0 0.0 - C
9990 0 0.0 0.0 0.0 0.0 0.0 - T
9991 0 0.0 0.0 0.0 0.0 0.0 - C
EDIT
Sorting in dictionary format works for all records after 463835. I think it is because it sorted the input files differently, likely due to the other columns???
FILE 1
466630 0 0.0 0.0 0.0 0.0 0.0 -
46663 0 0.0 0.0 0.0 3.0 0.0 -
466631 0 0.0 0.0 0.0 0.0 0.0 -
FILE 2
466639 C
46663 A
466640 G
Your files are sorted numerically, but join expects them to be sorted in dictionary order (1 < 10 < 2 < 200 < 3). Use join <(sort FILE1) <(sort FILE2). But (as suggested in the comments) do consider using a database.