Monday, 23 December 2013

girls to be most scared of

http://www.imdb.com/poll/oIGR3vTG91c/?ref_=tt_po_q5

Saturday, 16 November 2013

Sunday, 10 November 2013

guitar pre-amps

http://www.diyguitarmods.com/guitar-preamp.php

Turns out the guitar gives enough level without an amp!  Audacity: line in, select

sysdefault:Line 0

input.

Active filters for home including 6dB/octave dipole compensation and 2nd order hp/lp filters

http://www.linkwitzlab.com/filters.htm

Make 1, 2, 8

Monday, 9 September 2013

camping!


Cornwall:

http://www.treencafe.co.uk/
http://treenfarmcampsite.co.uk/

Wales:

allt y coed

Exmoor:

Tom's field.

Westermill Farm Holidays, Minehead, United Kingdom

Sunday, 18 August 2013

checking local net connections

$ watch ss -tp


openFOAM GPU

http://issuu.com/vratis/docs/speedit_plugin_to_openfoam_installation_guide

virtualisation note

I have worries abut graphics performance.  Anyway:

https://communities.vmware.com/thread/230428?start=15&tstart=0

https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CEQQFjAD&url=http%3A%2F%2Fwww.vmware.com%2Ffiles%2Fpdf%2Ftechpaper%2Fvmware-horizon-view-graphics-acceleration-deployment.pdf&ei=zm4QUvmHHKyn0wW02YDwBA&usg=AFQjCNGAqJQsJ7e-6UNyvDXl5BcpiKjfGw&bvm=bv.50768961,d.d2k&cad=rja

Friday, 16 August 2013

/etc/exports

On update, restart with

$ exportfs -a

Thursday, 15 August 2013

nbconvert notes

Changing to A4


Edit latex.py in the nbconvert directory and change, documentclass_options from `11pt,english' to `11pt,english,a4'




Tuesday, 13 August 2013

Efficient / elegant Python file reading


from ipython.org:

with open('workfile', 'r') as f:
        read_data = f.read()

Monday, 12 August 2013

ipython notebook animations. So far so bad.

Some problems here.

Attempt to use openshot to create video (failed)

Anyway, install openshot.  Openshot got upset with my Lucid installation codecs when I attempted export; claiming libx264 was not installed.  Some reading:  there are two versions, one closed, one open.  I most likely have the open version which is limited.


$ sudo apt-get install libavcodec-extra-52 libavdevice-extra-52 libavfilter-extra-0 libavformat-extra-52 libavutil-extra-49 libpostproc-extra-51 libswscale-extra-0


Then openshot hangs on export.

Attempt command line encoding with libav-tools (fail to install on Lucid)


Try command line:  I need the libav-tools package, not present in Lucid.  Add a personal package providing it:

$ sudo add-apt-repository ppa:kxstudio-team/ppa
$ sudo apt-get update

Still can't install it!  Manually add,

deb http://ppa.launchpad.net/kxstudio-team/ppa/ubuntu lucid main 
deb-src http://ppa.launchpad.net/kxstudio-team/ppa/ubuntu lucid main 

to /etc/apt/sources.list and update: $ sudo apt-get update

Still no joy.  Looks like I need to update my installation.

Workaround:

Attempt command line encoding with ffmpeg (Seg fault)


Older linux:  create movie from images with ffmpeg:


$ ffmpeg -qscale 5 -r 20 -b 9600 -i v9_j58_anim???.png v9_j58.mp4


FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Jan 24 2013 19:42:59, gcc: 4.4.3
Input #0, image2, from 'v9_j58_anim000.png':
  Duration: 00:00:00.05, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: png, rgb24, 1276x934, 20 tbr, 20 tbn, 20 tbc
Segmentation fault

Pity.  Gave up here.#


Attempt with avconv (not in Lucid)


avconv looks simpler and is available on newer Ubuntus.  Try,

$ avconv -i *.png movie.mp4

or don't in Lucid:  it's not available.

Attempt with openmovieeditor


$ sudo apt-get install openmovieeditor

So far so good.  Navigate to the directory containing nothing but images and click render.

Result:  a non-zeros file, that displays a black mplayer screen.  That's a morning lost.


Attempt with gifsicle

I used to use this during the PhD.  It needs gif images so convert all these pngs to gif

Attempt with recordmydesktop

$ sudo apt-get install recordmydesktop

$ recordmydesktop -x 500 -y 250 --width 800 --height 700 --no-sound --delay 10 output.ogv


