Wednesday 30 December 2009

Installation of Numpy and Scipy, 64 bit Koala

I am losing posts from this blog. Previous installations were ok, and documented on here, but they've gone. My doubts about the stability of this blog are growing.

Anyway, here's a working process for Koala 64:

Numpy etc, Dec 09

Remove conflicting packages and install requirements:

sudo apt-get remove python-nose g77
sudo apt-get install build-essential python-dev swig gfortran python-setuptools
sudo easy_install nose


Build lapack
=======

mkdir -p ~/downloads/lapack
cd ~/downloads/lapack
wget http://www.netlib.org/lapack/lapack-3.1.1.tgz
tar zxvf lapack-3.1.1.tgz
cd lapack-3.1.1
cp INSTALL/make.inc.gfortran make.inc

Edit the make.inc file: Set OPTS and NOOPT for position independent code: I used,
OPTS = -O2 -fPIC -m64
NOOPT = -O0 -fPIC -m64

where the 64 is for 64 bit.

cd SRC
make

This creates lapack_.a ; its location is required for ATLAS.
My version made ~/downloads/lapack/lapack-3.1.1/lapack_LINUX.a


BUILD ATLAS
========

mkdir -p ~/downloads/ATLAS
cd ~/downloads/ATLAS
wget http://downloads.sourceforge.net/math-atlas/atlas3.8.2.tar.bz2?modtime=1212787160&big_mirror=0

tar jxvf atlas3.8.2.tar.bz2
cd ATLAS
mkdir ATLAS_ubuntu64 # my choice
cd ATLAS_ubuntu64

sudo cpufreq-selector -g performance # error, nomatter. Possibly for laptops.
../configure -b 64 -Fa alg -fPIC --with-netlib-lapack=/home/ms/downloads/lapack/lapack-3.1.1/lapack_LINUX.a
(note the double dots at the start of that)

Heron: Start = 12:06, Finish = 13:55
Koala: Start = 13:33, Finish = 13:42

Ocelot:  Failed here on Hector.


odd.

make time

Reference clock rate=2394Mhz, new rate=2399Mhz
Refrenc : % of clock rate achieved by reference install
Present : % of clock rate achieved by present ATLAS install

single precision double precision
******************************** *******************************
real complex real complex
--------------- --------------- --------------- ---------------
Benchmark Refrenc Present Refrenc Present Refrenc Present Refrenc Present
========= ======= ======= ======= ======= ======= ======= ======= =======
kSelMM 561.0 563.4 532.2 500.6 319.7 315.9 298.5 303.1
kGenMM 173.6 155.4 177.0 173.3 165.3 143.0 165.4 164.8
kMM_NT 134.3 128.8 129.3 166.9 126.9 120.4 133.2 148.7
kMM_TN 159.7 161.0 156.8 161.0 149.2 140.4 157.3 154.7
BIG_MM 546.6 559.8 559.5 564.4 312.3 313.3 308.1 314.0
kMV_N 108.2 117.5 209.2 233.0 53.7 68.5 86.6 100.9
kMV_T 87.8 93.8 96.2 80.4 46.5 57.0 77.7 74.9
kGER 132.6 173.8 108.7 136.9 27.4 33.6 43.6 54.6



Copy the libraries to a lib directory:

cd lib
mkdir -p ~/scipy_build/lib
cp * ~/scipy_build/lib




Build UMFPACK
=========

Get the latest versions of AMD, UFconfig and UMFPACK. Untar them:

mkdir ~/downloads/UMFPACK
cd ~/downloads/UMFPACK
wget http://www.cise.ufl.edu/research/sparse/umfpack/current/UMFPACK.tar.gz
gunzip < UMFPACK.tar.gz | tar xvf -

wget http://www.cise.ufl.edu/research/sparse/amd/current/AMD.tar.gz
gunzip < AMD.tar.gz | tar xvf -

wget http://www.cise.ufl.edu/research/sparse/UFconfig/UFconfig-3.2.0.tar.gz
gunzip < UFconfig-3.2.0.tar.gz | tar xvf -

Check which version of gcc is in use. This machine shows

/usr/lib/gcc/x86_64-linux-gnu/4.4.1

so, UFconfig/UFconfig.mk contains:

------
CC = gcc
CFLAGS = -O3 -fexceptions -m64 -fPIC
F77 = gfortran
F77FLAGS = -O -m64 -fPIC
-------
BLAS = -L/usr/lib/gcc/x86_64-linux-gnu/4.4.1 -L/home/ms/scipy_build/lib -llapack -lf77blas -lcblas -latlas -lgfortran
LAPACK = -L/usr/lib/gcc/x86_64-linux-gnu/4.4.1 -L/home/ms/scipy_build/lib -llapack -lf77blas -lcblas -latlas -lgfortran


Run make in the UMFPACK directory:
cd /home/ms/downloads/UMFPACK/UMFPACK/
make

