Since:
sinh(x)=[exp(x)-exp(-x)]/2
cosh(x)=[exp(x)+exp(-x)]/2
tanh(x)=sinh(x)/cosh(x)
Therefore:
/usr/bin/awk '{print (exp($1)-exp(-$1))/2}' in.dat
/usr/bin/awk '{print (exp($1)+exp(-$1))/2}' in.dat
/usr/bin/awk '{print (exp($1)-exp(-$1))/(exp($1)+exp(-$1))}' in.dat
will give sinh, cosh, and tanh for the data inside in.dat.
An example is below, the first column is input, the rest 3 columns are output of sinh, cosh, and tanh using the above awk commands.
-9.0 -4051.5400 4051.5400 -1.0000
-8.0 -1490.4800 1490.4800 -1.0000
-7.0 -548.3160 548.3170 -1.0000
-6.0 -201.7130 201.7160 -1.0000
-5.0 -74.2032 74.2099 -0.9999
-4.0 -27.2899 27.3082 -0.9993
-3.0 -10.0179 10.0677 -0.9951
-1.0 -1.1752 1.5431 -0.7616
-0.6 -0.6367 1.1855 -0.5371
-0.3 -0.3045 1.0453 -0.2913
0.0 0.0000 1.0000 0.0000
0.3 0.3045 1.0453 0.2913
0.6 0.6367 1.1855 0.5371
1.0 1.1752 1.5431 0.7616
2.0 3.6269 3.7622 0.9640
3.0 10.0179 10.0677 0.9951
4.0 27.2899 27.3082 0.9993
5.0 74.2032 74.2099 0.9999
6.0 201.7130 201.7160 1.0000
7.0 548.3160 548.3170 1.0000
8.0 1490.4800 1490.4800 1.0000
9.0 4051.5400 4051.5400 1.0000
Wednesday, June 16, 2010
Friday, June 11, 2010
Multiple pages in one postscript file
The following is one postscript file with 3 pages. (I don't know why page 4 doesn't show up).
And the file doesn't always give expected result.
--------------------------
%!PS-Adobe-3.0
%%BoundingBox: 0 0 600 792
%%Page: 1 1
newpath
144 72 moveto
144 232 lineto
stroke
/Times-Roman findfont 30 scalefont setfont
200 200 moveto (page 1)show
showpage
%%Page: 2 2
newpath
144 72 moveto
164 262 lineto
stroke
200 200 moveto (page 2)show
showpage
%%Page: 3 3
newpath
144 72 moveto
184 292 lineto
stroke
200 200 moveto (page 3)show
showpage
%%Page: 4 4
newpath
144 72 moveto
204 322 lineto
stroke
200 200 moveto (page 4)show
showpage
----------------------------------
And the file doesn't always give expected result.
--------------------------
%!PS-Adobe-3.0
%%BoundingBox: 0 0 600 792
%%Page: 1 1
newpath
144 72 moveto
144 232 lineto
stroke
/Times-Roman findfont 30 scalefont setfont
200 200 moveto (page 1)show
showpage
%%Page: 2 2
newpath
144 72 moveto
164 262 lineto
stroke
200 200 moveto (page 2)show
showpage
%%Page: 3 3
newpath
144 72 moveto
184 292 lineto
stroke
200 200 moveto (page 3)show
showpage
%%Page: 4 4
newpath
144 72 moveto
204 322 lineto
stroke
200 200 moveto (page 4)show
showpage
----------------------------------
Saturday, April 17, 2010
Looking for a research and/or service position in the field of NMR spectroscopy
I am looking for a research and/or service position in the field of NMR spectroscopy.
Wednesday, April 14, 2010
Generate publishable quality NMR spectrum by modifying Sparky plot ps file (3)
When postscript looks fine, open it in gimp
in the Load PostScript pop-window, Resolution 100-> 1000,
Width x10, Height x10, eg 826->8260, 1170->11700 then Ok,
It takes time to open, when finish loading, one can Crop image to get rid
of blank region, Scale image to the required size and resolution and save as tif or eps.
One can save a low resolution jpg version by modifying Scale image parameter or select a low Quality number(0-100) in the popup window after trying Save As a new.jpg
in the Load PostScript pop-window, Resolution 100-> 1000,
Width x10, Height x10, eg 826->8260, 1170->11700 then Ok,
It takes time to open, when finish loading, one can Crop image to get rid
of blank region, Scale image to the required size and resolution and save as tif or eps.
One can save a low resolution jpg version by modifying Scale image parameter or select a low Quality number(0-100) in the popup window after trying Save As a new.jpg
Generate publishable quality NMR spectrum by modifying Sparky plot ps file (2)
7, Change peak contour color
"/levelcolor n def" where n could be 0(black), 1(white), 2(gray), 3(red), 4(green) 5(blue), 6(yellow), 7(magenta) 8(cyan) etc.
8, To combine two or more postscript files, simply comment the showpage line and add showpage at the end of the very last postscript file. The relative positions, sizes can be adjusted by modifying some numbers in the combined postscript file.
9, "pt" command from Sparky generate postscript file of the spectra. In order to overlap two or more sets data, ppm/cm should be identical also "rt" make sure all sets with the same ppm range.
10, Useful postscript language like
0.5 0.5 scale (change size)
-200 400 translate (translocation, change position)
0.5 setlinewidth
254 400 moveto 350 400 lineto stroke (draw lines)
11, to write label A, B, ... or any other annotations
gsave
/Helvetica findfont 24 scalefont setfont
-238 685 moveto (A) show
130 685 moveto (B) show
-238 455 moveto (new annotations) show
grestore
Use "gsave ...... grestore" often (make life easier)
"/levelcolor n def" where n could be 0(black), 1(white), 2(gray), 3(red), 4(green) 5(blue), 6(yellow), 7(magenta) 8(cyan) etc.
8, To combine two or more postscript files, simply comment the showpage line and add showpage at the end of the very last postscript file. The relative positions, sizes can be adjusted by modifying some numbers in the combined postscript file.
9, "pt" command from Sparky generate postscript file of the spectra. In order to overlap two or more sets data, ppm/cm should be identical also "rt" make sure all sets with the same ppm range.
10, Useful postscript language like
0.5 0.5 scale (change size)
-200 400 translate (translocation, change position)
0.5 setlinewidth
254 400 moveto 350 400 lineto stroke (draw lines)
11, to write label A, B, ... or any other annotations
gsave
/Helvetica findfont 24 scalefont setfont
-238 685 moveto (A) show
130 685 moveto (B) show
-238 455 moveto (new annotations) show
grestore
Use "gsave ...... grestore" often (make life easier)
Generate publishable quality NMR spectrum by modifying Sparky plot ps file (1)
It is easier to use "vi" in a linux terminal to do the modification.
1, locate setlinewidth, change "1.0 setlinewidth" to "2.0 setlinewidth"
2, If there is label on the figure, change /LabelFont from /Courier to /Helvetica.
3, Label size can be optimized by changing the currentfont value near the end of the file.
4, Label can be moved simply by changing the number associated with the label in the ps file.
5, Axes can be hided by switching true to false near the beginning of the ps file
6, Two postscript files can overlap with different color or be arranged side by side.
1, locate setlinewidth, change "1.0 setlinewidth" to "2.0 setlinewidth"
2, If there is label on the figure, change /LabelFont from /Courier to /Helvetica.
3, Label size can be optimized by changing the currentfont value near the end of the file.
4, Label can be moved simply by changing the number associated with the label in the ps file.
5, Axes can be hided by switching true to false near the beginning of the ps file
6, Two postscript files can overlap with different color or be arranged side by side.
Saturday, April 10, 2010
music
Music is my hobby. I like listening to music. I like some old popular songs in Chinese, which is my native language. Some songs are just unforgettable. To someone like me, mp3 could be one of the best stuff around nowadays.
(note: mp3 is a music file format. Music from a CD can be converted to mp3 format easily using popular music player. And then you can listen to your favorite music simply by opening the mp3 file on your computer's music player software or any mp3 player, again and again and again ... How nice is that? Can one imagine that 20 years ago?)
Subscribe to:
Posts (Atom)