A good start.  Capture works and mplayer plays the output.  Now to crop.

Best approach (using xdotool, xmacrorec, screengran, python PIL and GIMP)

recordmydesktop worked but had a habit of leaving a white square on the desktop after closing, and
dropped some frames; and the result didn't look so good.  A better approach might be to write a macro
to iterate through the animation frames, saving them.  Crop the result in python and create the animation in GIMP.

Luckily, PafVu will save animations as a series of .png files, leaving only the cropping and creation of the animation.
If a frequency based animation is needed, use the other tools to create a macro to step through the displaced shapes.




imageRoot = '/home/me/screenshots/animSource/'
imageTarget1 = '/home/me/screenshots/animCroppedSolid/'
imageTarget2 = '/home/me/screenshots/animCroppedTrans/'
fontpath = '/usr/share/fonts/truetype/ubuntu-font-family-0.80/'  # system specific!


a = os.listdir(imageRoot)
a = [i for i in a]
f = reference.logscale(1, 1000, 192)
# It seems that PIL will not load normal fonts like those given away
# by Ubuntu, or those on the system already.  That's damn annoying.
# Seems they have thier own format:  pbm or .pil but I cannot find them.
# No:  truetype fonts do work but the command for use is truetype specific.
font = ImageFont.truetype(fontpath + 'Ubuntu-B.ttf', size=16) # true type
#font = ImageFont.load(fontpath + 'Ubuntu-B.ttf') # true type
# font = ImageFont.truetype("arial.ttf", 15) # truetype

ii = 0
imageTarget = imageTarget1
for i in sorted(a):
    print i, ii, f[int(ii/2)]
    b = Image.open(imageRoot + i)
    c = b.crop((740, 345, 1580, 880)) # use this when happy freqs are correct.
    # c = b  # use this to check f[ii/2] = f
    draw = ImageDraw.Draw(c)
    # draw.line((0,0) + c.size, fill=128) # an example.
    draw.text([300, 10], 'Frequency: %.2f Hz' % f[int(ii/2)], fill=128, font=font)  
    del(draw)
    c.save(imageTarget + i + '.new.png')
    if imageTarget == imageTarget1:
        imageTarget = imageTarget2
    else:
        imageTarget = imageTarget1
    ii += 1






Friday, 9 August 2013

ipython solution control. Create .geo from template, convert to PAFEC, parallel solve, import.


fn = 'v9_j55'
if solve:
    createAnalysisFile(dataRoot + fn + '_template.geo', dataRoot + fn + '.geo', 
                   prepend = 'dia_t = 1.067E-3;\n')
    output = !gmsh -2 {dataRoot + fn + '.geo'}  # this works!
    args = setArgs()
    args['FREQUENCIES.FOR.ANALYSIS'] = ffa(3, 15000, 50000, 192)
    args['restrain'] = [{'Heater':1}]
    convert.gmsh2pafec(dataRoot + fn, case = 66, verb = 0, args = args)
    solveJob(fn)
if loadData:
    res['v9_j55: heaterClamp'] = getResult(dataRoot + fn, Vnode = 68)

ipython 1.0 notes

The new ipython includes many new features:  so many I'll log some here.  IPython amazes me!  I wonder if I could up sections of my notebooks to blogger.....  anyway.  Much of the following is noted directly from the following address:

http://ipython.org/ipython-doc/stable/interactive/tutorial.html

% timeit range(1000)  # run this one line

%% timeit range(1000) # run this cell.
 max(x)

% run -d myprogram.py # step through the program!

% debug   # now works in the notebook!  As does raw_input() !

System commands!

output = !ping www.bbc.co.uk

.. to provide the command with ipython variables, use $ or wrap in {} as follows:

