Related
My old script worked fine years ago.
set terminal png background "#ffffff" enhanced fontscale 2.0 size 1800, 1400
set output 'delete.png'
w=1
x=1
z = 60
y=2
plot 'plot.in.tmp' using (column(x)/z):(column(y)) axis x1y1 with lines
exit gnuplot
reset
Now result in graph with only rounded integer points in y(vertical) axe. I dont understand why.
Example data in file:
0 -0,00 0,5 570,2 11,98 -0,121 0,000 9,6
5 -0,00 0,7 570,2 11,97 -0,002 0,012 13,2
10 -0,00 0,9 570,3 11,98 -0,004 -0,000 16,1
15 0,24 35,9 570,4 11,96 0,001 0,000 18,4
20 0,56 87,0 570,1 11,99 -0,001 -0,000 20,5
25 1,03 173,5 570,4 11,97 -0,000 0,000 23,2
30 1,61 296,4 570,3 11,96 0,002 0,000 12,4
35 2,17 422,6 570,2 11,68 0,004 0,000 8,8
40 2,81 571,6 570,2 11,37 0,010 0,001 7,5
45 3,52 752,3 570,3 11,26 0,015 0,000 7,1
50 3,97 905,0 570,2 11,69 0,075 0,006 7,4
55 4,36 1048,4 570,1 11,36 0,081 0,001 8,6
60 4,59 1156,8 570,2 11,22 0,087 0,001 10,7
Result graph:
Welcome to StackOverflow! Maybe the local setting of your system (or something in gnuplot) has changed?
The following works for me with your data.
Add a line
set decimalsign locale "german"
or
set decimalsign locale "french"
Check help decimalsign.
Syntax:
set decimalsign {<value> | locale {"<locale>"}}
Correct typesetting in most European countries requires:
set decimalsign ','
Please note: If you set an explicit string, this affects only numbers
that are printed using gnuplot's gprintf() formatting routine,
including axis tics. It does not affect the format expected for input
data, and it does not affect numbers printed with the sprintf()
formatting routine.
The answer given by theozh is correct, but it does not point out the unfortunate lack of standardization about how different operating systems report the current locale setting. For linux machines the locale strings are less human-friendly. For example instead of using something generic like "french", they subdivide into "fr_FR.UTF-8" "fr_BE.UTF-8" "fr_LU.UTF-8" etc to account for slight differences in the conventions used in France, Belgium, Luxembourg, etc.
I cannot tell you the exact set of locale descriptions on your machine, but here is what works for me on a linux machine:
set decimalsign locale "fr_FR.UTF-8"
w=1
x=1
z = 60
y=2
plot 'plot.in.tmp' using (column(x)/z):(column(y)) axis x1y1 with lines
I have run the example of Pocketsphinx Python and now I am facing the issue that I want to run a 60sec wav file for speech recognition in English and want as output
- the English translation AND
- at which second each word was mentioned.
Now, I do not know where to start to dome some research to get the required output. Could anyone please point me in the right direction??
ok, the open source tools like Kaldi automatically offers this:
https://americanarchivepb.wordpress.com/2017/12/04/dockerized-kaldi-speech-to-text-tool/
You need recognition with forced alignment. Here is an example for pocketsphinx:
pocketsphinx_continuous
-infile with.wav
-jsgf with-word.jsgf
-dict words.dict
-backtrace yes
-fsgusefiller no
-bestpath no
2>&1 > with-word.txt
Output:
==> with-word.txt <==
INFO: fsg_search.c(869): fsg 0.05 CPU 0.051 xRT
INFO: fsg_search.c(871): fsg 0.09 wall 0.084 xRT
INFO: pocketsphinx.c(1171): sil with sil (-2607)
word start end pprob ascr lscr lback
sil 3 77 1.000 -1602 0 1
with 78 102 1.000 -845 0 1
sil 103 107 1.000 -160 0 1
INFO: fsg_search.c(265): TOTAL fsg 0.05 CPU 0.051 xRT
INFO: fsg_search.c(268): TOTAL fsg 0.09 wall 0.085 xRT
sil with sil
For CMU Sphinx 4 you need the SpeechAligner class from Sphinx API. Here you'll find an implementation of simple aligner tool.
./align.sh sample.wav sample.txt 2>/dev/null
Output:
"it's","IH T S","false","0.0","170","200"
"a","AH","false","-5540774.0","200","390"
"crowd","K R AW D","false","-1.13934288E8","850","1300"
"in","IH N","false","-1.95127088E8","1300","1470"
"two","T UW","false","-2.23176048E8","1470","1700"
"distinct","D IH S T IH NG K T","false","-2.6345264E8","1700","2230"
"ways","W EY Z","false","-3.58427808E8","2230","2730"
"the","DH AH","false","-4.72551168E8","2920","3100"
"fruit","F R UW T","false","-5.24233504E8","3220","3530"
"of","AH V","false","-5.79971456E8","3530","3640"
"a","AH","false","-5.99515456E8","3640","3760"
"figg","F IH G","false","-6.2017152E8","3760","4060"
"tree","T R IY","false","-6.72126656E8","4060","4490"
"is","IH Z","false","-7.4763744E8","4490","4570"
"apple","AE P AH L","false","-7.73581184E8","4630","5040"
"shaped","SH EY P T","false","-8.44424704E8","5040","5340"
Updated:
I have a file which is quite big. I need to mask all characters in specific postions and from a specific record type. I have searched all over the place but cannot find a solution of this quite simple task. Here is an example
File name:
hello.txt
File:
0120140206INPUT FILE
1032682842 MR SIMPSON
20231458 742 Evergreen Terrace
3034560817 GREEN
1032682842 MR GRIFFIN
20231458 Spooner Street
3034560817 RED
3001
What I would like to do is to mask position 12-16 of all lines starting with 10. Like this:
0120140206INPUT FILE
1032682842 XXXXXMPSON
20231458 742 Evergreen Terrace
3034560817 GREEN
1032682842 XXXXXIFFIN
20231458 Spooner Street
3034560817 RED
3001
Try this:
sed 's/^\(10[0-9]\+[ \t]\+\).*$/\1XXXXXXXXXXXXX/g'
Example:
sed 's/^\(10[0-9]\+[ \t]\+\).*$/\1XXXXXXXXXXXXX/g' <<< "0120140206INPUT FILE
1032682842 MR SIMPSON
20231458 742 Evergreen Terrace
9001"
Using awk:
awk '/^10/{q=substr($0, 12); gsub(/./, "*", q); $0=substr($0, 1, 11) q}1' file
0120140206INPUT FILE
1032682842 **********
20231458 742 Evergreen Terrace
9001
UPDATE: If you want only first 10 record to be masked then use this awk:
awk '!done && /^10/{q=substr($0, 12);gsub(/./, "*", q);$0=substr($0, 1, 11) q;done=1}1' file
I want to convert some single page postscript files to eps. They are from the same source multiple page ps file, extracted with psselect. Some of the pages (the short ones) are rotated (by 90° to the left) with respect to their original orientation when I do ps2eps $file. In the the ps2eps man pages (ftp://ftp.tex.ac.uk/tex-archive/support/ps2eps/doc/html/ps2eps.html) I found:
ps2eps filters also %%Orientation. But I checked with diff file.ps file.eps that the only difference between the files is
diff tmp.ps tmp.eps
1c1,3
< %!PS-Adobe-3.0
---
> %!PS-Adobe-2.0 EPSF-2.0
> %%BoundingBox: 132 613 466 750
> %%HiResBoundingBox: 132.000000 613.500000 465.500000 749.500000
9d10
< %%Pages: 1 0
12a14,23
> % EPSF created by ps2eps 1.68
> %%BeginProlog
> save
> countdictstack
> mark
> newpath
> /showpage {} def
> /setpagedevice {pop} def
> %%EndProlog
> %%Page 1 1
14d24
<
85d94
<
476a486,490
> %%Trailer
> cleartomark
> countdictstack
> exch sub { end } repeat
> restore
So why does it change orientation and how can I prevent it? Note that I instructed my viewer to display it in original orientation.
On my MacBook Pro in Terminal adding the flag "-R=-" preserves orientation:
ps2eps -R=- input.ps
If your generated eps file is rotated 90 degrees anti-clockwise for example, you can avoid this issue by amending the conversion command to 'ps2eps +R=+ file.ps' which rotates the generated eps file 90 clockwise.
Also looking at the options with '-R' under 'ps2eps --help' shows many options to rotate your generated eps file.
i found a work-around which works for me but some of you might not like. Here goes...
First use
ps2pdf
then delete the original ps
then use
pdf2ps
then use
ps2eps
I know it sounds ridiculous but thats the only thing that works for me without any drawbacks and the quality seems to be still there in my case.
Good luck
I have 16 jpg files which are around 920x1200 pixels (the widths slightly differ but heights are all 1200). I'm trying to join them into a pdf with:
convert *.jpg foo.pdf
But the resulting paper size is 1.53x2 inches. If I pass the arguments -page Letter, the page size ends up being a bewildering 1.02x1.32 inches. What is going wrong here? All of the information I can find suggests that this should work. I just want a document that consists of 16 letter-size pages.
This question is pretty old, but I had a similar problem and I think I found the solution.
The documentation for the -page option says "This option is used in concert with -density", but the relationship between the options seems a little unclear, possibly because the documentation is geared towards raster images.
From experimenting with the settings, I found that the pdf page size can be controlled by combining -page -density and -units. The documentation for -page shows that letter is the same as entering 612 x 792. Combining -density 72 with -units pixelsperinch will give you (612px /72px) * 1in = 8.5in.
convert *.jpg -units pixelsperinch -density 72 -page letter foo.pdf should do what the original poster wanted.
I just succeeded with
convert file.mng -page letter file.pdf
For Letter, you need to specify the size as 792x612 PostScript points. Therefor try this command:
convert \
in1.jpg \
in2.jpg \
in3.jpg \
in4.jpg \
in5.jpg \
-gravity center \
-resize 792x612\! \
letter.pdf
Works for me with ImageMagick version 6.7.8-3 2012-07-19 Q16 on Mac OS X:
identify -format "%f[%s] : %W x %H\n" letter.pdf
letter.pdf[0] : 792 x 612
letter.pdf[1] : 792 x 612
letter.pdf[2] : 792 x 612
letter.pdf[3] : 792 x 612
letter.pdf[4] : 792 x 612
Or
pdfinfo -f 1 -l 5 letter.pdf
Title: _
Producer: ImageMagick 6.7.8-3 2012-07-19 Q16 http://www.imagemagick.org
CreationDate: Fri Jul 27 22:28:00 2012
ModDate: Fri Jul 27 22:28:00 2012
Tagged: no
Form: none
Pages: 5
Encrypted: no
Page 1 size: 792 x 612 pts (letter)
Page 1 rot: 0
Page 2 size: 792 x 612 pts (letter)
Page 2 rot: 0
Page 3 size: 792 x 612 pts (letter)
Page 3 rot: 0
Page 4 size: 792 x 612 pts (letter)
Page 4 rot: 0
Page 5 size: 792 x 612 pts (letter)
Page 5 rot: 0
File size: 178642 bytes
Optimized: no
PDF version: 1.3
According to this, 72 dpi is the default density => one dot per pixel (for a computer screen).
So you just need to specify -units pixelsperinch.
You can type the following command :
$ convert *.jpg -units pixelsperinch -page letter foo.pdf
BTW : If you want to use a non standard page size such as A4R for example, you must first determine the page size in dots (or pixels given at 72dpi) :
$ paperconf -s -p A4
595.276 841.89
Then the -page argument for A4R will be 842x595