Copy the resulting libraries and include files:
cd ..
mkdir /home/ms/scipy_build/lib/include
cp AMD/Lib/libamd.a ~/scipy_build/lib
cp UMFPACK/Lib/libumfpack.a ~/scipy_build/lib
cp AMD/Include/amd.h ~/scipy_build/lib/include
cp UFconfig/UFconfig.h ~/scipy_build/lib/include
cp UMFPACK/Include/*.h ~/scipy_build/lib/include

Copy libgfortran into scipy library directory (doesn't work if the umfpack libs aren't together)
cp /usr/lib/gcc/x86_64-linux-gnu/4.4.1/libgfortran.* ~/scipy_build/lib/


Build FFTW
=======
These steps should be executed one at a time. If the download file does not exist,
check the website for the latest version name.

mkdir ~/downloads/FFTW
cd ~/downloads/FFTW
wget http://www.fftw.org/fftw-3.2.2.tar.gz
gunzip < fftw-3.2.2.tar.gz | tar xvf -
cd fftw-3.2.2
./configure

Note: This part didn't work -----------------------------------
Examine the makefile for flags: vi Makefile
Look for CFLAGS, FFLAGS, CXXFLAGS. In mine, there were no CxxFLAGS. I added -fPIC -m64 to CFLAGS and FFLAGS,
from past experience.

./configure --enable-sse2 --enable-threads --with-combined-threads CFLAGS = "-O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math -march=core2 -fPIC -m64" FFLAGS = "-g -O2 -fPIC -m64"

Now, I get:
configure: error: unrecognized option: -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math -march=core2

Odd, indeed. I performed ./configure again, and this time didn't specify anything manually.
end of non-working case ---------------------------------------------------

./configure
make
sudo make install


Build numpy and scipy
==============

Download and extract:

cd ~/downloads; mkdir scipy; mkdir numpy
cd numpy; wget http://downloads.sourceforge.net/numpy/numpy-1.2.1.tar.gz
gunzip < numpy-1.2.1.tar.gz | tar xvf -

cd ../scipy; wget http://downloads.sourceforge.net/scipy/scipy-0.7.1.tar.gz
gunzip < scipy-0.7.1.tar.gz | tar xvf -

Set site.cfg
cd ~/downloads/numpy/numpy-1.2.1/
cp site.cfg.example site.cfg


Execute the next few lines as one command, to update the file:
------------------ *snip* ------------------

echo '[DEFAULT]
library_dirs = /usr/local/lib:/home/ms/scipy_build/lib
include_dirs = /usr/local/include:/home/ms/scipy_build/lib/include

[atlas]
atlas_libs = lapack, f77blas, cblas, atlas

[amd]
amd_libs = amd
[umfpack]
umfpack_libs = umfpack, gfortran

[fftw]
libraries = fftw3

' | tee -a site.cfg


------------------ *snip* ------------------

Copy this site.cfg to scipy, also (maybe not required)

python setup.py build > buildlog.log
sudo python setup.py install >> installlog.log

installs numpy. Then,

cd ~/downloads/scipy/scipy-0.7.1
python setup.py build > buildlog.log

Warning about no config file. In previous installations, I copied the numpy
site.cfg file to this directory, and it worked ok. That is a worry. Continue for now.

sudo python setup.py install >> installlog.log



Success, indicated by:

$ python
import numpy
import scipy

no errors.

Protect yourself from Google record keeping

http://mycroft.mozdev.org/search-engines.html?name=scroogle

General ubuntu setup.

That last post concerning setting up parts of ubuntu on the eee,
triggered an interest in a single script to configure ubuntu from
start to finish.

This is that command. For clarity, it may be split into a few commands.

Before execution, the required repositories should be added.

The following is performed:

Installation of vim, konsole, fluxbox, latex, skype, conky, gkrellm, eterm (wallpaper), fortune:

sudo apt-get install vim konsole fluxbox texlive-latex-base skype conky gkrellm eterm fortune-mod

Update of fluxbox keyboard shortcuts: Copy and paste the multiple lines as one command.

echo '# Applications
Mod4 Z :Exec konsole
Mod4 F :Exec firefox
Mod4 S :Exec skype

' | tee -a ~/.fluxbox/keys


Update /etc/hosts to prevent infuriating web shit.

sudo echo '
# Auto added during config
127.0.0.1 push-analytics.com
127.0.0.1 view.atdmt.com
' | tee -a /etc/hosts

Saturday 26 December 2009

koala, eee, config

echo deb http://packages.medibuntu.org/ karmic free non-free | sudo tee -a /etc/apt/sources.list
wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add -
sudo apt-get update

skype:
It should have been present in the medibunto repo's, but it wouldn't install.
I downloaded a .deb file, attempted to install with

dpkg -i filename.deb

but there were dependency problems, that were not easily fixed.

Doing

sudo apt-get -f install

downloaded stuff and fixed everything.

koala, eee, config

Tuesday 22 December 2009

UK news agencies have nothing useful to say: turn to kids for help

http://news.bbc.co.uk/1/hi/england/8334216.stm

Being made redundant meant I couldn't look after my hamster that much.

Wednesday 16 December 2009

vim notes 2

Paragraph forward / back: ESC { and ESC }


pasting:

vim --version

Check whether xterm_clipboard has a + or - preceding it. If -, add it by running
a version with it enabled. gvim has it enabled. I installed vim-python, to install
gvim, which then affected my normal vim.

Once enabled,

ESCAPE " + p

pastes from the xterm clipboard.

From http://vim.wikia.com/wiki/Accessing_the_system_clipboard

* "+2yy – copy two lines to X11 clipboard
* "+dd – cut line to X11 clipboard
* "+p – paste X11 clipboard

-----------------


Code folding.

V
select block
ZF

marks the code for folding

-------------------

multiple tabs:

vi -p *.tex

or

:tabnew filename

tab navigate with CTRL pg-up and pg-down

Gavin: tabdo command

executes command on all tabs.
-----------------------

Bookmarking:

m a : set a mark
` a : jump to mark. `a' can be anything.

-------------------

Mapping keys in Vim:

To map to control-V, the paste function whilst in insert mode:

 

:imap pi



or something like that
-----------------

Search / replace (from http://www.linux.com/learn/tutorials/8255-vim-tips-the-basics-of-search-and-replace):

:/string search
:?string backwards search
n next
N previous

:8,10 s/search/replace/g from line 8 to 10, g(lobal = repeats on lines)

Or, use visual select and execute the search. v is visual, V is line visual, CRTL-v is block visual.

:%s/search/replace/g over entire file

----------------------

Vim white spaces on pasting from GUI

Pre paste, do

:set paste

Post paste, do

:set nopaste

to prevent automatic indentation. From http://aymanh.com/a-collection-of-vim-tips

-------------------------

Copy, paste multiple buffers.


" a y to place into register `a'.
" a p to place into register `a'.

So, the `+' is the global buffer....

--------------------------

To pull the results of a command into the editor:

:r ! command

for example

:r ! ls gabvo*

;)
----------------------------

Speech marks when using vim-latex:

Insert mode, CTRL-V, "

CTRL-V indicates literal mode, I think.

http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-not-loaded-vim7

-------------

Saturday 7 November 2009

skype, in koala

sudo vi /etc/apt/sources.list

add:

http://packages.medibuntu.org/ karmic free non-free

Koala DVD

sudo apt-get install ubuntu-restricted-extras

Tuesday 3 November 2009

subfig captions are not centered with \abstract

Trial and error showed this to be due to \abstract being
used. Changing to \begin{abstract} text \end{abstract}
cleaned things up immediately.

Monday 5 October 2009

PAFEC examples. Single PZT element.

TITLE Single 2D PZT element

CONTROL
FRONTAL.SINUSOIDAL.SOLUTION
PLANE.STRAIN
CONTROL.END

PARAMETERS
'E0' = 8.85E-12


NODES
NODE X Y
1 0 0
2 1 0
3 0 1
4 1 1

ELEMENTS
NUMBER GROUP ELEMENT PROP TOPO
1 1 35425 11 1 2 3 4


ORTHOTROPIC
NUMB SXX SYY SZZ SXY SYZ SZX SHXY SHYZ SHZX RO
11 15E-12 15E-12 18E-12 -4.5E-12 -4.6E-12 -4.6E-12 47E-12 47E-12 39E-12 7800

PIEZOELECTRIC
NUMB TYPE EPZZ EPXX EZX EZZ EXXZ
c clamped. See tol_j7.DAT
11 1 <830 * 'E0'> <916 * 'E0'> -5.4 15.8 12.3


MODES.AND.FREQUENCIES
AUTO MODES
0 0

RESPONSE
TYPE
0

FREQUENCIES.FOR.ANALYSIS
TYPE START FINISH NUMBER
3 100 10000 10

FULL.DYNAMICS.OUTPUT
TYPE START FINISH STEP
4 1 100 1

LAMINATES
NUMB ORTH PIEZ AXIS ANG2 LOWER UPPER
11 11 11 1 90 0 1

REPEATED.FREEDOMS
N1 N2 AXIS DIRE
1 2 1 4

RESTRAINTS
NODE PLANE AXIS DIRE
3 2 1 4

SINE.LOADING
NODE DIRE TABLE
1 4 1

MASTERS
NODE DIRE
1 4

TABLES
TABLE BASIS VALUE
1 1 1 0
1 1000 1 0

END.OF.DATA

Friday 2 October 2009

Vim notes

Column insert.

CTRL-V to enter visual block.
Select insert column region.
I (that's a capital i)
Type text.
esc

Thursday 17 September 2009

nethogs

sudo nethogs


and

lsof -Pnl +M -i4 | fold -w70

to see ipv4 connections

iftop

is lovely!

Monday 31 August 2009

.vimrc

sudo apt-get install vim i dunno what ubuntu ships with, but there's sommat up with it.

set nocompatible
set autoindent
set smartindent
set tabstop=3
set shiftwidth=3
set showmatch
set vb t_vb=
set ruler
set incsearch
set virtualedit=all
set ruler

" Required for vim-latex
filetype plugin on

" for python
set foldmethod=marker

" for python:
set commentstring=\#\%s
" default fold level.
set foldlevel=5

syntax on " lovely. Use %stopzone to force latex stopzone

" Required for vim-latex
filetype plugin on

" grep will sometimes skip displaying the filename if you
" search in a single file. This will confuse latex-suite.
" Set your grep to always generate a filename.
set grepprg=grep\ -nH\ $*

" Optional. Empty .tex files are plaintex, not tex, resulting
" in vim-latex not being loaded. This changes the default:
let g:tex_flavor='latex'

set foldcolumn=4 " View the code folding column on lhs.

set tw=60 " 78 is the default but with 80 char term and
" some columns lost, it's a bit small. Experience suggests
" 60 is pleasant to read.

set nowrap " turn line wrapping off
set expandtab " tabs -> spaces
set tabstop=3 " 3 spaces in a tab, please.
set spell " Joy! in-line spelling.

" See vimdoc.sourceforge.net/htmldoc/spell.html
" setlocal spell spelllang=en_uk
" there is no uk
"

" no line feed unless ENTER pressed.
" This stops lines being broken when too long.
set formatoptions=l
set lbr


" I hate the latex key mappings. Turn them off:
let Imap_FreezeImap=1

" automatically save and restore folds
au BufWinLeave * mkview
au BufWinEnter * silent loadview


" Increase the maximum number of tabbed files displayable from ten.
set tabpagemax=40

Saturday 29 August 2009

accessing ext2 ext3 from windows

http://www.fs-driver.org/

Monday 24 August 2009

ubuntu sharing: fast.

Host:
sudo apt-get install nfs-kernel-server
sudo dpkg-reconfigure portmap (select no)

/etc/exports now exists. Add the directory to be shared, and the
machines allowed to connect:

/home/me/projects/phd/python 192.168.1.111(ro)
/home/me/parallel 192.168.1.111(rw)


---
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-kernel-server restart
--- OR, post 2009: ----
sudo service portmap restart
sudo service nfs-kernel-server restart
----

on the client:
sudo apt-get install portmap nfs-common

and mount: remote, local spec:

sudo mount 192.168.1.110:/home/me/projects/phd/python /home/me/projects/phd/python

sudo mount 192.168.16.31:/home/me/parallel /home/me/parallel

Sunday 23 August 2009

Missing posts from blog

2009/02/following-instructions-at-httpwww.html is missing.

Saturday 22 August 2009

sending clicks and button presses to windows

http://kvance.livejournal.com/985732.html

Monday 17 August 2009

Connection speed testing between two machines

iperf -s on the server.

iperf -c 192.168.etc.etc on the connecting machine.

890 Mbit/s for gigabit lan.

Saturday 15 August 2009

ipython colours

Yellow on white is unreadable. Adjust by:

% colors LightBG

in the ipython window. Make permanent by editing

~/.ipython/ipythonrc

If that has no effect, check IPYTHONDIR:

echo $IPYTONDIR

to check the ipython config directory is as expected.

Wednesday 12 August 2009

HDD hard drive failure

To rescue:

Buy a new drive.

On a separate machine:
Create a boot usb stick. I chose unetboot for this, with ubuntu heron 64.
Download the source for dd_recover. In its directory, type, 'make'.
Copy the executable onto the usb drive.

On the injured machine:
Disconnect all irrelevant drives (reduce the chance of mistake).
Boot, with the old and new drive connected.
Establish which is the dying drive, and the new drive, by 'ls /dev/sd*'
Open a terminal, navigate to /cdrom
Execute, 'dd_recover /dev/sdbroken /dev/sdnew'

Cross fingers and wait. At 50Mb/s, a 1Tb drive will take 5 hours: best case.

When complete, replace the dying with the new drive and try to boot. Then,
partition the drive to get to the extra space. This may require booting from
the usb stick if the drive is in use. Better, would be to remove the new drive
and treat in a separate machine.

------------------------------

Another dead drive, this time an external USB HDD. It does not mount
when connected. Apparently, power was turned off during format.

sudo dmesg shows:

[ 1844.170716] usb 5-7: new high speed USB device using ehci_hcd and address 5
[ 1844.307211] usb 5-7: configuration #1 chosen from 1 choice
[ 1844.376038] usbcore: registered new interface driver libusual
[ 1844.383242] Initializing USB Mass Storage driver...
[ 1844.383324] scsi8 : SCSI emulation for USB Mass Storage devices
[ 1844.383375] usbcore: registered new interface driver usb-storage
[ 1844.383378] USB Mass Storage support registered.
[ 1844.383468] usb-storage: device found at 5
[ 1844.383470] usb-storage: waiting for device to settle before scanning
[ 1849.370658] usb-storage: device scan complete
[ 1852.240770] scsi 8:0:0:0: Direct-Access Bx pY f b ' PQ: 0 ANSI: 2
[ 1852.242374] sd 8:0:0:0: [sdc] 48568225 512-byte hardware sectors (24867 MB)
[ 1852.242874] sd 8:0:0:0: [sdc] Write Protect is off
[ 1852.242883] sd 8:0:0:0: [sdc] Mode Sense: 00 00 00 00
[ 1852.242885] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1852.243866] sd 8:0:0:0: [sdc] 48568225 512-byte hardware sectors (24867 MB)
[ 1852.244370] sd 8:0:0:0: [sdc] Write Protect is off
[ 1852.244380] sd 8:0:0:0: [sdc] Mode Sense: 00 00 00 00
[ 1852.244381] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[ 1852.244400] sdc:<6>usb 5-7: reset high speed USB device using ehci_hcd and address 5
[ 1892.538059] usb 5-7: reset high speed USB device using ehci_hcd and address 5
[ 1897.773757] usb 5-7: reset high speed USB device using ehci_hcd and address 5
[ 1912.861841] usb 5-7: device descriptor read/64, error -110
[ 1928.055006] usb 5-7: device descriptor read/64, error -110
[ 1928.273410] usb 5-7: reset high speed USB device using ehci_hcd and address 5
[ 1943.361499] usb 5-7: device descriptor read/64, error -110
[ 1958.553675] usb 5-7: device descriptor read/64, error -110
[ 1958.769079] usb 5-7: reset high speed USB device using ehci_hcd and address 5
[ 1969.160604] usb 5-7: device not accepting address 5, error -110
[ 1969.272427] usb 5-7: reset high speed USB device using ehci_hcd and address 5
[ 1979.663953] usb 5-7: device not accepting address 5, error -110
[ 1979.663979] sd 8:0:0:0: Device offlined - not ready after error recovery
[ 1979.663989] usb 5-7: USB disconnect, address 5
[ 1979.663993] sd 8:0:0:0: [sdc] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK
[ 1979.664000] end_request: I/O error, dev sdc, sector 0
[ 1979.664004] Buffer I/O error on device sdc, logical block 0
[ 1979.664009] Buffer I/O error on device sdc, logical block 1
[ 1979.664013] Buffer I/O error on device sdc, logical block 2
[ 1979.664016] Buffer I/O error on device sdc, logical block 3
[ 1979.664020] Buffer I/O error on device sdc, logical block 4
[ 1979.664023] Buffer I/O error on device sdc, logical block 5
[ 1979.664027] Buffer I/O error on device sdc, logical block 6
[ 1979.664030] Buffer I/O error on device sdc, logical block 7
[ 1979.664061] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664064] Buffer I/O error on device sdc, logical block 0
[ 1979.664069] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664071] Buffer I/O error on device sdc, logical block 1
[ 1979.664076] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664085] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664089] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664092] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664096] sd 8:0:0:0: rejecting I/O to offline device

Many repeats......


[ 1979.664201] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664204] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664208] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664212] ldm_validate_partition_table(): Disk read failed.
[ 1979.664216] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664220] sd 8:0:0:0: rejecting I/O to offline device

repeats......

[ 1979.664328] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664332] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664336] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664339] Dev sdc: unable to read RDB block 0
[ 1979.664343] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664346] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664350] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664354] sd 8:0:0:0: rejecting I/O to offline device

repeats.......

O to offline device
[ 1979.664523] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664527] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664530] sd 8:0:0:0: rejecting I/O to offline device
[ 1979.664534] unable to read partition table
[ 1979.664616] sd 8:0:0:0: [sdc] Attached SCSI disk
[ 1979.664655] sd 8:0:0:0: Attached scsi generic sg3 type 0
[ 1979.775779] usb 5-7: new high speed USB device using ehci_hcd and address 6
[ 1989.835833] usb 5-7: new high speed USB device using ehci_hcd and address 7
[ 1989.972154] usb 5-7: configuration #1 chosen from 1 choice
[ 1989.972548] scsi9 : SCSI emulation for USB Mass Storage devices
[ 1989.972614] usb-storage: device found at 7
[ 1989.972619] usb-storage: waiting for device to settle before scanning
[ 1994.964698] usb-storage: device scan complete
[ 1997.862654] scsi 9:0:0:0: Direct-Access Bx pY g B g PQ: 0 ANSI: 2
[ 1997.864255] sd 9:0:0:0: [sdc] 40179617 512-byte hardware sectors (20572 MB)
[ 1997.864761] sd 9:0:0:0: [sdc] Write Protect is off
[ 1997.864766] sd 9:0:0:0: [sdc] Mode Sense: 00 00 00 00
[ 1997.864767] sd 9:0:0:0: [sdc] Assuming drive cache: write through
[ 1997.865751] sd 9:0:0:0: [sdc] 40179617 512-byte hardware sectors (20572 MB)
[ 1997.866249] sd 9:0:0:0: [sdc] Write Protect is off
[ 1997.866254] sd 9:0:0:0: [sdc] Mode Sense: 00 00 00 00
[ 1997.866255] sd 9:0:0:0: [sdc] Assuming drive cache: write through
[ 1997.866273] sdc:<6>usb 5-7: reset high speed USB device using ehci_hcd and address 7
[ 2038.155247] usb 5-7: reset high speed USB device using ehci_hcd and address 7
[ 2043.398933] usb 5-7: reset high speed USB device using ehci_hcd and address 7
[ 2058.487017] usb 5-7: device descriptor read/64, error -110
[ 2073.678951] usb 5-7: device descriptor read/64, error -110
[ 2073.894596] usb 5-7: reset high speed USB device using ehci_hcd and address 7
[ 2088.982685] usb 5-7: device descriptor read/64, error -110
[ 2104.174613] usb 5-7: device descriptor read/64, error -110
[ 2104.392014] usb 5-7: reset high speed USB device using ehci_hcd and address 7
[ 2114.781787] usb 5-7: device not accepting address 7, error -110
[ 2114.893612] usb 5-7: reset high speed USB device using ehci_hcd and address 7
[ 2125.285140] usb 5-7: device not accepting address 7, error -110
[ 2125.285169] sd 9:0:0:0: Device offlined - not ready after error recovery
[ 2125.285178] usb 5-7: USB disconnect, address 7
[ 2125.285181] sd 9:0:0:0: [sdc] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK
[ 2125.285188] end_request: I/O error, dev sdc, sector 0
[ 2125.285191] printk: 110 messages suppressed.
[ 2125.285193] Buffer I/O error on device sdc, logical block 0
[ 2125.285197] Buffer I/O error on device sdc, logical block 1
[ 2125.285200] Buffer I/O error on device sdc, logical block 2
[ 2125.285202] Buffer I/O error on device sdc, logical block 3
[ 2125.285205] Buffer I/O error on device sdc, logical block 4
[ 2125.285208] Buffer I/O error on device sdc, logical block 5
[ 2125.285210] Buffer I/O error on device sdc, logical block 6
[ 2125.285213] Buffer I/O error on device sdc, logical block 7
[ 2125.285241] sd 9:0:0:0: rejecting I/O to offline device
[ 2125.285248] Buffer I/O error on device sdc, logical block 0
[ 2125.285255] sd 9:0:0:0: rejecting I/O to offline device
[ 2125.285257] Buffer I/O error on device sdc, logical block 1
[ 2125.285266] sd 9:0:0:0: rejecting I/O to offline device
[ 2125.285270] sd 9:0:0:0: rejecting I/O to offline device
[ 2125.285273] sd 9:0:0:0: rejecting I/O to offline device

many repeats.....

[ 2125.285363] sd 9:0:0:0: rejecting I/O to offline device
[ 2125.285366] ldm_validate_partition_table(): Disk read failed.
[ 2125.285369] sd 9:0:0:0: rejecting I/O to offline device


more repeats.....

[ 2125.285458] sd 9:0:0:0: rejecting I/O to offline device
[ 2125.285461] sd 9:0:0:0: rejecting I/O to offline device
[ 2125.285463] Dev sdc: unable to read RDB block 0
[ 2125.285466] sd 9:0:0:0: rejecting I/O to offline device
[ 2125.285469] sd 9:0:0:0: rejecting I/O to offline device


repeats.....

skipped more of the same, and finally,

sd 10:0:0:0: rejecting I/O to offline device
[ 3634.610064] sd 10:0:0:0: rejecting I/O to offline device
[ 3634.610067] sd 10:0:0:0: rejecting I/O to offline device
[ 3634.610069] sd 10:0:0:0: rejecting I/O to offline device
[ 3634.610071] unable to read partition table
[ 3634.610137] sd 10:0:0:0: [sdc] Attached SCSI disk
[ 3634.610175] sd 10:0:0:0: Attached scsi generic sg3 type 0
[ 3634.725120] usb 5-7: new high speed USB device using ehci_hcd and address 14
[ 3649.808711] usb 5-7: device descriptor read/64, error -110
[ 3665.001629] usb 5-7: device descriptor read/64, error -110
[ 3665.217284] usb 5-7: new high speed USB device using ehci_hcd and address 15
[ 3680.304374] usb 5-7: device descriptor read/64, error -110
[ 3695.501037] usb 5-7: device descriptor read/64, error -110
[ 3695.716694] usb 5-7: new high speed USB device using ehci_hcd and address 16
[ 3706.103477] usb 5-7: device not accepting address 16, error -110
[ 3706.215302] usb 5-7: new high speed USB device using ehci_hcd and address 17
[ 3716.614816] usb 5-7: device not accepting address 17, error -110


This was unfixed. To compliment,

sudo tail -f /var/log/messages showed,

Apr 30 10:07:12 starnesm-desktop1 kernel: [ 2125.285188] end_request: I/O error, dev sdc, sector 0
Apr 30 10:07:12 starnesm-desktop1 kernel: [ 2125.285191] printk: 110 messages suppressed.
Apr 30 10:07:12 starnesm-desktop1 kernel: [ 2125.285463] Dev sdc: unable to read RDB block 0
Apr 30 10:07:12 starnesm-desktop1 kernel: [ 2125.285618] unable to read partition table
Apr 30 10:07:12 starnesm-desktop1 kernel: [ 2125.285696] sd 9:0:0:0: [sdc] Attached SCSI disk
Apr 30 10:07:12 starnesm-desktop1 kernel: [ 2125.285734] sd 9:0:0:0: Attached scsi generic sg3 type 0
Apr 30 10:07:12 starnesm-desktop1 kernel: [ 2125.400963] usb 5-7: new high speed USB device using ehci_hcd and address 8
Apr 30 10:07:43 starnesm-desktop1 kernel: [ 2155.896936] usb 5-7: new high speed USB device using ehci_hcd and address 9
Apr 30 10:08:13 starnesm-desktop1 kernel: [ 2186.397281] usb 5-7: new high speed USB device using ehci_hcd and address 10
Apr 30 10:08:24 starnesm-desktop1 kernel: [ 2196.899629] usb 5-7: new high speed USB device using ehci_hcd and address 11
Apr 30 10:29:25 starnesm-desktop1 kernel: [ 3455.876103] usb 5-7: new high speed USB device using ehci_hcd and address 12
Apr 30 10:30:08 starnesm-desktop1 kernel: [ 3498.963810] usb 5-7: new high speed USB device using ehci_hcd and address 13
Apr 30 10:30:08 starnesm-desktop1 kernel: [ 3499.101120] usb 5-7: configuration #1 chosen from 1 choice
Apr 30 10:30:08 starnesm-desktop1 kernel: [ 3499.101523] scsi10 : SCSI emulation for USB Mass Storage devices
Apr 30 10:30:16 starnesm-desktop1 kernel: [ 3507.180857] scsi 10:0:0:0: Direct-Access Bx pY g b g PQ: 0 ANSI: 2
Apr 30 10:30:16 starnesm-desktop1 kernel: [ 3507.188146] sd 10:0:0:0: [sdc] 115816353 512-byte hardware sectors (59298 MB)
Apr 30 10:30:16 starnesm-desktop1 kernel: [ 3507.188659] sd 10:0:0:0: [sdc] Write Protect is off
Apr 30 10:30:16 starnesm-desktop1 kernel: [ 3507.189660] sd 10:0:0:0: [sdc] 115816353 512-byte hardware sectors (59298 MB)
Apr 30 10:30:16 starnesm-desktop1 kernel: [ 3507.192650] sd 10:0:0:0: [sdc] Write Protect is off
Apr 30 10:30:46 starnesm-desktop1 kernel: [ 3507.192658] sdc:<6>usb 5-7: reset high speed USB device using ehci_hcd and address 13
Apr 30 10:30:56 starnesm-desktop1 kernel: [ 3547.482902] usb 5-7: reset high speed USB device using ehci_hcd and address 13
Apr 30 10:31:02 starnesm-desktop1 kernel: [ 3552.720100] usb 5-7: reset high speed USB device using ehci_hcd and address 13
Apr 30 10:31:32 starnesm-desktop1 kernel: [ 3583.219754] usb 5-7: reset high speed USB device using ehci_hcd and address 13
Apr 30 10:32:03 starnesm-desktop1 kernel: [ 3613.714429] usb 5-7: reset high speed USB device using ehci_hcd and address 13
Apr 30 10:32:13 starnesm-desktop1 kernel: [ 3624.217274] usb 5-7: reset high speed USB device using ehci_hcd and address 13
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.608832] sd 10:0:0:0: Device offlined - not ready after error recovery
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.608839] usb 5-7: USB disconnect, address 13
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.608845] sd 10:0:0:0: [sdc] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK,SUGGEST_OK
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.608850] end_request: I/O error, dev sdc, sector 0
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.608855] printk: 110 messages suppressed.
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.609855] Dev sdc: unable to read RDB block 0
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.610071] unable to read partition table
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.610137] sd 10:0:0:0: [sdc] Attached SCSI disk
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.610175] sd 10:0:0:0: Attached scsi generic sg3 type 0
Apr 30 10:32:24 starnesm-desktop1 kernel: [ 3634.725120] usb 5-7: new high speed USB device using ehci_hcd and address 14
Apr 30 10:32:54 starnesm-desktop1 kernel: [ 3665.217284] usb 5-7: new high speed USB device using ehci_hcd and address 15
Apr 30 10:33:25 starnesm-desktop1 kernel: [ 3695.716694] usb 5-7: new high speed USB device using ehci_hcd and address 16
Apr 30 10:33:35 starnesm-desktop1 kernel: [ 3706.215302] usb 5-7: new high speed USB device using ehci_hcd and address 17

http://www.bhcblog.com/2009/02/11/fix-for-device-descriptor-read64-error-71/

suggested adding irqpoll to the kernel options on boot. I didn't, though.

Tuesday 11 August 2009

Nouns / verbs.

Noun Verb

Practice Practise

array version of z.index(4)

To search for the value, 3 in a:

np.where(a == 0)

Friday 7 August 2009

Mass file renaming, linux!

Well, congrats to Gavbo: This has been tested and does just what was desired.


# Rename Writings.* to Index.*

for s in Writings.*; do mv $s ${s/'Writings'/'Index'}; done;

command line loop: copy file with incrementing filename and substitute text

for example:

Test the command:
for i in 0 1 2 3 4 5 6 7; do echo cp tol_b3.DAT tol_b1$i.DAT; done

Run the command:
for i in 0 1 2 3 4 5 6 7; do cp tol_b3.DAT tol_b1$i.DAT; done



Substitute parameter: This uses sed, with all the files.

To replace 'abc' with def' in file, 'xyz':

sed -e 's/abc/def/' xyz > xyz


So, to replace ''step' = 1' with ''step' = index' where index is increasing:
(note, the tmp and mv is required, as sed will wipe the file, otherwise.)


for i in 0 1 2 3 4 5 6 7;
do
sed -e "s/step' = 1/step' = $i/" tol_b1$i.DAT > tmp
mv tmp tol_b1$i.DAT
done

which becomes the following one line:

for i in 0 1 2 3 4 5 6 7; do sed -e "s/step' = 1/step' = $i/" tol_b1$i.DAT > tmp; mv tmp tol_b1$i.DAT; done


Also, sets of files being copied / renamed (according to Gavin):

for s in Writings.*; do mv $s ${s/'Writings'/'Index'}; done;

Wednesday 29 July 2009

Using ipcluster etc with IPython.

Fire up the cluster, then run IPython and copy/paste the code below.


$ ipcluster -n 8



# Set up the parallel function:
from IPython.kernel import client; tc = client.TaskClient()

@tc.parallel() # define parallel load and return data
def go(x):
import numpy, reference
x.load()
f, p = x.PAFECffp[0, 1:], 20 * numpy.log10(abs(x.PAFECffp[1, 1:]) / 20E-6)
return((f, p))

# Create a list of things to throw at the cluster:
ii = [0, 1, 2, 3, 4, 5] # filename extensions.
a = [mfile.File('/full/path/morph_a' + str(i) + '.O07') for i in ii]

# Engage!
res = go(a)


res should now contain a list of results.

Thursday 23 July 2009

Data extraction from graphical plots

Install Engauge.
Import the graphics file.
Set the axes points and limits. Set log or not in Settings / Coordinates.
In 'segment fill', click on sections of the plot, when the rotating thingy runs around them.
The sections available were probably bright green. Missed parts can be added with 'curve point'

Export the data. This generates a .csv file.

Use the following:



Generate regression data:

# import data
fn = 'filename.csv'

a = file(fn, 'r')
b = a.readlines()
c = [i.strip('\n').split(',') for i in b[1:]] # 1st line has text.
d = []
for i in c:
d.append([float(j) for j in i])

d = array(d)
plot(d[:, 0], d[:, 1])

# or do it the easy way. :)
a = mfile.File('fn'); a.load(); d = a.data

# generate regression info. 4th order polynomial
e = polyfit(d[:, 0], d[:, 1], 4)

# and plot against original data
plot(d[:, 0], d[:, 1])
plot(d[:, 0], e[0] * d[:, 0] ** 4 + e[1] * d[:, 0]**3 + e[2] *d[:, 0]**2 + e[3] * d[:, 0] + e[4])

If that's a crap fit, loglog data may look better:
# ------------------------------------------------------------
f = log10(d) # point by point log10
g = polyfit(f[:, 0], f[:, 1], 4) # polynomial fit to the loglog data
plot(f[:, 0], f[:, 1]) # plot original data, log10'd
plot(d[:, 0], 10**(g[0] * log10(d[:, 0]) ** 4 + g[1] * log10(d[:, 0])**3 + g[2] * log10(d[:, 0])**2 + g[3] * log10(d[:, 0]) + g[4]))
# -------------------------------------------------------------

Wednesday 22 July 2009

ssh non standard ports and general security

Edit /etc/ssh/ssd_config

Change the listening port number

port 22
port 12345

Restart the ssh server:

sudo /etc/init.d/ssh restart


Access it, by

ssh -p xxxx user@192.16x.xxx.xxx

After making these changes, rsync may not work. Use the new port as:

rsync -vzP --port=1234 user@192.168.1.12:/home/user/work/m78/others_from_archive/*.ps ./


------------------------------

from http://forums.devshed.com/bsd-help-31/blocking-a-range-of-ip-s-in-hosts-deny-322368.html

the users allowed to login can be specified in

/etc/ssh/sshd_config

by adding,

# List of user names allowed to log in
AllowUsers sam kim bob mary pete

and

PermitRootLogin no

-----------------------------------------------------

Block specific ip addresses: Edit /etc/hosts.deny and add,

ALL: 64.40.110.235, 64.40.150.235

etc etc. No carriage returns allowed, though i presume line-feed is ok.
Ranges are possible: more reading required.

Friday 17 July 2009

Constants

Reynolds number: Re = rho * u * d / mu

Dynamic viscosity of air:

μ = 1.7894E − 5 N sm−2 ; note the units: Newton seconds per metre squared. The
units are like those for resistance, except this is over an area.

Sunday 12 July 2009

Monday 6 July 2009

Spaces in fstab

Honestly, who puts spaces in directory names?

Anyway, ubuntu fstab needs the following:

//192.168.1.1/No\040Spaces\040Please /mnt/P smbfs credentials=/etc/cifspw 0 0

Sunday 5 July 2009

Append column or array to numpy array

Troubles remembering this, as it is not a part of the array object, but a numpy function. Anyway, to append a column:

Make sure the array is two dimensional and of expected form:

a = a.reshape(len(a), 1)
b = numpy.append(a, a, axis = 1)

or, if the column to be added is currently looking row-like:

b = numpy.append(a, c.transpose(), axis = 1)


To append a row:
b = numpy.append(a, a, axis = 0)

Wednesday 1 July 2009

Two monitor ubuntu

sudo nvidia-xconfig --probe-all-gpus -a --twinview-orientation=Clone

worked. man nvidia-xconfig for other options. This was with two cards.

Now fiddle with ~/.fluxbox/init to change the behaviour of session.screen1

Interogating a linux machine

from http://www.linuxjournal.com/content/interrogating-linux-machine

ifconfig
ifconfig -a # network sans loopback

route -a # gateway check

cat /proc/cpuinfo # cpu

ls -lha /proc/kcore # memory

lspci # graphics

cat /proc/interrupts # problems with interupts?

fdisk -l /dev/?d? # HDD. DO NOT USE FDISK! 2TB MBR limits. use parted.

cat /proc/ide/hda/model # HDD model

cat /proc/filesystems # compatible filesystems

lsmod # drivers loaded

lsusb # usb devices

rpm -qa # rpm installed software
dpkg -l # another flavour

Thursday 25 June 2009

pgfplots axis scaling error



The 10^{-2} scaling label is incorrect and unasked for. Turn it off by:

\begin{axis}[scaled y ticks=false, 

Sunday 21 June 2009

Converting gzips to png and maybe cropping

The following routine was used to batch convert all \verb".gz" files in a
directory to .png. The format of the file inside the zipfile doesn't matter
as the conversion takes place automatically.

The routine is in \verb"ms.py"


import Image, gzip, os, StringIO

def unzip_file(filename):
fileObj = gzip.GzipFile(filename, 'rb');
fileContent = fileObj.read()
fileObj.close()
return(fileContent)

def gz2png():
# get the directory listing
files = os.listdir('.')

for i in files:
# import the zipfile
if '.gz' in i:
print i,
data = unzip_file(i)
# Convert this data into an image object.
im = Image.open(StringIO.StringIO(data))

# Use pil to convert to .png and save it for external compilation.
f2 = i.split('.')[0] + '.png'
im.save(f2)
print ' -> ', f2



To use, perform \verb">>> import imageconv; imageconv.convert()" in the
directory containing the files. A similar routine for converting to gif
exists by the name \verb"gz2gif". This routine is now in \verb"ms.py".

\protect to \cite in \caption

\protect before the \cite, fixes the problem.

a better way to mount usb drives.

Don't just sudo mount /dev/sdb /media/tmp

This mounts with root ownership. Rather,

sudo mount -o uid=username /dev/sdb /media/tmp

------------

Or in fstab:

/dev/sdb1 /home/me/mountpoint vfat gid=mylogin,dmask=007,fmask=117,rw 0 3

-----------

Friday 19 June 2009

CFD Codes

Dolfyn: K-Epsilon only, but appears well integrated with gmsh.
OpenFoam: Appears to support many turbulence models, including RSM. Not so well integrated with Gmsh, but well integrated with ParaView (?).

Thursday 18 June 2009

Installing Latex packages inc circuitikz and siunitx




Not conforming to standards but simple:
mkdir ~/downloads/latex/circuitikz


Navigate to:
circuitikz

Save all the files to
 ~/downloads/latex/circuitikz 


Make sure .bashrc contains:

# for latex packages, installed to ~/latex/:
export TEXINPUTS=/home/login/downloads/latex//:


Open a terminal and run:
 sudo texhash 


Test:

\ctikzset{bipoles/length = 1.4 cm} % careful of whitespace here with /, and when using 5: NO WHITESPACE!
\begin{circuitikz}[scale = 1.2]
\draw (0, 0) node[anchor = east] {B}
to[short, o-*] (1,0)
to [R=20<\ohm>, *-*] (1,2)
to [R=10<\ohm>, v=$v_{x}$] (3,2) -- (4,2)
to [cI = $\frac{\siemens}{5} v_{x}$, *-*] (4,0) -- (3,0)
to [R = 5<\ohm>, *-*] (3,2) % no whitespace between 5 and
(3,0) -- (1,0)
(1,2) to [short, -o] (0,2) node[anchor = east] {A};
\end{circuitikz}


Beware whitespaces (as noted). Do not use them between numbers and units, or the following error will occur:

! Package siunitx Error: Invalid character `20 ' in numerical input.

See the siunitx package documentation for explanation.
Type H for immediate help.
...

l.44 to [R=20 <\ohm>, *-*] (1,2)
^^M


Turns out, circuitikz required siunitx also, and the manual wasn't so helpful in that
only a .pdf was present, and copy/paste from the .pdf changed the * and - characters.

So, check http://home.dei.polimi.it/mredaelli/circuitikz/examples.html
for real examples but consider also, siunitx - if you were wondering why 1*10^{5} looks
so crap in tex!

Sunday 7 June 2009

ubuntu hangs on shutdown due to windows shares

https://help.ubuntu.com/community/MountWindowsSharesPermanently

shows this should be fixed with:

sudo update-rc.d -f umountnfs.sh remove
sudo update-rc.d umountnfs.sh stop 15 0 6 .

and it was!

Thursday 4 June 2009

PGFplots limits / nan problems

Plotting big numbers (> 1E6), is ok, as long as the axis
limits are not specified. If nan errors start cropping up,
remove the axis limit definitions.

The second axis, if used, can be defined by plotting the
data again; but plot using [color = white, only marks]

Or, add a new plot(s) with a single point(s), color = white,
to force pgfplots to extend the axis. Add these plots last,
and don't give 'em a legend entry.

Thursday 28 May 2009

Skype contact will not authorise

Some actions were taken. Skype worked. Who know's which ones are related...

I deleted and re-added the contact.
The contact deleted and re-added me.
I logged into Skype on another machine, repeated the process.
The sun set.
It rained.



Conclusion: Use a different IM client.

Wednesday 27 May 2009

colors in pgfplots.

Report order:

black
red
blue
green
cyan
orange
brown
violet
teal
magenta
yellow
gray
lime
pink
purple


from


red
green
blue
cyan
magenta
yellow
black
gray
white
darkgray
lightgray
brown
lime
olive
orange
pink
purple
teal
violet

Tuesday 26 May 2009

ubuntu upgrade broke network connectivity

ifconfig showed eth0 wasn't in the list.

From http://www.ubuntugeek.com/ubuntu-networking-configuration-using-command-line.html

sudo kile /etc/network/interfaces

Add the following (actually, this is all it was):

auto eth0
iface eth0 inet static
address 192.168.1.64
gateway 192.168.1.254
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255

Restart via:
sudo /etc/init.d/networking restart


The original attempt to get auto assignment failed.

Monday 25 May 2009

TOR, privoxy, ubuntu

from http://www.torproject.org/docs/tor-doc-unix.html.en

Add the repo to /etc/apt/sources.list

deb http://deb.torproject.org/torproject.org karmic main

Add the keys required:
gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -

Update and install:

apt-get update
apt-get install tor tor-geoipdb


------------- Old method --------------------------
sudo apt-get install tor
sudo apt-get install privoxy
sudo kile /etc/privoxy/config

Add:
forward-socks4a / 127.0.0.1:9050 .

to the top of the file, including the dot. Update:

logfile logfile -> # logfile logfile

Install torbutton, for firefox:

https://addons.mozilla.org/firefox/2275/

To Torify other applications that support HTTP proxies, just point them at Privoxy (that is, localhost port 8118)


--------------- new method (April 10) --------------

Install polipo (a caching web proxy)

Update its configuration by saving the following link as /etc/polipo/config :

https://svn.torproject.org/svn/torbrowser/trunk/build-scripts/config/polipo.conf

Try setting to root ownership and group, as the other files there are, too.

Restart polipo:

/etc/init.d/polipo restart

(Actually, that didn't work. A reset was required. Perhaps that should have been with sudo)
Install the tor button addin for firefox.

Booklet printing ubuntu

Create a .ps file, by printing to file.
$ psbook input.ps output.ps
$ evince output.ps ( or convert to pdf, using $ ps2pdf output.ps)

Print, 2 pages to a side, duplex, short edge binding.

Monday 18 May 2009

Mounting windows shares with smbfs

http://www.justlinux.com/nhf/Filesystems/Mounting_smbfs_Shares_Permanently.html

worked. Attempts with cifs failed.

Tuesday 12 May 2009

***ERROR*** IN D55025 MERGING COUPLING MATRIX

***ERROR*** IN D55025 MERGING COUPLING MATRIX
ROW CANNOT BE FOUND FOR FREEDOM 1711
AT NODE 1417 FACE -1417. -1416. -734.0
THE FLUID FREEDOMS CURRENTLY MERGED IN ARE

452.0 0.000 0.000 0.000 0.000
0.000 0.000 445.0 0.000 446.0
447.0 0.000 0.000 0.000 0.000

Occurred when changing a frontal.sinusoidal job, to natural frequencies.

I forgot to include COUPLED.ACOUSTICS in the control module. This was
an acoustics + structure + pzt job.

Monday 11 May 2009

jpgfdraw

Brilliant!

Wednesday 6 May 2009

***ERROR*** IN S60001

***ERROR*** IN S60001
NO RESULTS ARE REQUESTED FOR STORAGE
IN FRONTAL.TRANSIENT ANALYSIS

I added a little to the response module:
RESPONSE
TYPE TIME.STEP FINISH.TIME OUTPUT.TYPE LIST.OF.NODES.AND.DIRECTIONS
2 7E-7 6E-5 123 <'rsn1'> 2

The List of nodes and directions needed filling in.

Note: No masters should be present in a FRONTAL.TRANSIENT job. Also,
removal of LINKS.FOR.DYNAMICS enabled the solution to complete; otherwise, it fell over after many steps in phase 7.

Tuesday 5 May 2009

Accessing pressure results in PAFEC

Can't convince PAFEC to export pressure at a node? Is it failing in Phase 4, complaining that a node isn't structural and so can't be included in SINUSOIDAL.OUTPUT?

Remove the SINUSOIDAL.OUTPUT module altogether. Results at all nodes will be printed in phase 7.

Cheers Patrick!

Sunday 3 May 2009

.flv playback, ubuntu

First, try gxine. If that fails.....

From http://ubuntuforums.org/showthread.php?t=484750

How to enable lame for FFMPEG (needed to encode FLV with sound)

KINO FLVs silent? You need to recompile FFMPEG with LAME enabled. FFMPEG can be installed via apt-get as a package, but is not able encode MP3, which is the audio stream in FLV video (like Google & YouTube).

* Ensure Ubuntu Universe repository is selected #How to add extra repositories
* Download and install lame liblame-dev and gcc packages (mp3 encoder + GNU compiler collection)

sudo apt-get build-dep ffmpeg
sudo apt-get install liblame-dev libfaad2-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 \
liba52-0.7.4-dev libx264-dev libdts-dev libgsm1-dev libvorbis-dev libdc1394-13-dev \
checkinstall build-essential gcc

libfaac didnt work for me.

* Download and extract FFMPEG source to current working directory

cd /usr/local/src
sudo apt-get source ffmpeg

* Compile FFMPEG from source

cd ffmpeg-*
NOT THIS ONE:
sudo ./configure --enable-gpl --enable-pp --enable-vorbis --enable-libogg \
--enable-a52 --enable-dts --enable-dc1394 --enable-libgsm --disable-debug \
--enable-mp3lame --enable-faad --enable-faac --enable-xvid --enable-pthreads \
--enable-x264

THIS ONE, without faad
maybe try instead =
sudo ./configure --enable-gpl --enable-pp --enable-libvorbis --enable-libogg \
--enable-liba52 --enable-libdts --enable-dc1394 --enable-libgsm --disable-debug \
--enable-libmp3lame --enable-libfaad --enable-libfaac --enable-xvid --enable-pthreads \
--enable-x264


sudo make
sudo checkinstall [accept defaults, set version to 3:0.cvs20060823-3.1ubuntu2]

If during the make it dies at 'x264.c:147: error: `struct ` has no member name `i_rf_constant` you need to do the following. Open libavcodec/x264.c and goto line 147. Change 'i_rf_constant' to 'f_rf_constant' and retry.

If an application you are using employs FFMPEG to encode FLV, it should now work properly. You can also call FFMPEG directly from the command line. The extension/suffix of the outfile tells FFMPEG which audio or video format to encode to.

ffmpeg [-i infile] [outfile]



Then, i removed xine-ui, downloaded the xine core stuff, ./configured, added an LD_LIBRARY_PATH
to .bashrc (as suggested at the end of the ./configure)

Added include /usr/local/lib to ld.so.conf


sudo make install

sudo ldconfig

wget http://prdownloads.sourceforge.net/xine/xine-ui-0.99.5.tar.gz
tar xzf xine-ui
cd xine-ui
./configure
sudo make install

then i couldnt run it, so bottled the process with:

sudo apt-get install xine-ui

and still, no .flv playback, ffs


and then, somehow, gxine worked! Odd.

Friday 24 April 2009

PAFEC error collection

**ERROR** FAILURE IN SUBROUTINE R09895
ATTEMPT TO ACCESS SWITCH21883 IN MODULE 113
BUT THIS MODULE ONLY CONTAINS10008 SWITCHES

This occurred when PAFBLOCKS were used with node numbers
that did not exist (the referenced nodes were of very large values)

-----------------------------------------

ERROR IN CALL TO R09895
SWITCHES MODULE 2058 IS NOT IN BASE

fixed by:

adding FRONTAL.SINUSOIDAL.SOLUTION

------------------------------------

*** ERROR *** THERE ARE 0 DEGREES OF FREEDOM THIS IS INSUFFICIENT FOR A VIBRATION/BUCKLING PROBLEM.

This occurred with a PZT / acoustic simulation. Viewing node numbers to check which node
to apply a voltage to, showed the acoustic node numbers only, with default settings.
I set direction 4 on the acoustic node, with the result that no meaningful boundary condition was
set.

Mesh parts, structure showed a different node number. Changing to this number fixed the error.

--------------------------------------

*** ERROR *** THE INSTANTANEOUS SIZE SO FAR CALCULATED, IS 9999.
THIS IS GREATER THAN THE MAXIMUM 9998

in Phase 4. Big job. Fixed by adding,

PHASE=4
MAX.FS.RECORD=100000

to the control module. Default size is 10,000

-----------------------------

Phase 4: Acoustic FE with BE.

 ***ERROR*** IN R25875
 SAME NODE IN BOTH ACOUSTIC BOUNDARY
 AND FINITE ELEMENT TOPOLOGIES
 NODE 101 B.E. 1 F.E. 51
 NODE 105 B.E. 1 F.E. 50
 NODE 105 B.E. 1 F.E. 51

Set the BE to group 1, the acoustic FE to group 2 and do:

COLLAPSE
GR1 GR2 COUP
1 2 3

to separate the nodes.

-----------------------------

***ERROR*** IN ROUTINE R25868
NO COUPLING FOR FLUID BOUNDARY ELEMENT FACE
111 112 113

Occurred with CONTROL module option,

TOLERANCE=10E-12

Changing to

TOLERANCE=10E-6

fixed this.

----------------------------------
Phase 7

CHANGE IN DEFINE RESPONSE
AT TIME 0.0000000E+00 FOR DOF 43
0 *** A BLOCKED FRONT SOLUTION HAS BEEN REQUESTED ***
0 THE BLOCK SIZE IS 891112
***ERROR***
FAILURE IN R09810
THERE ARE NO SCRATCH MODULES AVAILABLE


A result of leaving MASTERS in a FRONTAL.TRANSIENT analysis.

-------------------------------

Phase 4.

**ERROR** FAILURE IN SUBROUTINE R09895
 ATTEMPT TO ACCESS SWITCH   71 IN MODULE  177
 BUT THIS MODULE ONLY CONTAINS    0 SWITCHES

This was a thermal job.  I left SINE.LOADING, RESPONSE, FRONTAL.SINUSOIDAL.SOLUTION, COMPLEX.SOLUTION, VISCOELASTIC in.  The error changed to,


 **ERROR** FAILURE IN SUBROUTINE R09895
 ATTEMPT TO ACCESS SWITCH   25 IN MODULE  113
 BUT THIS MODULE ONLY CONTAINS   12 SWITCHES

Removed HARMONIC.NUMBER=0.  No change.
Removed LAMINATES and ORTHOTROPIC modules: Nope.
Removed PIEZOELECTRIC module.  Nope.
Removed FREQUENCIES.FOR.ANALYSIS.  Nope.
Removed MODES.AND.FREQUENCIES.  Nope.
Removed FULL.DYNAMICS.OUTPUT.  Nope.
Redefine MATERIALS for thermal:  Nope.
Added a different temperature elsewhere in the model.  Bingo.

---------------------------------


Tuesday 31 March 2009

To get:

Effect of flow on the acoustic resonances of an open-ended duct
J. Acoust. Soc. Am. Volume 58, Issue 4, pp. 788-793 (October 1975)
Issue Date: October 1975

Acoustic waves in ducts with sinusoidally perturbed walls and mean flow
Nayfeh, A. H.
Acoustical Society of America, Journal, vol. 57, May 1975, p. 1036-1039.

Title:
Standing acoustic waves in a low Mach number shear flow
Authors:
Wang, Meng; Kassoy, David R.

@ARTICLE{art:Yeh64,
author = "Y. Yeh and H. Z. Cummins",
title = "Localised flow measurements with an He-Ne laser spectrometer",
journal = "Applied Physics Letters",
year = "1964",
volume = "4",
pages = "176",
note = "I can't get this one online",
}

DIsplay elements / polar setup, PAFEC




Copy the Python code into an interpreter, execute it. Copy the output to a NODES
section. First the display, then, an uncoupled BE, over a circular region, raised slightly from
z=0.


c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c DISPLAY
c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c Python script for node generation.
c from math import *
c def n():
c r, o, n0 = 0.025, [0, 0, 2E-3], 100 # radius, origin, 0th node.
c for i in xrange(360 + 1):
c x = o[0] + r * cos(0.5 * i * 2 * pi / 360)
c y = o[1] + 0
c z = o[2] + r * sin(0.5 * i * 2 * pi / 360)
c print n0 + i, x, y, z
c print n0 + i + 1, o[0] + r / 2, o[1], o[2]
c print n0 + i + 2, o[0] + r / 2, o[1], o[2] + r / 2
c print n0 + i + 3, o[0] + 0 / 2, o[1], o[2] + r / 2
c print n0 + i + 4, o[0] - r / 2, o[1], o[2] + r / 2
c print n0 + i + 5, o[0] - r / 2, o[1], o[2]
c print n0 + i + 6, o[0], o[1], o[2]
c print

c for i in xrange(360 + 1):
c x = o[0] + 0
c y = o[1] + r * cos(0.5 * i * 2 * pi / 360)
c z = o[2] + r * sin(0.5 * i * 2 * pi / 360)
c print 400 + n0 + i, x, y, z
c print 400 + n0 + i + 1, o[0], o[1] + r / 2, o[2]
c print 400 + n0 + i + 2, o[0], o[1] + r / 2, o[2] + r / 2
c print 400 + n0 + i + 3, o[0], o[1] + 0 / 2, o[2] + r / 2
c print 400 + n0 + i + 4, o[0], o[1] - r / 2, o[2] + r / 2
c print 400 + n0 + i + 5, o[0], o[1] - r / 2, o[2]
c print 400 + n0 + i + 6, o[0], o[1], o[2]
c print

c for i in xrange(360 + 1):
c x = o[0] + r * cos(0.5 * i * 2 * pi / 360)
c y = o[1] + r * sin(0.5 * i * 2 * pi / 360)
c z = o[2] + 0
c print 800 + n0 + i, x, y, z
c print 800 + n0 + i + 1, o[0] + r / 2, o[1], o[2]
c print 800 + n0 + i + 2, o[0] + r / 2, o[1] + r / 2, o[2]
c print 800 + n0 + i + 3, o[0] + 0 / 2, o[1] + r / 2, o[2]
c print 800 + n0 + i + 4, o[0] - r / 2, o[1] + r / 2, o[2]
c print 800 + n0 + i + 5, o[0] - r / 2, o[1], o[2]
c print 800 + n0 + i + 6, o[0], o[1], o[2]


PAFBLOCKS
BLOCK GROUP ELEMENT.TYPE PROP N1 N2 TOPO
1 1 24720 11 <'dm'> <'dm'> 462 190 461 100 0 0 145
2 1 24720 11 <'dm'> <'dm'> 280 190 463 462 235
3 1 24720 11 <'dm'> <'dm'> 370 280 464 463 325
4 1 24720 11 <'dm'> <'dm'> 370 464 460 465 0 415
5 1 24720 11 <'dm'> <'dm'> 463 462 466 461
6 1 24720 11 <'dm'> <'dm'> 464 463 465 466

7 2 24720 11 <'dm'> <'dm'> <462+400> <190+400> <461+400> <100+400> 0 0 <145+400>
8 2 24720 11 <'dm'> <'dm'> <280+400> <190+400> <463+400> <462+400> <235+400>
9 2 24720 11 <'dm'> <'dm'> <370+400> <280+400> <464+400> <463+400> <325+400>
10 2 24720 11 <'dm'> <'dm'> <370+400> <464+400> <460+400> <465+400> 0 <415+400>
11 2 24720 11 <'dm'> <'dm'> <463+400> <462+400> <466+400> <461+400>
12 2 24720 11 <'dm'> <'dm'> <464+400> <463+400> <465+400> <466+400>

c 13 3 24720 11 <'xm'> <'xm'> <462+800> <190+800> <461+800> <100+800> 0 0 <145+800>
c 14 3 24720 11 <'xm'> <'xm'> <280+800> <190+800> <463+800> <462+800> <235+800>
c 15 3 24720 11 <'xm'> <'xm'> <370+800> <280+800> <464+800> <463+800> <325+800>
c 16 3 24720 11 <'xm'> <'xm'> <370+800> <464+800> <460+800> <465+800> 0 <415+800>
c 17 3 24720 11 <'xm'> <'xm'> <463+800> <462+800> <466+800> <461+800>
c 18 3 24720 11 <'xm'> <'xm'> <464+800> <463+800> <465+800> <466+800>

c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c BE
c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c r, z0 = 4.75E-3, 1E-3
c def n2():
c for i in xrange(17):
c print i+1, r * cos (i/16. * 2 * pi), r * sin (i/16. * 2 * pi), z0
c print 17, r/2, 0, z0
c print 18, r/2, r/2, z0
c print 19, 0, r/2, z0
c print 20, -r/2, r/2, z0
c print 21, -r/2, 0, z0
c print 22, -r/2, -r/2, z0
c print 23, 0, -r/2, z0
c print 24, r/2, -r/2, z0
c print 25, 0, 0, z0
c for i in xrange(31, 46 + 1):
c print i, r * cos ((i - 31) / 16. * 2 * pi), r * sin ((i - 31) / 16. * 2 * pi), 0



PAFBLOCKS
BOUNDARY.ELEMENT = 1000
GROUP ELEMENT.TYPE PROP N1 N2 TOPO
c top face
4 24620 11 <'xm'> <'xm'> 18 3 17 1 0 0 2
4 24620 11 <'xm'> <'xm'> 5 3 19 18 4
4 24620 11 <'xm'> <'xm'> 7 5 20 19 6
4 24620 11 <'xm'> <'xm'> 7 20 9 21 0 8
4 24620 11 <'xm'> <'xm'> 9 21 11 22 0 10
4 24620 11 <'xm'> <'xm'> 22 23 11 13 0 0 0 12
4 24620 11 <'xm'> <'xm'> 23 24 13 15 0 0 0 14
4 24620 11 <'xm'> <'xm'> 17 1 24 15 0 0 16
4 24620 11 <'xm'> <'xm'> 19 18 25 17
4 24620 11 <'xm'> <'xm'> 20 19 21 25
4 24620 11 <'xm'> <'xm'> 21 25 22 23
4 24620 11 <'xm'> <'xm'> 25 17 23 24
c side face
4 24620 11 <'xm'> 1 1 3 31 33 2 0 0 32
4 24620 11 <'xm'> 1 <1+1*2> <3+1*2> <31+1*2> <33+1*2> <2+1*2> 0 0 <32+1*2>
4 24620 11 <'xm'> 1 <1+2*2> <3+2*2> <31+2*2> <33+2*2> <2+2*2> 0 0 <32+2*2>
4 24620 11 <'xm'> 1 <1+3*2> <3+3*2> <31+3*2> <33+3*2> <2+3*2> 0 0 <32+3*2>
4 24620 11 <'xm'> 1 <1+4*2> <3+4*2> <31+4*2> <33+4*2> <2+4*2> 0 0 <32+4*2>
4 24620 11 <'xm'> 1 <1+5*2> <3+5*2> <31+5*2> <33+5*2> <2+5*2> 0 0 <32+5*2>
4 24620 11 <'xm'> 1 <1+6*2> <3+6*2> <31+6*2> <33+6*2> <2+6*2> 0 0 <32+6*2>
4 24620 11 <'xm'> 1 <1+7*2> 1 <31+7*2> 31 <2+7*2> 0 0 <32+7*2>






An alternative approach is to get PAFEC to generate the
nodes, and use triangles.



c polar extraction. Define three nodes, for arc definition. 1 node per dgree.
NODES
NODE AXIS X Y
300 3 0.018 0 c on axis.
345 3 0.018 45
390 3 0.018 90 c 90 degrees off axis
391 3 0.000 0 c on axis, 0 radius, for display elements.
ARC.NODES
LIST.OF.NODES.ON.ARC
300 301 302 303 304 305 306 307 308 309
* 310 311 312 313 314 315 316 317 318 319
* 320 321 322 323 324 325 326 327 328 329
* 330 331 332 333 334 335 336 337 338 339
* 340 341 342 343 344 345 346 347 348 349
* 350 351 352 353 354 355 356 357 358 359
* 360 361 362 363 364 365 366 367 368 369
* 370 371 372 373 374 375 376 377 378 379
* 380 381 382 383 384 385 386 387 388 389
* 390

c observation elements.
PAFBLOCKS
BLOCK TYPE GROUP ELEMENT PROP N1 N2 N3 TOPO
56 2 7 24710 13 15 15 15 391 300 390 0 345

Monday 30 March 2009

translating nodes in PAFEC

Given a data file, with nodes defined:


a = file('ct1b.DAT')
b = a.readlines()
c = b[36:500] # only node entries
d = [i.strip('\n').split(' ') for i in c]
e = []
for i in d:
tmp = [float(j) for j in i]
e.append(tmp)
f = array(e)
f[:, 2] = f[:, 2] + 0.001 # apply offset
for i in f:
print str(i).strip('[]') # copy and paste.

Thursday 26 March 2009

Formatting in this blog

Leading spaces tend to be lost. Add < p r e > to the start, and < / p r e > to the end, to preserve them.

Python scripts called from $

An example:


import sys
if __name__ == '__main__':
# Executed, only if called from command line.
args = sys.argv

if len(args) == 1:
print 'No argument specified. call as filename.py '
exit()
else:
print 'Argument(s) provided: ', args

Tuesday 24 March 2009

PGFplots error bars.


\documentclass{article}
\usepackage{pgfplots}
%
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\begin{axis}
\addplot plot[error bars/.cd,
y dir=both, y explicit,
x dir=both, x explicit]
coordinates {
(0,0) +- (0.5, 0.1)
(1,1) +- (0.2, 0.3)
};
\end{axis}
\end{tikzpicture}

\end{document}

Building Engrid on Ubuntu Hardy

from https://sourceforge.net/mailarchive/forum.php?forum_name=engrid-users&max_rows=100&style=nested&viewmonth=200903&viewday=3

First, make sure you have the build dependencies:
/================
sudo apt-get install libvtk5 libvtk5-dev libvtk5-qt4 libvtk5-qt4-dev
libqt4-dev
================
/
Second, if you have qt3 dev files installed too, there might be a
conflict with qmake-qt3. So just run one of the following commands:
(I used the second command on my laptop. I'm not sure if the first one
works, but it should based on what I've read.)
/================
update-alternatives --install /usr/bin/qmake qmake "/usr/bin/qmake-qt4"
"50" --slave /usr/share/man/man1/qmake.1.gz qmake.1.gz
"/usr/share/man/man1/qmake-qt4.1.gz"
================
/or
/================
ln -sf /usr/bin/qmake-qt4 /usr/bin/qmake
================
/
To make sure the rest will work, check that /usr/bin/qmake is a link to
/usr/bin/qmake-qt4:
/================
[29][~]$ ls -l /usr/bin/qmake
lrwxrwxrwx 1 root root 18 Mar 3 12:04 /usr/bin/qmake -> /usr/bin/qmake-qt4
================
/
Check out the CVS:
/================
cvs -d:pserver:anonymous@en...:/cvsroot/engrid login
cvs -d:pserver:anonymous@en...:/cvsroot/engrid co src
cd src
================
/
Then you'll need to set up the environment before running qmake:
/================
export VTKLIBDIR=/usr/lib/
export VTKINCDIR=/usr/include/vtk-5.0/
export LD_LIBRARY_PATH=$VTKLIBDIR:$LD_LIBRARY_PATH
================
/I wrote a convenience script for this, which you can use instead if you
wish:
/================
source ./setup_paths.sh ubuntu
================
/
And finally, build netgen and engrid:
/================
./build-nglib.sh
qmake
make
================
/


Following an email from Oliver Gloth, I needed to re-compile. I did this,
as:
-----------------------
export VTKLIBDIR=/usr/lib/
export VTKINCDIR=/usr/include/vtk-5.0/
export LD_LIBRARY_PATH=$VTKLIBDIR:$LD_LIBRARY_PATH

and in ~/downloads/newengrid/src/

make clean
qmake
make

Sunday 22 March 2009

To get:

@ARTICLE{art:Schewe,
AUTHOR = "G. Schewe",
TITLE = "On the force oscillations acting on a circular cylinder in
crossflow from subcritical up to transcritical Reynolds numbers",
YEAR = "1983",
JOURNAL = "J. Fluid Mech",
VOLUME = "133",
PAGES = "265--285",
NOTES = "From art:Travin. Domain length. Couldn't get this, paper copy?",
}

Monday 16 March 2009

String table to list

a = file('filename')
b = a.readlines()
c = b[3:86] # extract relevant rows

# list of lists, assuming space separated values, stripping
# empty strings.

d = [[j for j in i.split(' ') if j != ''] for i in c] # lists of strings
d = [[float(j) for j in i.split(' ') if j != ''] for i in c] # lists of floats

d can be converted to an array, if desired. :)

Wednesday 11 March 2009

list - continuous file cat

#!/bin/bash
# Display the file provided as filename, every second.
while [ 1 ]
do
clear
cat $1
sleep 1
done

Wednesday 4 March 2009

Superimposed plots.



I was so amazed by this accident, I noted it:

\begin{figure}[htbp]\begin{center} % pressure vs x.

\mbox{
%\hspace{-1.5cm}
\tikzstyle{every axis legend}+= [at={(0.98,0.02)},anchor=south east] % im is 0,0 to 1,1
\begin{tikzpicture}
\begin{semilogyaxis}[width=\hplotw,height=\ploth,
ymin = 30, ymax = 300000,
xlabel={$x/l$}, ylabel={$|p|$},grid=major]

% Peak search, so use last entry:
% m95acoub3 = mfile.File('m95acoub3.res'); m95acoub3.load()
% m95acoub5 = mfile.File('m95acoub5.res'); m95acoub5.load()
% r1 = m95acoub3.calc_PvX(findex=[-2 + -1*1j], y = -0.005, z = 0)
% r2 = m95acoub5.calc_PvX(findex=[-2 + -1*1j], y = 0, z = 0)
% tmp = reference.dumptex(r1[0] / 0.05, abs(r1[1]))
% tmp = reference.dumptex(r2[0] / 0.05, abs(r2[1]))
% 0 flow:
\addplot[color = black] plot coordinates {(-5.00000e-01,4.68522e+03) (-4.87180e-01,6.14709e+03) (-4.74360e-01,7.63048e+03) (-4.61540e-01,9.06362e+03) (-4.48720e-01,1.04245e+04) (-4.35900e-01,1.17104e+04) (-4.23080e-01,1.29284e+04) (-4.10260e-01,1.40937e+04) (-3.97440e-01,1.52292e+04) (-3.84620e-01,1.63611e+04) (-3.71800e-01,1.75145e+04) (-3.58980e-01,1.87069e+04) (-3.46160e-01,1.99447e+04) (-3.33340e-01,2.12216e+04) (-3.20520e-01,2.25230e+04) (-3.07700e-01,2.38275e+04) (-2.94880e-01,2.51120e+04) (-2.82060e-01,2.63557e+04) (-2.69240e-01,2.75383e+04) (-2.56420e-01,2.86456e+04) (-2.43580e-01,2.96665e+04) (-2.30760e-01,3.05936e+04) (-2.17940e-01,3.14303e+04) (-2.05120e-01,3.21815e+04) (-1.92300e-01,3.28633e+04) (-1.79480e-01,3.34925e+04) (-1.66660e-01,3.40869e+04) (-1.53840e-01,3.46601e+04) (-1.41020e-01,3.52191e+04) (-1.28200e-01,3.57652e+04) (-1.15380e-01,3.62941e+04) (-1.02560e-01,3.67997e+04) (-8.97400e-02,3.72757e+04) (-7.69200e-02,3.77161e+04) (-6.41000e-02,3.81118e+04) (-5.12800e-02,3.84556e+04) (-3.84600e-02,3.87364e+04) (-2.56400e-02,3.89444e+04) (-1.28200e-02,3.90741e+04) (0.00000e+00,3.91589e+04) (1.28200e-02,3.90741e+04) (2.56400e-02,3.89444e+04) (3.84600e-02,3.87364e+04) (5.12800e-02,3.84556e+04) (6.41000e-02,3.81118e+04) (7.69200e-02,3.77161e+04) (8.97400e-02,3.72757e+04) (1.02560e-01,3.67997e+04) (1.15380e-01,3.62941e+04) (1.28200e-01,3.57652e+04) (1.41020e-01,3.52191e+04) (1.53840e-01,3.46601e+04) (1.66660e-01,3.40869e+04) (1.79480e-01,3.34925e+04) (1.92300e-01,3.28633e+04) (2.05120e-01,3.21815e+04) (2.17940e-01,3.14303e+04) (2.30760e-01,3.05936e+04) (2.43580e-01,2.96665e+04) (2.56420e-01,2.86456e+04) (2.69240e-01,2.75383e+04) (2.82060e-01,2.63557e+04) (2.94880e-01,2.51120e+04) (3.07700e-01,2.38275e+04) (3.20520e-01,2.25230e+04) (3.33340e-01,2.12216e+04) (3.46160e-01,1.99447e+04) (3.58980e-01,1.87069e+04) (3.71800e-01,1.75145e+04) (3.84620e-01,1.63611e+04) (3.97440e-01,1.52292e+04) (4.10260e-01,1.40937e+04) (4.23080e-01,1.29284e+04) (4.35900e-01,1.17104e+04) (4.48720e-01,1.04245e+04) (4.61540e-01,9.06362e+03) (4.74360e-01,7.63048e+03) (4.87180e-01,6.14709e+03) (5.00000e-01,4.68522e+03)};
\addplot[color = red] plot coordinates {(-5.00000e-01,3.32899e+02) (-4.87180e-01,3.99514e+02) (-4.74360e-01,4.43786e+02) (-4.61540e-01,4.56559e+02) (-4.48720e-01,4.35594e+02) (-4.35900e-01,3.85809e+02) (-4.23080e-01,3.19156e+02) (-4.10260e-01,2.58352e+02) (-3.97440e-01,2.36882e+02) (-3.84620e-01,2.68063e+02) (-3.71800e-01,3.22661e+02) (-3.58980e-01,3.67617e+02) (-3.46160e-01,3.83471e+02) (-3.33340e-01,3.60929e+02) (-3.20520e-01,2.98806e+02) (-3.07700e-01,2.07038e+02) (-2.94880e-01,1.35031e+02) (-2.82060e-01,2.02836e+02) (-2.69240e-01,3.54802e+02) (-2.56420e-01,5.19014e+02) (-2.43580e-01,6.72321e+02) (-2.30760e-01,8.02972e+02) (-2.17940e-01,9.05292e+02) (-2.05120e-01,9.78824e+02) (-1.92300e-01,1.02744e+03) (-1.79480e-01,1.05767e+03) (-1.66660e-01,1.07661e+03) (-1.53840e-01,1.09065e+03) (-1.41020e-01,1.10627e+03) (-1.28200e-01,1.13312e+03) (-1.15380e-01,1.18722e+03) (-1.02560e-01,1.28987e+03) (-8.97400e-02,1.45928e+03) (-7.69200e-02,1.70049e+03) (-6.41000e-02,2.00269e+03) (-5.12800e-02,2.34454e+03) (-3.84600e-02,2.70219e+03) (-2.56400e-02,3.06038e+03) (-1.28200e-02,3.41724e+03) (0.00000e+00,4.35428e+03) (1.28200e-02,3.46603e+03) (2.56400e-02,3.23861e+03) (3.84600e-02,3.04073e+03) (5.12800e-02,2.82875e+03) (6.41000e-02,2.58640e+03) (7.69200e-02,2.31553e+03) (8.97400e-02,2.02851e+03) (1.02560e-01,1.74376e+03) (1.15380e-01,1.47984e+03) (1.28200e-01,1.25361e+03) (1.41020e-01,1.08218e+03) (1.53840e-01,9.89661e+02) (1.66660e-01,1.00326e+03) (1.79480e-01,1.12870e+03) (1.92300e-01,1.33752e+03) (2.05120e-01,1.58679e+03) (2.17940e-01,1.83747e+03) (2.30760e-01,2.06103e+03) (2.43580e-01,2.23955e+03) (2.56420e-01,2.36536e+03) (2.69240e-01,2.43945e+03) (2.82060e-01,2.46702e+03) (2.94880e-01,2.45381e+03) (3.07700e-01,2.40274e+03) (3.20520e-01,2.31495e+03) (3.33340e-01,2.19285e+03) (3.46160e-01,2.04782e+03) (3.58980e-01,1.90509e+03) (3.71800e-01,1.80440e+03) (3.84620e-01,1.78480e+03) (3.97440e-01,1.85723e+03) (4.10260e-01,1.99089e+03) (4.23080e-01,2.13114e+03) (4.35900e-01,2.22497e+03) (4.48720e-01,2.23423e+03) (4.61540e-01,2.13874e+03) (4.74360e-01,1.93600e+03) (4.87180e-01,1.64131e+03) (5.00000e-01,1.30148e+03)};

\legend{non-flared\\flared\\}

\end{semilogyaxis} %\end{tikzpicture}% }

% \tikzstyle{every axis legend}+= [at={(0.02,0.02)},anchor=north west] % im is 0,0 to 1,1
% \begin{tikzpicture}

\begin{axis}[
axis x line=middle,
axis y line=right,
width=\hplotw,height=\ploth,
xlabel={$x/l$},
ylabel={$\theta$},grid=major,
ytick ={-3.14, -1.57, 1.57, 3.14},
yticklabels={$-\pi$, $-\frac{\pi}{2}$, $\frac{\pi}{2}$ , $\pi$},
ymin=-3.14, ymax=3.14]

% use code above, but with reference.ang() instead of abs()
% tmp = reference.dumptex(r1[0] / 0.05, reference.ang(r1[1]))
% tmp = reference.dumptex(r2[0] / 0.05, reference.ang(r2[1]))

\addplot[color = black] plot coordinates {(-5.00000e-01,-2.35766e+00) (-4.87180e-01,-2.06355e+00) (-4.74360e-01,-1.96624e+00) (-4.61540e-01,-1.91584e+00) (-4.48720e-01,-1.88530e+00) (-4.35900e-01,-1.86182e+00) (-4.23080e-01,-1.83907e+00) (-4.10260e-01,-1.81398e+00) (-3.97440e-01,-1.78565e+00) (-3.84620e-01,-1.75475e+00) (-3.71800e-01,-1.72302e+00) (-3.58980e-01,-1.69275e+00) (-3.46160e-01,-1.66619e+00) (-3.33340e-01,-1.64511e+00) (-3.20520e-01,-1.63043e+00) (-3.07700e-01,-1.62221e+00) (-2.94880e-01,-1.61967e+00) (-2.82060e-01,-1.62138e+00) (-2.69240e-01,-1.62554e+00) (-2.56420e-01,-1.63023e+00) (-2.43580e-01,-1.63363e+00) (-2.30760e-01,-1.63427e+00) (-2.17940e-01,-1.63116e+00) (-2.05120e-01,-1.62398e+00) (-1.92300e-01,-1.61300e+00) (-1.79480e-01,-1.59916e+00) (-1.66660e-01,-1.58387e+00) (-1.53840e-01,-1.56879e+00) (-1.41020e-01,-1.55562e+00) (-1.28200e-01,-1.54576e+00) (-1.15380e-01,-1.54012e+00) (-1.02560e-01,-1.53894e+00) (-8.97400e-02,-1.54179e+00) (-7.69200e-02,-1.54763e+00) (-6.41000e-02,-1.55491e+00) (-5.12800e-02,-1.56180e+00) (-3.84600e-02,-1.56638e+00) (-2.56400e-02,-1.56653e+00) (-1.28200e-02,-1.56033e+00) (0.00000e+00,-1.52345e+00) (1.28200e-02,-1.56033e+00) (2.56400e-02,-1.56653e+00) (3.84600e-02,-1.56638e+00) (5.12800e-02,-1.56180e+00) (6.41000e-02,-1.55491e+00) (7.69200e-02,-1.54763e+00) (8.97400e-02,-1.54179e+00) (1.02560e-01,-1.53894e+00) (1.15380e-01,-1.54012e+00) (1.28200e-01,-1.54576e+00) (1.41020e-01,-1.55562e+00) (1.53840e-01,-1.56879e+00) (1.66660e-01,-1.58387e+00) (1.79480e-01,-1.59916e+00) (1.92300e-01,-1.61300e+00) (2.05120e-01,-1.62398e+00) (2.17940e-01,-1.63116e+00) (2.30760e-01,-1.63427e+00) (2.43580e-01,-1.63363e+00) (2.56420e-01,-1.63023e+00) (2.69240e-01,-1.62554e+00) (2.82060e-01,-1.62138e+00) (2.94880e-01,-1.61967e+00) (3.07700e-01,-1.62221e+00) (3.20520e-01,-1.63043e+00) (3.33340e-01,-1.64511e+00) (3.46160e-01,-1.66619e+00) (3.58980e-01,-1.69275e+00) (3.71800e-01,-1.72302e+00) (3.84620e-01,-1.75475e+00) (3.97440e-01,-1.78565e+00) (4.10260e-01,-1.81398e+00) (4.23080e-01,-1.83907e+00) (4.35900e-01,-1.86182e+00) (4.48720e-01,-1.88530e+00) (4.61540e-01,-1.91584e+00) (4.74360e-01,-1.96624e+00) (4.87180e-01,-2.06355e+00) (5.00000e-01,-2.35766e+00)};
\addplot[color = red] plot coordinates {(-5.00000e-01,-2.39191e+00) (-4.87180e-01,-1.97905e+00) (-4.74360e-01,-1.76609e+00) (-4.61540e-01,-1.59365e+00) (-4.48720e-01,-1.42560e+00) (-4.35900e-01,-1.22937e+00) (-4.23080e-01,-9.60545e-01) (-4.10260e-01,-5.52966e-01) (-3.97440e-01,3.70743e-03) (-3.84620e-01,5.21654e-01) (-3.71800e-01,8.75260e-01) (-3.58980e-01,1.11347e+00) (-3.46160e-01,1.29731e+00) (-3.33340e-01,1.46845e+00) (-3.20520e-01,1.67124e+00) (-3.07700e-01,2.01168e+00) (-2.94880e-01,2.86206e+00) (-2.82060e-01,-2.38036e+00) (-2.69240e-01,-1.95842e+00) (-2.56420e-01,-1.74308e+00) (-2.43580e-01,-1.58899e+00) (-2.30760e-01,-1.45615e+00) (-2.17940e-01,-1.33003e+00) (-2.05120e-01,-1.20522e+00) (-1.92300e-01,-1.08143e+00) (-1.79480e-01,-9.62879e-01) (-1.66660e-01,-8.57926e-01) (-1.53840e-01,-7.78091e-01) (-1.41020e-01,-7.35771e-01) (-1.28200e-01,-7.40577e-01) (-1.15380e-01,-7.93814e-01) (-1.02560e-01,-8.82979e-01) (-8.97400e-02,-9.83297e-01) (-7.69200e-02,-1.07004e+00) (-6.41000e-02,-1.12958e+00) (-5.12800e-02,-1.15916e+00) (-3.84600e-02,-1.16048e+00) (-2.56400e-02,-1.13204e+00) (-1.28200e-02,-1.07213e+00) (0.00000e+00,-8.08752e-01) (1.28200e-02,-1.18037e+00) (2.56400e-02,-1.35573e+00) (3.84600e-02,-1.49900e+00) (5.12800e-02,-1.61245e+00) (6.41000e-02,-1.70161e+00) (7.69200e-02,-1.76987e+00) (8.97400e-02,-1.82208e+00) (1.02560e-01,-1.86644e+00) (1.15380e-01,-1.91748e+00) (1.28200e-01,-1.99847e+00) (1.41020e-01,-2.13984e+00) (1.53840e-01,-2.36301e+00) (1.66660e-01,-2.64648e+00) (1.79480e-01,-2.92612e+00) (1.92300e-01,3.12351e+00) (2.05120e-01,2.93364e+00) (2.17940e-01,2.76916e+00) (2.30760e-01,2.61402e+00) (2.43580e-01,2.45740e+00) (2.56420e-01,2.29278e+00) (2.69240e-01,2.11678e+00) (2.82060e-01,1.92846e+00) (2.94880e-01,1.72840e+00) (3.07700e-01,1.51731e+00) (3.20520e-01,1.29426e+00) (3.33340e-01,1.05504e+00) (3.46160e-01,7.91544e-01) (3.58980e-01,4.94245e-01) (3.71800e-01,1.60178e-01) (3.84620e-01,-1.94055e-01) (3.97440e-01,-5.32686e-01) (4.10260e-01,-8.25365e-01) (4.23080e-01,-1.06481e+00) (4.35900e-01,-1.26019e+00) (4.48720e-01,-1.42583e+00) (4.61540e-01,-1.57719e+00) (4.74360e-01,-1.73328e+00) (4.87180e-01,-1.92784e+00) (5.00000e-01,-2.31238e+00) };

% share the legend with the previous plot.
%\legend{non-flared\\flared\\}


\end{axis} \end{tikzpicture}

}
\caption{blah blah}
\label{fig:m95acou4b_pvx} \end{center} \end{figure}



Dual axis:





\begin{figure}[htbp]\begin{center}
%$ phd
%import mfile
%a = mfile.catFile('axibal8f.n100pre', f0=30000, f1 = 40000, n = 200) # pre.
%b = mfile.catFile('axibal8g.n100pre', f0=30000, f1 = 40000, n = 200) # pre.
%c = mfile.catFile('axibal8h.n100pre', f0=30000, f1 = 40000, n = 200) # pre.

%plot (a.f, 20 * log10(1./ 20E-6 * abs(a.h[:, 1] + 1j * a.h[:, 2])))
%plot (b.f, 20 * log10(1./ 20E-6 * abs(b.h[:, 1] + 1j * b.h[:, 2])))
%plot (c.f, 20 * log10(1./ 20E-6 * abs(c.h[:, 1] + 1j * c.h[:, 2])))

%tmp = reference.dumptex(a.f, 20 * log10(1./ 20E-6 * abs(a.h[:, 1] + 1j * a.h[:, 2])))
%tmp = reference.dumptex(b.f, 20 * log10(1./ 20E-6 * abs(b.h[:, 1] + 1j * b.h[:, 2])))
%tmp = reference.dumptex(c.f, 20 * log10(1./ 20E-6 * abs(c.h[:, 1] + 1j * c.h[:, 2])))

\mbox{
\hspace{-1cm}
\subfigure[SPL midway between duct centre and duct exit, for different
boundary conditions.] {


\tikzstyle{every axis legend}+= [at={(0.98,0.02)},anchor=south east] % im is 0,0 to 1,1
\begin{tikzpicture}

% second axis. Do NOT USE scale only axis; it changes the x-axis scaling.
\begin{axis}[width=\hplotw,height=\ploth,
separate axis lines,
every outer x axis line/.append style={white}, % YES! no more messy axes
grid=major,
xmin = 30000, xmax=36000, ymin = 75, ymax = 125,
axis y line = none, axis x line = top, %y = 1.565cm
xlabel = $f/f_{0}$,
%xlabel style = {xshift = -10pt, yshift = -200pt},
xtick ={34400},
xticklabels={ $1$ }
]
\end{axis}

\begin{axis}[width=\hplotw,height=\ploth,
xmin = 30000, xmax=36000, ymin = 75, ymax = 125,
xlabel={$f\,(Hz)$}, ylabel={SPL, $1\,V$, node 100}, grid=major]

\addplot[color = blue] plot coordinates {(3.00000e+04,8.16458e+01) (3.00500e+04,8.16237e+01) (3.01000e+04,8.15471e+01) (3.01500e+04,8.14818e+01) (3.02000e+04,8.15464e+01) (3.02500e+04,8.17223e+01) (3.03000e+04,8.19624e+01) (3.03500e+04,8.22124e+01) (3.04000e+04,8.24467e+01) (3.04500e+04,8.26550e+01) (3.05000e+04,8.28321e+01) (3.05500e+04,8.29803e+01) (3.06000e+04,8.31159e+01) (3.06500e+04,8.33246e+01) (3.07000e+04,8.41081e+01) (3.07500e+04,8.73834e+01) (3.08000e+04,8.78410e+01) (3.08500e+04,8.62150e+01) (3.09000e+04,8.54417e+01) (3.09500e+04,8.50057e+01) (3.10000e+04,8.46768e+01) (3.10500e+04,8.43373e+01) (3.11000e+04,8.39853e+01) (3.11500e+04,8.34931e+01) (3.12000e+04,8.27632e+01) (3.12500e+04,8.15285e+01) (3.13000e+04,7.90764e+01) (3.13500e+04,7.90075e+01) (3.14000e+04,9.80799e+01) (3.14500e+04,9.49825e+01) (3.15000e+04,9.12996e+01) (3.15500e+04,8.98744e+01) (3.16000e+04,8.91425e+01) (3.16500e+04,8.87113e+01) (3.17000e+04,8.84340e+01) (3.17500e+04,8.82469e+01) (3.18000e+04,8.81319e+01) (3.18500e+04,8.81045e+01) (3.19000e+04,8.81842e+01) (3.19500e+04,8.83483e+01) (3.20000e+04,8.85389e+01) (3.20500e+04,8.87148e+01) (3.21000e+04,8.88605e+01) (3.21500e+04,8.89807e+01) (3.22000e+04,8.90576e+01) (3.22500e+04,8.90137e+01) (3.23000e+04,8.84688e+01) (3.23500e+04,8.94283e+01) (3.24000e+04,8.96744e+01) (3.24500e+04,8.98130e+01) (3.25000e+04,8.99482e+01) (3.25500e+04,9.00935e+01) (3.26000e+04,9.02567e+01) (3.26500e+04,9.04471e+01) (3.27000e+04,9.06757e+01) (3.27500e+04,9.09537e+01) (3.28000e+04,9.12862e+01) (3.28500e+04,9.16551e+01) (3.29000e+04,9.20049e+01) (3.29500e+04,9.22538e+01) (3.30000e+04,9.23359e+01) (3.30500e+04,9.22364e+01) (3.31000e+04,9.19829e+01) (3.31500e+04,9.16198e+01) (3.32000e+04,9.11927e+01) (3.32500e+04,9.07430e+01) (3.33000e+04,9.03041e+01) (3.33500e+04,8.98974e+01) (3.34000e+04,8.94658e+01) (3.34500e+04,8.91212e+01) (3.35000e+04,8.88071e+01) (3.35500e+04,8.85331e+01) (3.36000e+04,8.83818e+01) (3.36500e+04,8.86569e+01) (3.37000e+04,9.00487e+01) (3.37500e+04,9.29449e+01) (3.38000e+04,9.61772e+01) (3.38500e+04,9.80586e+01) (3.39000e+04,9.86011e+01) (3.39500e+04,9.87158e+01) (3.40000e+04,9.88505e+01) (3.40500e+04,9.90692e+01) (3.41000e+04,9.92993e+01) (3.41500e+04,9.94409e+01) (3.42000e+04,9.95139e+01) (3.42500e+04,9.96600e+01) (3.43000e+04,9.99961e+01) (3.43500e+04,1.00558e+02) (3.44000e+04,1.01338e+02) (3.44500e+04,1.02347e+02) (3.45000e+04,1.03564e+02) (3.45500e+04,1.05161e+02) (3.46000e+04,1.05987e+02) (3.46500e+04,1.07820e+02) (3.47000e+04,1.11206e+02) (3.47500e+04,1.14916e+02) (3.48000e+04,1.15706e+02) (3.48500e+04,1.12591e+02) (3.49000e+04,1.09531e+02) (3.49500e+04,1.07248e+02) (3.50000e+04,1.05567e+02) (3.50500e+04,1.04320e+02) (3.51000e+04,1.03394e+02) (3.51500e+04,1.02704e+02) (3.52000e+04,1.02202e+02) (3.52500e+04,1.01845e+02) (3.53000e+04,1.01604e+02) (3.53500e+04,1.01458e+02) (3.54000e+04,1.01391e+02) (3.54500e+04,1.01390e+02) (3.55000e+04,1.01449e+02) (3.55500e+04,1.01562e+02) (3.56000e+04,1.01717e+02) (3.56500e+04,1.01946e+02) (3.57000e+04,1.02260e+02) (3.57500e+04,1.02727e+02) (3.58000e+04,1.03522e+02) (3.58500e+04,1.05173e+02) (3.59000e+04,1.10286e+02) (3.59500e+04,9.96446e+01) (3.60000e+04,1.07120e+02) (3.60500e+04,1.08194e+02) (3.61000e+04,1.08349e+02) (3.61500e+04,1.08400e+02) (3.62000e+04,1.08421e+02) (3.62500e+04,1.08353e+02) (3.63000e+04,1.08128e+02) (3.63500e+04,1.07713e+02) (3.64000e+04,1.07111e+02) (3.64500e+04,1.06357e+02) (3.65000e+04,1.05499e+02) (3.65500e+04,1.04590e+02) (3.66000e+04,1.03670e+02) (3.66500e+04,1.02770e+02) (3.67000e+04,1.02038e+02) (3.67500e+04,1.01246e+02) (3.68000e+04,1.00520e+02) (3.68500e+04,9.98677e+01) (3.69000e+04,9.92952e+01) (3.69500e+04,9.88131e+01) (3.70000e+04,9.84387e+01) (3.70500e+04,9.82052e+01) (3.71000e+04,9.81734e+01) (3.71500e+04,9.84498e+01) (3.72000e+04,9.92163e+01) (3.72500e+04,1.00655e+02) (3.73000e+04,1.01671e+02) (3.73500e+04,9.82344e+01) (3.74000e+04,9.38082e+01) (3.74500e+04,9.20443e+01) (3.75000e+04,9.24560e+01) (3.75500e+04,9.38404e+01) (3.76000e+04,9.56495e+01) (3.76500e+04,9.77052e+01) (3.77000e+04,9.98974e+01) (3.77500e+04,1.02071e+02) (3.78000e+04,1.04039e+02) (3.78500e+04,1.05575e+02) (3.79000e+04,1.06686e+02) (3.79500e+04,1.07504e+02) (3.80000e+04,1.08192e+02) (3.80500e+04,1.08868e+02) (3.81000e+04,1.09598e+02) (3.81500e+04,1.10423e+02) (3.82000e+04,1.11368e+02) (3.82500e+04,1.12464e+02) (3.83000e+04,1.13752e+02) (3.83500e+04,1.15302e+02) (3.84000e+04,1.17232e+02) (3.84500e+04,1.19748e+02) (3.85000e+04,1.23088e+02) (3.85500e+04,1.27522e+02) (3.86000e+04,1.35797e+02) (3.86500e+04,1.27411e+02) (3.87000e+04,1.22159e+02) (3.87500e+04,1.18706e+02) (3.88000e+04,1.16133e+02) (3.88500e+04,1.14052e+02) (3.89000e+04,1.12292e+02) (3.89500e+04,1.10775e+02) (3.90000e+04,1.09488e+02) (3.90500e+04,1.08432e+02) (3.91000e+04,1.07610e+02) (3.91500e+04,1.07025e+02) (3.92000e+04,1.06663e+02) (3.92500e+04,1.06491e+02) (3.93000e+04,1.06449e+02) (3.93500e+04,1.06470e+02) (3.94000e+04,1.06498e+02) (3.94500e+04,1.06504e+02) (3.95000e+04,1.06482e+02) (3.95500e+04,1.06443e+02) (3.96000e+04,1.06405e+02) (3.96500e+04,1.06382e+02) (3.97000e+04,1.06387e+02) (3.97500e+04,1.06416e+02) (3.98000e+04,1.06453e+02) (3.98500e+04,1.06457e+02) (3.99000e+04,1.06360e+02) (3.99500e+04,1.06084e+02) (4.00000e+04,1.05546e+02)};
\addplot[color = red] plot coordinates {(3.00000e+04,8.25468e+01) (3.00500e+04,8.27367e+01) (3.01000e+04,8.29124e+01) (3.01500e+04,8.30746e+01) (3.02000e+04,8.32243e+01) (3.02500e+04,8.33623e+01) (3.03000e+04,8.34897e+01) (3.03500e+04,8.36071e+01) (3.04000e+04,8.37157e+01) (3.04500e+04,8.38163e+01) (3.05000e+04,8.39098e+01) (3.05500e+04,8.39969e+01) (3.06000e+04,8.40785e+01) (3.06500e+04,8.41553e+01) (3.07000e+04,8.42280e+01) (3.07500e+04,8.42973e+01) (3.08000e+04,8.43637e+01) (3.08500e+04,8.44278e+01) (3.09000e+04,8.44902e+01) (3.09500e+04,8.45513e+01) (3.10000e+04,8.46116e+01) (3.10500e+04,8.46714e+01) (3.11000e+04,8.47313e+01) (3.11500e+04,8.47914e+01) (3.12000e+04,8.48522e+01) (3.12500e+04,8.49139e+01) (3.13000e+04,8.49768e+01) (3.13500e+04,8.50411e+01) (3.14000e+04,8.51072e+01) (3.14500e+04,8.51751e+01) (3.15000e+04,8.52452e+01) (3.15500e+04,8.53175e+01) (3.16000e+04,8.53923e+01) (3.16500e+04,8.54697e+01) (3.17000e+04,8.55499e+01) (3.17500e+04,8.56329e+01) (3.18000e+04,8.57190e+01) (3.18500e+04,8.58083e+01) (3.19000e+04,8.59009e+01) (3.19500e+04,8.59968e+01) (3.20000e+04,8.60962e+01) (3.20500e+04,8.61992e+01) (3.21000e+04,8.63059e+01) (3.21500e+04,8.64164e+01) (3.22000e+04,8.65308e+01) (3.22500e+04,8.66492e+01) (3.23000e+04,8.67716e+01) (3.23500e+04,8.68981e+01) (3.24000e+04,8.70289e+01) (3.24500e+04,8.71640e+01) (3.25000e+04,8.73036e+01) (3.25500e+04,8.74477e+01) (3.26000e+04,8.75964e+01) (3.26500e+04,8.77499e+01) (3.27000e+04,8.79082e+01) (3.27500e+04,8.80715e+01) (3.28000e+04,8.82399e+01) (3.28500e+04,8.84135e+01) (3.29000e+04,8.85925e+01) (3.29500e+04,8.87771e+01) (3.30000e+04,8.89674e+01) (3.30500e+04,8.91637e+01) (3.31000e+04,8.93660e+01) (3.31500e+04,8.95748e+01) (3.32000e+04,8.97902e+01) (3.32500e+04,9.00126e+01) (3.33000e+04,9.02423e+01) (3.33500e+04,9.04798e+01) (3.34000e+04,9.07254e+01) (3.34500e+04,9.09797e+01) (3.35000e+04,9.12434e+01) (3.35500e+04,9.15170e+01) (3.36000e+04,9.18016e+01) (3.36500e+04,9.20981e+01) (3.37000e+04,9.24076e+01) (3.37500e+04,9.27317e+01) (3.38000e+04,9.30721e+01) (3.38500e+04,9.34308e+01) (3.39000e+04,9.38104e+01) (3.39500e+04,9.42141e+01) (3.40000e+04,9.46459e+01) (3.40500e+04,9.51107e+01) (3.41000e+04,9.56148e+01) (3.41500e+04,9.61661e+01) (3.42000e+04,9.67748e+01) (3.42500e+04,9.74543e+01) (3.43000e+04,9.82220e+01) (3.43500e+04,9.91014e+01) (3.44000e+04,1.00124e+02) (3.44500e+04,1.01334e+02) (3.45000e+04,1.02747e+02) (3.45500e+04,1.04665e+02) (3.46000e+04,1.07019e+02) (3.46500e+04,1.10232e+02) (3.47000e+04,1.14870e+02) (3.47500e+04,1.19573e+02) (3.48000e+04,1.15903e+02) (3.48500e+04,1.11611e+02) (3.49000e+04,1.08808e+02) (3.49500e+04,1.06910e+02) (3.50000e+04,1.05579e+02) (3.50500e+04,1.04632e+02) (3.51000e+04,1.03961e+02) (3.51500e+04,1.03496e+02) (3.52000e+04,1.03188e+02) (3.52500e+04,1.03005e+02) (3.53000e+04,1.02923e+02) (3.53500e+04,1.02924e+02) (3.54000e+04,1.02996e+02) (3.54500e+04,1.03130e+02) (3.55000e+04,1.03323e+02) (3.55500e+04,1.03571e+02) (3.56000e+04,1.03878e+02) (3.56500e+04,1.04249e+02) (3.57000e+04,1.04699e+02) (3.57500e+04,1.05260e+02) (3.58000e+04,1.06009e+02) (3.58500e+04,1.07220e+02) (3.59000e+04,1.11047e+02) (3.59500e+04,9.80319e+01) (3.60000e+04,1.04730e+02) (3.60500e+04,1.06237e+02) (3.61000e+04,1.07117e+02) (3.61500e+04,1.07630e+02) (3.62000e+04,1.07719e+02) (3.62500e+04,1.07298e+02) (3.63000e+04,1.06382e+02) (3.63500e+04,1.05100e+02) (3.64000e+04,1.03624e+02) (3.64500e+04,1.02092e+02) (3.65000e+04,1.00604e+02) (3.65500e+04,9.92324e+01) (3.66000e+04,9.80360e+01) (3.66500e+04,9.70657e+01) (3.67000e+04,9.63560e+01) (3.67500e+04,9.59150e+01) (3.68000e+04,9.57213e+01) (3.68500e+04,9.57318e+01) (3.69000e+04,9.58956e+01) (3.69500e+04,9.61660e+01) (3.70000e+04,9.65059e+01) (3.70500e+04,9.68891e+01) (3.71000e+04,9.72980e+01) (3.71500e+04,9.77219e+01) (3.72000e+04,9.81542e+01) (3.72500e+04,9.85915e+01) (3.73000e+04,9.90324e+01) (3.73500e+04,9.94768e+01) (3.74000e+04,9.99251e+01) (3.74500e+04,1.00378e+02) (3.75000e+04,1.00838e+02) (3.75500e+04,1.01307e+02) (3.76000e+04,1.01786e+02) (3.76500e+04,1.02277e+02) (3.77000e+04,1.02784e+02) (3.77500e+04,1.03308e+02) (3.78000e+04,1.03854e+02) (3.78500e+04,1.04424e+02) (3.79000e+04,1.05024e+02) (3.79500e+04,1.05658e+02) (3.80000e+04,1.06332e+02) (3.80500e+04,1.07056e+02) (3.81000e+04,1.07839e+02) (3.81500e+04,1.08696e+02) (3.82000e+04,1.09646e+02) (3.82500e+04,1.10718e+02) (3.83000e+04,1.11955e+02) (3.83500e+04,1.13422e+02) (3.84000e+04,1.15231e+02) (3.84500e+04,1.17571e+02) (3.85000e+04,1.20798e+02) (3.85500e+04,1.25316e+02) (3.86000e+04,1.32412e+02) (3.86500e+04,1.25218e+02) (3.87000e+04,1.20853e+02) (3.87500e+04,1.18104e+02) (3.88000e+04,1.16204e+02) (3.88500e+04,1.14783e+02) (3.89000e+04,1.13646e+02) (3.89500e+04,1.12685e+02) (3.90000e+04,1.11840e+02) (3.90500e+04,1.11079e+02) (3.91000e+04,1.10381e+02) (3.91500e+04,1.09737e+02) (3.92000e+04,1.09139e+02) (3.92500e+04,1.08581e+02) (3.93000e+04,1.08059e+02) (3.93500e+04,1.07571e+02) (3.94000e+04,1.07113e+02) (3.94500e+04,1.06684e+02) (3.95000e+04,1.06279e+02) (3.95500e+04,1.05899e+02) (3.96000e+04,1.05541e+02) (3.96500e+04,1.05203e+02) (3.97000e+04,1.04884e+02) (3.97500e+04,1.04582e+02) (3.98000e+04,1.04296e+02) (3.98500e+04,1.04026e+02) (3.99000e+04,1.03769e+02) (3.99500e+04,1.03525e+02) (4.00000e+04,1.03294e+02)};
\addplot[color = black] plot coordinates {(3.00000e+04,8.31253e+01) (3.00500e+04,8.32589e+01) (3.01000e+04,8.33906e+01) (3.01500e+04,8.35206e+01) (3.02000e+04,8.36495e+01) (3.02500e+04,8.37774e+01) (3.03000e+04,8.39045e+01) (3.03500e+04,8.40312e+01) (3.04000e+04,8.41573e+01) (3.04500e+04,8.42831e+01) (3.05000e+04,8.44087e+01) (3.05500e+04,8.45340e+01) (3.06000e+04,8.46590e+01) (3.06500e+04,8.47836e+01) (3.07000e+04,8.49076e+01) (3.07500e+04,8.50310e+01) (3.08000e+04,8.51535e+01) (3.08500e+04,8.52747e+01) (3.09000e+04,8.53946e+01) (3.09500e+04,8.55125e+01) (3.10000e+04,8.56281e+01) (3.10500e+04,8.57411e+01) (3.11000e+04,8.58508e+01) (3.11500e+04,8.59567e+01) (3.12000e+04,8.60582e+01) (3.12500e+04,8.61547e+01) (3.13000e+04,8.62455e+01) (3.13500e+04,8.63301e+01) (3.14000e+04,8.64077e+01) (3.14500e+04,8.64777e+01) (3.15000e+04,8.65395e+01) (3.15500e+04,8.65928e+01) (3.16000e+04,8.66367e+01) (3.16500e+04,8.66714e+01) (3.17000e+04,8.66966e+01) (3.17500e+04,8.67122e+01) (3.18000e+04,8.67189e+01) (3.18500e+04,8.67168e+01) (3.19000e+04,8.67069e+01) (3.19500e+04,8.66900e+01) (3.20000e+04,8.66677e+01) (3.20500e+04,8.66413e+01) (3.21000e+04,8.66130e+01) (3.21500e+04,8.65841e+01) (3.22000e+04,8.65570e+01) (3.22500e+04,8.65341e+01) (3.23000e+04,8.65171e+01) (3.23500e+04,8.65086e+01) (3.24000e+04,8.65101e+01) (3.24500e+04,8.65238e+01) (3.25000e+04,8.65506e+01) (3.25500e+04,8.65924e+01) (3.26000e+04,8.66501e+01) (3.26500e+04,8.67234e+01) (3.27000e+04,8.68132e+01) (3.27500e+04,8.69188e+01) (3.28000e+04,8.70404e+01) (3.28500e+04,8.71769e+01) (3.29000e+04,8.73278e+01) (3.29500e+04,8.74919e+01) (3.30000e+04,8.76681e+01) (3.30500e+04,8.78557e+01) (3.31000e+04,8.80537e+01) (3.31500e+04,8.82612e+01) (3.32000e+04,8.84774e+01) (3.32500e+04,8.87014e+01) (3.33000e+04,8.89341e+01) (3.33500e+04,8.91748e+01) (3.34000e+04,8.94221e+01) (3.34500e+04,8.96785e+01) (3.35000e+04,8.99434e+01) (3.35500e+04,9.02170e+01) (3.36000e+04,9.05023e+01) (3.36500e+04,9.07988e+01) (3.37000e+04,9.11072e+01) (3.37500e+04,9.14378e+01) (3.38000e+04,9.17857e+01) (3.38500e+04,9.21519e+01) (3.39000e+04,9.25510e+01) (3.39500e+04,9.29747e+01) (3.40000e+04,9.34373e+01) (3.40500e+04,9.39422e+01) (3.41000e+04,9.44977e+01) (3.41500e+04,9.51128e+01) (3.42000e+04,9.57988e+01) (3.42500e+04,9.65694e+01) (3.43000e+04,9.74422e+01) (3.43500e+04,9.84393e+01) (3.44000e+04,9.95903e+01) (3.44500e+04,1.00935e+02) (3.45000e+04,1.02488e+02) (3.45500e+04,1.04545e+02) (3.46000e+04,1.07043e+02) (3.46500e+04,1.10448e+02) (3.47000e+04,1.15660e+02) (3.47500e+04,1.23654e+02) (3.48000e+04,1.17959e+02) (3.48500e+04,1.12552e+02) (3.49000e+04,1.09363e+02) (3.49500e+04,1.07223e+02) (3.50000e+04,1.05686e+02) (3.50500e+04,1.04544e+02) (3.51000e+04,1.03685e+02) (3.51500e+04,1.03039e+02) (3.52000e+04,1.02565e+02) (3.52500e+04,1.02232e+02) (3.53000e+04,1.02019e+02) (3.53500e+04,1.01912e+02) (3.54000e+04,1.01902e+02) (3.54500e+04,1.01982e+02) (3.55000e+04,1.02150e+02) (3.55500e+04,1.02408e+02) (3.56000e+04,1.02758e+02) (3.56500e+04,1.03212e+02) (3.57000e+04,1.03789e+02) (3.57500e+04,1.04526e+02) (3.58000e+04,1.05513e+02) (3.58500e+04,1.07041e+02) (3.59000e+04,1.11331e+02) (3.59500e+04,9.84875e+01) (3.60000e+04,1.06023e+02) (3.60500e+04,1.08421e+02) (3.61000e+04,1.10412e+02) (3.61500e+04,1.12159e+02) (3.62000e+04,1.13176e+02) (3.62500e+04,1.12870e+02) (3.63000e+04,1.11487e+02) (3.63500e+04,1.09762e+02) (3.64000e+04,1.08116e+02) (3.64500e+04,1.06676e+02) (3.65000e+04,1.05458e+02) (3.65500e+04,1.04448e+02) (3.66000e+04,1.03623e+02) (3.66500e+04,1.02966e+02) (3.67000e+04,1.02458e+02) (3.67500e+04,1.02085e+02) (3.68000e+04,1.01831e+02) (3.68500e+04,1.01684e+02) (3.69000e+04,1.01631e+02) (3.69500e+04,1.01658e+02) (3.70000e+04,1.01758e+02) (3.70500e+04,1.01919e+02) (3.71000e+04,1.02123e+02) (3.71500e+04,1.02388e+02) (3.72000e+04,1.02685e+02) (3.72500e+04,1.03012e+02) (3.73000e+04,1.03369e+02) (3.73500e+04,1.03752e+02) (3.74000e+04,1.04156e+02) (3.74500e+04,1.04581e+02) (3.75000e+04,1.05025e+02) (3.75500e+04,1.05486e+02) (3.76000e+04,1.05965e+02) (3.76500e+04,1.06461e+02) (3.77000e+04,1.06976e+02) (3.77500e+04,1.07511e+02) (3.78000e+04,1.08068e+02) (3.78500e+04,1.08650e+02) (3.79000e+04,1.09261e+02) (3.79500e+04,1.09905e+02) (3.80000e+04,1.10588e+02) (3.80500e+04,1.11319e+02) (3.81000e+04,1.12107e+02) (3.81500e+04,1.12965e+02) (3.82000e+04,1.13911e+02) (3.82500e+04,1.14970e+02) (3.83000e+04,1.16176e+02) (3.83500e+04,1.17581e+02) (3.84000e+04,1.19269e+02) (3.84500e+04,1.21379e+02) (3.85000e+04,1.24153e+02) (3.85500e+04,1.27844e+02) (3.86000e+04,1.36276e+02) (3.86500e+04,1.31359e+02) (3.87000e+04,1.26214e+02) (3.87500e+04,1.22794e+02) (3.88000e+04,1.20337e+02) (3.88500e+04,1.18423e+02) (3.89000e+04,1.16846e+02) (3.89500e+04,1.15496e+02) (3.90000e+04,1.14313e+02) (3.90500e+04,1.13258e+02) (3.91000e+04,1.12304e+02) (3.91500e+04,1.11437e+02) (3.92000e+04,1.10642e+02) (3.92500e+04,1.09909e+02) (3.93000e+04,1.09230e+02) (3.93500e+04,1.08599e+02) (3.94000e+04,1.08009e+02) (3.94500e+04,1.07457e+02) (3.95000e+04,1.06940e+02) (3.95500e+04,1.06454e+02) (3.96000e+04,1.05996e+02) (3.96500e+04,1.05566e+02) (3.97000e+04,1.05160e+02) (3.97500e+04,1.04777e+02) (3.98000e+04,1.04416e+02) (3.98500e+04,1.04075e+02) (3.99000e+04,1.03754e+02) (3.99500e+04,1.03451e+02) (4.00000e+04,1.03167e+02)};


\legend{BE\\Quiet\\Wave env.\\}
\end{axis}

\end{tikzpicture} } }

\caption{Zoomed version of ....}
\label{fig:axibal8a_spl} \end{center} \end{figure}