output = !grep -rF $pattern ipython/*

a = 'hello'
output = !grep -rF {a} ipython/*


Grab external python programs, edit and execute!

%load http://matplotlib.sourceforge.net/plot_directive/mpl_examples/mplot3d/contour3d_demo.py

Set high quality plots:  Put this at the start.

% config InlineBackend.figure_format = 'svg'

Undo :   Thank you!

%connect_info

to display connection info for other ipython consoles.

Setting up clients and workers:

worker:
user@worker: $ ipython kernel
[IPKernelApp] To connect to another client on this kernel, use:
[IPKernelApp] --existing kernel-12345.json

client:
user@client $ ipython qtconsole --ssh=worker --existing /path/to/kernel-12345.json

Manual ssh tunnels.  This is interesting even without ipython.

$ ssh :: -f -N

Blogger mangled.  Check the source at
http://ipython.org/ipython-doc/stable/interactive/qtconsole.html
for this.
















Thursday, 8 August 2013

python documentation / uml diagrams

To read convert.py and create documentation based on comment strings in a pdf:

$ epydoc --pdf convert -o convert_docs

To do something similar with html (including class diagrams)

$ epydoc convert -o convert_docs

connecting to ipython with another instance

%connect_info


or simply, 

$ ipython qtconsole --existing

Wednesday, 7 August 2013

ipython notebook formatting.

\begin{verbatim}
blah blah
\end{verbatim}

... generates a boxed display in the notebook but nbconvert uses the environment as hoped.

# title
## section
### subsection
#### subsubsection

behaves as expected.

Titles properly centred:

'title here \n good'  worked as hoped.

r'title here \\ bad' will left justify the second line.  Yuk.


tit = 'Effect of coupling PZT to diaphragm at edge only\n'
tit += r'with controlled $f_{0}$. $pcb_{t}=3.2mm$'

works as hoped. :)

Sunday, 4 August 2013

linux security

John the Ripper:

$ sudo unshadow /etc/passwd /etc/shadow > mypasswd
$ cat mypasswd
$ john mypasswd

$ john --show mypasswd
0 password hashes cracked, 1 left


$ john --status
guesses: 0  time: 0:00:05:11 (3)  c/s: 456

http://www.openwall.com/john/doc/EXAMPLES.shtml

is useful.

Interrupting and running with $ bg  doesn't seem to work and left a john process and locked file.  Killing the process fixed this.  Running as,

$nohup john mypasswd &

then seemed to work ok but subsequent

$ john --status

returned a static,

guesses: 0  time: 0:00:00:02 0% (2)  c/s: 369

even though one of the machine cores was at 100$ with john using it all.  Don't do this then!  Run without nohup and &.





Monday, 29 July 2013

muttprint

$ lpstat -p


printer hp_hp_color_LaserJet_5550 is idle.  enabled since Mon Jul 29 18:41:51 2013
        Ready to print.


in .bashrc:

export PRINTER=hp_hp_color_LaserJet_5550

was critical.


pafec reference scripts: Resonance frequencies of a disk.


CONTROL
AXISYMMETRIC
CONTROL.END

PARAMETERS
'r' = 0.1
't' = 0.01

NODES
NODE X Y
1 0 <'r'>
2 <'t'> <'r'>
3 0 0
4 <'t'> 0

PAFBLOCKS
BLOCK TYPE ELEM GROUP PROP N1 N2 TOPO
1 1  36210 1 11 4 20 1 2 3 4

MODES.AND.FREQUENCIES
AUTO MODES
200 20

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

PLATES.AND.SHELLS
PLATE MATERIAL
11 4

END.OF.DATA

Results from PHASE 7:

FREQUENCY  PERCENTAGE
 NUMBER      ERROR
-----------------------
   1        0.00
   6        0.03
  11        0.09
  12        0.11

MODE  FREQUENCY
  1   0.0159008
  2   2211.8861122
  3   9009.1228360
  4   17691.5023129


This was used to demonstrate the approximate relation,

f0 \propto t sqrt(E) / (sqrt(rho) * r**2)

and the mode-shapes below.


Friday, 26 July 2013

Android

Build your first `app'.  Application, please.

https://developer.android.com/training/basics/firstapp/index.html

Mass

83 kg.  26/7/13

Wednesday, 24 July 2013

Spacing in ipython notebook subplots and default settings.

Spacing:
import matplotlib as m

m.rcParams['figure.subplot.hspace'] = 0.4 # 0.3 default.
m.rcParams['figure.subplot.wspace'] = 0.3 # 0.2 default.



Defaults:

At the start of each script use,

import ipythonNotebookConfig

where, ipythonNotebookConfig.py  contains:

import matplotlib as m
print 'The matplotlib rc file is', m.matplotlib_fname()


# Set default svg:  publish quality images.
from IPython.zmq.pylab import backend_inline
cfg = backend_inline.InlineBackendConfig.instance()
cfg.figure_format = 'svg' # 'png' / 'svg'



# Control saving:  keep the nice images for .pdf inclusion.
from IPython.zmq.pylab.backend_inline import InlineBackendConfig
InlineBackendConfig.instance().figure_format = 'svg'



print m.rcParams['figure.


# print m.rcParams['figure.figsize'] # default plot size
# m.rcParams['figure.figsize'] = (11, 7.7) # double it
# print m.rcParams['lines.linewidth'] # this gives 2 though I set 1.
m.rcParams['lines.linewidth'] = (1) # half it
#m.rcParams['savefig.dpi'] = 80 # changes displayed figure size
m.rcParams['axes.grid'] = True

scale=1
m.rcParams['legend.fontsize'] = 10/scale
m.rcParams['axes.labelsize'] = 12/scale
m.rcParams['figure.figsize'] = (12/scale, 8/scale)
m.rcParams['font.size'] = 10/scale # numbers
m.rcParams['legend.fontsize'] = 10/scale # numbers

# Affects all scaling.  Set scale linearly with this value.  80 looks good onscreen.
m.rcParams['savefig.dpi'] = 80 

m.rcParams['grid.linewidth'] = 0.5/scale
m.rcParams['lines.linewidth'] = 0.5/scale # data lines

# matplotlib.rcParams['legend.frameon'] = False
# Doing this screws the plot size, after I updated.

m.rcParams['axes.titlesize'] = 12./scale
m.rcParams['axes.titlesize'] = 12./scale

m.rcParams['grid.linestyle'] = '-'
m.rcParams['grid.color'] = '0.85'

# These prevent two line titles and axis labels overlapping.
m.rcParams['figure.subplot.hspace'] = 0.4 # 0.3 default.
m.rcParams['figure.subplot.wspace'] = 0.3 # 0.2 default.

# experimental from 
# http://nerdjusttyped.blogspot.co.uk/2010/07/type-1-fonts-and-matplotlib-figures.html
# This causes, `type 1 fonts' instead of the default type 3.
# Really, I'm trying to change from .png to .pdf plots.
m.rcParams['ps.useafm'] = True
m.rcParams['pdf.use14corefonts'] = True
m.rcParams['text.usetex'] = True

images in ipython notebook


subplot(221); title('19 degree flare. v22_y10-22-3')
imshow(imread('/home/me/Documents/acoustics/v22_y10-22-3-mesh.png'))



or, say:

def showImage(n=221, fn, title):
    """Convenience image display function"""
    subplot(n, frameon=False)
    title(title)
    ims = imread(fn)
    xticks([]); yticks([])

    imshow(ims)

showImage(221, 'myfile.png', 'This is my image!')

*Update*

The notebook now supports image inclusion via html:  this is better as the formatting is simple(r) and the functionality is built in.


Wednesday, 17 July 2013

femap

http://www.plm.automation.siemens.com/en_us/products/velocity/femap/free-femap.shtml

PIGS linux

cd ~/downloads/pafec/pigs/pafec/pigs88/run
./PIGSWIN.exe

or

pigs


Then load the BS with full filename path.

~/Documents/FT/pafec/commandsToGetPIGSworking.txt outlines the steps taken to get pigs up on linux.

Saturday, 13 July 2013

mplayer fav. command

mplayer -nosub -fs -geometry 1920x1200+0+0 -screenw 1920 -screenh 1200  -zoom  dir/*/*

linux audio

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC898 Analog [ALC898 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC898 Digital [ALC898 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 2: ALC898 Analog [ALC898 Analog]
  Subdevices: 2/2
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1



$ cat /proc/asound/devices
  1:        : sequencer
  2: [ 0- 2]: digital audio capture
  3: [ 0- 1]: digital audio playback
  4: [ 0- 1]: digital audio capture
  5: [ 0- 0]: digital audio playback
  6: [ 0- 0]: digital audio capture
  7: [ 0- 0]: hardware dependent
  8: [ 0]   : control
  9: [ 1- 9]: digital audio playback
 10: [ 1- 8]: digital audio playback
 11: [ 1- 7]: digital audio playback
 12: [ 1- 3]: digital audio playback
 13: [ 1- 0]: hardware dependent
 14: [ 1]   : control
 33:        : timer


ms@ms:~$ arecord -L
default
    Playback/recording through the PulseAudio sound server
sysdefault:CARD=PCH
    HDA Intel PCH, ALC898 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    Front speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Digital
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    Direct sample mixing device
dmix:CARD=PCH,DEV=1
    HDA Intel PCH, ALC898 Digital
    Direct sample mixing device
dmix:CARD=PCH,DEV=2
    HDA Intel PCH, ALC898 Analog
    Direct sample mixing device
dsnoop:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    Direct sample snooping device
dsnoop:CARD=PCH,DEV=1
    HDA Intel PCH, ALC898 Digital
    Direct sample snooping device
dsnoop:CARD=PCH,DEV=2
    HDA Intel PCH, ALC898 Analog
    Direct sample snooping device
hw:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    Direct hardware device without any conversions
hw:CARD=PCH,DEV=1
    HDA Intel PCH, ALC898 Digital
    Direct hardware device without any conversions
hw:CARD=PCH,DEV=2
    HDA Intel PCH, ALC898 Analog
    Direct hardware device without any conversions
plughw:CARD=PCH,DEV=0
    HDA Intel PCH, ALC898 Analog
    Hardware device with all software conversions
plughw:CARD=PCH,DEV=1
    HDA Intel PCH, ALC898 Digital
    Hardware device with all software conversions
plughw:CARD=PCH,DEV=2
    HDA Intel PCH, ALC898 Analog
    Hardware device with all software conversions
ms@ms:~$

ubuntu install initramfs unable to find a medium containing a live file system

Occurred with booting from usb drive with my Republic of Gamers Mobo, Maximus V Formula/ThunderFX (which I now regret buying).

Changing to a different USB port fixed this.

Friday, 12 July 2013

nvidia ubuntu 3D acceleration broken

Turned computer on.  Previously working.  Now not.  Reason unknown.  Login screen is in chunko-vision.  Fluxbox looks terrible.  Logging out and returning to the login screen restores normal resolution (WHY?!).  Logging into 3D Unity looks ok but I think is sluggish.

Now I have to spend some of the little free time I have dicking around trying to get this working again.

I had the nvidia closed source driver working ok.

So, some commands and results:

me@me:~$ sudo lshw -c video
[sudo] password for me:
  *-display              
       description: VGA compatible controller
       product: NVIDIA Corporation
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:16 memory:f6000000-f6ffffff memory:e8000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:f7000000-f707ffff


me@me:~$ glxinfo | grep dire
Xlib:  extension "NV-GLX" missing on display ":0.0".
direct rendering: No (If you want to find out why, try setting LIBGL_DEBUG=verbose)


me@me:~$ sudo nvidia-settings

You do not appear to be using the NVIDIA X driver.  Please edit your X configuration file (just run `nvidia-xconfig' as root), and restart the X server.

me@me:~$ sudo nvidia-xconfig

Using X configuration file: "/etc/X11/xorg.conf".
Backed up file '/etc/X11/xorg.conf' as '/etc/X11/xorg.conf.backup'
New X configuration file written to '/etc/X11/xorg.conf'


Portion of interest in xorg.conf:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "NoLogo" "True"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection



me@me:~$ cat /etc/ld.so.conf.d/steam.conf
/usr/lib32
/usr/lib/i386-linux-gnu/mesa



ms@ms:~$ sudo vdpauinfo

display: :0.0   screen: 0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1


me@me:~$ lspci -v
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1189 (rev a1) (prog-if 00 [VGA controller])
        Subsystem: Giga-byte Technology Device 3542
        Flags: bus master, fast devsel, latency 0, IRQ 16
        Memory at f6000000 (32-bit, non-prefetchable) [size=16M]
        Memory at e8000000 (64-bit, prefetchable) [size=128M]
        Memory at f0000000 (64-bit, prefetchable) [size=32M]
        I/O ports at e000 [size=128]
        Expansion ROM at f7000000 [disabled] [size=512K]
        Capabilities:
        Kernel driver in use: nvidia

        Kernel modules: nvidia, nvidia_current, nvidia_experimental_310, nouveau, nvidiafb

(No mention of the specific graphics card and an unexpected noveau entry)

According to http://www.cyberciti.biz/faq/linux-tell-which-graphics-vga-card-installed/ there should be something about my card in there, in a line with `vga':

ms@ms:~$ lspci -v | grep vga

Not a thing.  More from that page:

me@me:~$ sudo update-pciids
[sudo] password for ms: 

Downloaded daily snapshot dated 2013-07-12 03:15:02

No change to the lspci vga output.

me@me:~$ sudo lshw -C video
  *-display               
       description: VGA compatible controller
       product: GK104 [GeForce GTX 670]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0

       resources: irq:16 memory:f6000000-f6ffffff memory:e8000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:f7000000-f707ffff

So lshw appears to detect the card but shows its clock to be at 33MHz?  Odd.

me@me:~$ sudo apt-get install mesa-utils

already installed.

$ glxinfo

name of display: :0.0
Xlib:  extension "NV-GLX" missing on display ":0.0".
display: :0  screen: 0
direct rendering: No (If you want to find out why, try setting LIBGL_DEBUG=verbose)
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
    GLX_ARB_multisample, GLX_EXT_visual_info, GLX_EXT_visual_rating, 
    GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_OML_swap_method, 
    GLX_SGI_make_current_read, GLX_SGIS_multisample, GLX_SGIX_fbconfig, 
    GLX_SGIX_pbuffer, GLX_MESA_copy_sub_buffer, GLX_INTEL_swap_event
client glx vendor string: NVIDIA Corporation

client glx version string: 1.4

Search for 

`Xlib:  extension "NV-GLX" missing on display ":0.0".'

http://askubuntu.com/questions/312680/nvidia-xlib-extension-nv-glx-missing-on-display-0-0-ubuntu-13-04
*snip* I eventually uninstalled everything and used bumblebee only (in case it helps you solve my problem or for people having a hard time installing their nvidia drivers).*snip*

Hmmm.  Following something from that page:


me@me:~$ nvidia-detector
none

Odd.  The page did not show a resolution and mentioned use of bumblebee.  I don't thing I used it:  apt-get doesn't know it.  My video was working fine a few days ago......

So I looked in /var/log/:

me@me~: ls -lha /var/log/Xorg*
This showed a new file and an old one (from a couple of weeks ago, when things were ok).  Differences:


[ 14438.354] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[ 14438.397] (II) Module glx: vendor="NVIDIA Corporation"
[ 14438.397]    compiled for 4.0.2, module version = 1.0.0
[ 14438.397]    Module class: X.Org Server Extension
[ 14438.397] (II) NVIDIA GLX Module  304.64  Tue Oct 30 11:18:32 PDT 2012

Changed to,

[    88.159] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    88.159] (II) Module glx: vendor="X.Org Foundation"
[    88.159]    compiled for 1.11.3, module version = 1.0.0
[    88.159]    ABI class: X.Org Server Extension, version 6.0
[    88.159] (==) AIGLX enabled

So it looks like the nvidia driver is not being loaded.  Later,


[ 14438.413] (II) LoadModule: "nvidia"
[ 14438.413] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[ 14438.438] (II) Module nvidia: vendor="NVIDIA Corporation"
[ 14438.438]    compiled for 4.0.2, module version = 1.0.0
[ 14438.438]    Module class: X.Org Video Driver
[ 14438.438] (II) NVIDIA dlloader X Driver  304.64  Tue Oct 30 10:59:51 PDT 2012
[ 14438.438] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[ 14438.438] (++) using VT number 7

changed to,

[    88.160] (II) LoadModule: "nvidia"
[    88.160] (WW) Warning, couldn't open module nvidia
[    88.160] (II) UnloadModule: "nvidia"
[    88.160] (II) Unloading nvidia
[    88.160] (EE) Failed to load module "nvidia" (module does not exist, 0)

More confirmation of a driver problem.  Later the broken one (the current one) showed,

[    88.160] (II) LoadModule: "nouveau"
[    88.160] (II) Loading /usr/lib/xorg/modules/drivers/nouveau_drv.so
[    88.160] (II) Module nouveau: vendor="X.Org Foundation"
[    88.160]    compiled for 1.11.3, module version = 0.0.16
[    88.160]    Module class: X.Org Video Driver
[    88.160]    ABI class: X.Org Video Driver, version 11.0

while the old, working log had no mention of nouveau.

OK.  I'm going to uninstall my video drivers as best I can and start this again.....  Nervous.  Back to unity and I'll turn off the video drivers.

me@me:~$ jockey-text -l
xorg:nvidia_current - NVIDIA accelerated graphics driver (Proprietary, Disabled, Not in use)
xorg:nvidia_current_updates - NVIDIA accelerated graphics driver (post-release updates) (Proprietary, Disabled, Not in use)
xorg:nvidia_experimental_304 - NVIDIA accelerated graphics driver (**experimental** beta) (Proprietary, Disabled, Not in use)
xorg:nvidia_experimental_310 - NVIDIA accelerated graphics driver (**experimental** beta) (Proprietary, Enabled, In use


me@me:~$ sudo nvidia-xconfig

me@me:~ sudo restart lightdm
 
Other logs of interest:
 
/var/log/nvidia-installer.log (apr 14)
/var/log/jockey.log  
 
A reset:  No improvement and the nvidia driver is reported 
by unity settings as in use.  I removed it via the settings menu.  A reset
 and now resolution looks normal but /var/log/Xorg.0.log shows the same nvidia
complaints as above.  Why is it even being looked for now?  It seems that video drivers
are not well managed in ubuntu.  :(
 
me@me:~$ sudo nvidia-xconfig

WARNING: Unable to locate/open X configuration file.

New X configuration file written to '/etc/X11/xorg.conf'
 
That's new.  Before I removed the driver, there was a different complaint.  I checked the linux headers, they seem fine.
Restart again now the new xorg.conf has been written.
 
Oh good.  Back to low resolution.  :(  Checking the xorg log file, there is still no nvidia driver.  OK.  Re-enable via system settings gui.
 
 
=============================== Four hours later ===========================
 
Attempts to install Ubuntu 13 have failed.  The USB installer is fine. On reboot, system locks during release of initfs.  I tried different drive ports
and many different bios settings.  Going back to 12.
 
:(
 
What a waste of a day. 
 
ms@ms:~$ jockey-text --list | grep nvidia
xorg:nvidia_current - NVIDIA accelerated graphics driver (Proprietary, Disabled, Not in use)
xorg:nvidia_current_updates - NVIDIA accelerated graphics driver (post-release updates) (Proprietary, Disabled, Not in use)
xorg:nvidia_experimental_304 - NVIDIA accelerated graphics driver (**experimental** beta) (Proprietary, Disabled, Not in use)
xorg:nvidia_experimental_310 - NVIDIA accelerated graphics driver (**experimental** beta) (Proprietary, Enabled, In use)
 
 
 yet xorg.0.log still complains.
 
me@me:~$ modinfo nvidia_experimental_310
filename:       /lib/modules/3.2.0-49-generic/updates/dkms/nvidia_experimental_310.ko
alias:          char-major-195-*
version:        310.14
supported:      external
license:        NVIDIA
alias:          pci:v000010DEd00000E00sv*sd*bc04sc80i00*
alias:          pci:v000010DEd00000AA3sv*sd*bc0Bsc40i00*
alias:          pci:v000010DEd*sv*sd*bc03sc02i00*
alias:          pci:v000010DEd*sv*sd*bc03sc00i00*
depends:        
vermagic:       3.2.0-49-generic SMP mod_unload modversions 
parm:           NVreg_Mobile:int
parm:           NVreg_ResmanDebugLevel:int
parm:           NVreg_RmLogonRC:int
parm:           NVreg_ModifyDeviceFiles:int
parm:           NVreg_DeviceFileUID:int
parm:           NVreg_DeviceFileGID:int
parm:           NVreg_DeviceFileMode:int
parm:           NVreg_RemapLimit:int
parm:           NVreg_UpdateMemoryTypes:int
parm:           NVreg_InitializeSystemMemoryAllocations:int
parm:           NVreg_RMEdgeIntrCheck:int
parm:           NVreg_UsePageAttributeTable:int
parm:           NVreg_EnableMSI:int
parm:           NVreg_MapRegistersEarly:int
parm:           NVreg_RegisterForACPIEvents:int
parm:           NVreg_CheckPCIConfigSpace:int
parm:           NVreg_RegistryDwords:charp
parm:           NVreg_RmMsg:charp
 
 
me@me:~$ cat /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 304.48  (buildmeister@swio-display-x86-rhel47-05.nvidia.com)  Sun Sep  9 21:29:02 PDT 2012

Section "Monitor"
 Identifier     "Monitor0"
 VendorName     "Unknown"
 ModelName      "Unknown"
 HorizSync       28.0 - 33.0
 VertRefresh     43.0 - 72.0
 Option         "DPMS"
EndSection

Section "Screen"
 Identifier     "Screen0"
 Device         "Device0"
 Monitor        "Monitor0"
 DefaultDepth    24
 SubSection "Display"
  Depth       24
 EndSubSection
EndSection

Section "InputDevice"
 Identifier     "Mouse0"
 Driver         "mouse"
 Option         "Protocol" "auto"
 Option         "Device" "/dev/psaux"
 Option         "Emulate3Buttons" "no"
 Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
 Identifier     "Keyboard0"
 Driver         "kbd"
 # generated from default
EndSection

Section "ServerLayout"
 Identifier     "Layout0"
 Screen      0  "Screen0"
 InputDevice    "Keyboard0" "CoreKeyboard"
 InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Device"
 Identifier     "Device0"
 Driver         "nvidia"
 VendorName     "NVIDIA Corporation"
 Option "NoLogo" "True"
EndSection
 

=========================

Fix:  complete re-install from CD.  Reinstall from usb stick failed with 13 with `unable to write to /EFI'
or something.  12 installed and refused to boot.  Install from CD only!

Wednesday, 10 July 2013

Thursday, 4 July 2013

on my kindle I am root.

http://www.turnkeylinux.org/blog/kindle-root



amazing!

Copy files over as,

scp file root@192.168.1.80:/mnt/base-us/documents/


To update to include the new documents hold the power switch for a few seconds.  The screen goes blank.   Slide the switch again and the documents should be present.

Using %debug with ipython notebook!

:)

Run the notebook.  Get connection details with,

In [315]: connect_info


{ "stdin_port": 54645, "ip": "127.0.0.1", "hb_port": 37889, "key": "12dafc68-dff1-4e17-a4be-58fb059cc198", "shell_port": 52893, "iopub_port": 35633 } Paste the above JSON into a file, and connect with: $> ipython --existing or, if you are local, you can connect with just: $> ipython --existing kernel-0b0b2631-03c4-4d7b-8f7b-a18bc76e976d.json or even just: $> ipython --existing if this is the most recent IPython session you have started.

and open a second terminal. Connect to the existing notebook server with,

ipython qtconsole --existing kernel-0b0b2631-03c4-4d7b-8f7b-a18bc76e976d.json

and the new window pops up with %debug ability.

The easiest way, I found, was to type,


$ ipython qtconsole --existing

ipython header for document preparation and publication quality plotting.


# hideOutput
# Document generation.  If problem run from shell the commands one by one.
docroot = '/home/starnesm/projects/FT/ipython/'
a = '20130607-v9Transducer'

from reference import hideIpythonCells as hideIpythonCells
from IPython.zmq.pylab import backend_inline
from IPython.zmq.pylab.backend_inline import InlineBackendConfig
import subprocess as sub # for calling o/s commands like, `pdflatex'
from scipy.interpolate import interp1d
from reference import counter as counter # color cycling.

out, err = sub.PIPE, sub.STDOUT # for bash commands.

# Set the plot defaults to svg:  png is tough to make look good in latex.
cfg = backend_inline.InlineBackendConfig.instance()
cfg.figure_format = 'svg' # 'png' / 'svg'
InlineBackendConfig.instance().figure_format = 'svg'

coms = ['cd %s; ' % docroot]
coms[0] += 'nbconvert2.py latex_base --no-stdout --write=True %s.ipynb' % a # 0
coms.append('cp %s%sNoCode.tex %s%s_files/' % (docroot, a, docroot, a)) # 1
coms.append('for i in %s%s_files/*.pdf; do mv $i ${i%%.pdf}.svg; done' % (docroot, a)) # 2
coms.append('cd %s%s_files; pdflatex --shell-escape %sNoCode.tex' % (docroot, a, a)) # 3
    
# original form discards the output, making for difficult debug:
p = []
p.append(sub.call(['/bin/bash', '-c', coms[0]], stdout=out, stderr=err)) # convert
hideIpythonCells('%s%s' % (docroot, a)) # update
p.append(sub.call(['/bin/bash', '-c', coms[1]], stdout=out, stderr=err)) # copy
p.append(sub.call(['/bin/bash', '-c', coms[2]], stdout=out, stderr=err)) # rename
p.append(sub.call(['/bin/bash', '-c', coms[3]], stdout=out, stderr=err)) # compile



Wednesday, 26 June 2013

python timing

With ipython:

In [1]:  timeit test = extractPhase2(Vin = res['C120130515-00000'][0:l], \
            Vout = res['C220130515-00000'][0:l], \
            pointsPerCycle = 30.0, cycles = 1, debug=0)


1 loops, best of 3: 7.88 s per loop

Wednesday, 19 June 2013

save matplotlib pylab plots

import matplotlib.pyplot as plt

plt.plot(range(4))
plt.savefig("test.png", format='png')

and / or


a = subplot(221)
a.plot(range(4))
savefig('test2.png', format='png')

Monday, 17 June 2013

standard deviation and rms values


from 20130510-WindTunnelMeas.ipynb


The formula used for calculating rms values was, $rms = \sqrt{ \frac{1}{n} \sum{x^{2}} }$

The standard deviations are of the quantity described and
were calculated using the population standard deviation calculation:
$std = \sqrt{ \frac{ \sum{ (x_{i} - \overline{x}) }^2}{n}} = \sqrt{variance}$.

It is clear that the standard deviation forms an rms like parameter, but using the
difference between each value and the mean, rather than the values themselves.  std should
therefore be compared to rms values, not amplitude values.