Monday, 15 April 2013
pandas: updating a row.
# remove a row, and append it again. I need to remove a Ze value at a freq, and update it with a new value.
# Don't think I can update the value directly.
print df # original shows all rows
tmp = df[abs(df['A'] - -0.671540) < 1E-3] # copy
df = df[abs(df['A'] - -0.671540) > 1E-3] # this shows the first index to be removed.
print df
print df.append(tmp, ignore_index = True)
Sunday, 14 April 2013
Updating NVIDIA drivers broke gw2 and steam
I downloaded the latest nvidia binary and installed it. I said, `yes' to install 32 bit stuff. On reset, X did not start up.
I think. I may have attempted to change the NVIDIA binary version via Ubuntu's software manager (gui); reset and found X to fail: and accessed the nvidia site; downloaded the lastest, installed, saying 'yes'. Restart: x started ok but Gw2 now will not start via playonlinux and the terminal shows something about OpenGL not being installed.
I attempted to install Steam, hoping it would fix things. It didn't.
Follwing https://github.com/ValveSoftware/steam-for-linux/issues/321,
Carlos Jenkins suggested adding,
I think. I may have attempted to change the NVIDIA binary version via Ubuntu's software manager (gui); reset and found X to fail: and accessed the nvidia site; downloaded the lastest, installed, saying 'yes'. Restart: x started ok but Gw2 now will not start via playonlinux and the terminal shows something about OpenGL not being installed.
I attempted to install Steam, hoping it would fix things. It didn't.
Follwing https://github.com/ValveSoftware/steam-for-linux/issues/321,
Carlos Jenkins suggested adding,
/usr/lib32
/usr/lib/i386-linux-gnu/mesa
to
/etc/ld.so.conf.d/steam.conf
and doing,
sudo ldconfig
This fixed gw2 and steam.
Friday, 12 April 2013
A Python counter. Using it for colour incrementing.
class z:
"""Counter. My first!
Instantiate with number of items between 0 and 1.
Calling the class will return an incrementing value.
"""
def __init__(self, n):
self.n = n
self.i = -1
def __call__(self):
"""This gets called when the instantiated object is called"""
if self.i == self.n:
raise StopIteration
self.i += 1
return self.i * 1.0 / (self.n - 1)
In [1]: a = z(10)
In [2]: print a(), a(), a(), a(), a(), a(), a(), a(), a(), a()
0.0 0.111 0.222 0.333 0.444 0.555 0.666 0.777 0.888 1.0
(Those results are truncated ;) )
Use to control colour as,
from matplotlib import cm
a = z(10)
plot(x, y, color=cm.jet(a))
plot(x2, y2, color=cm.jet(a))
plot(x3, y3, color=cm.jet(a))
Thursday, 21 March 2013
1D extrapolation with scipy
from scipy.interpolate import interp1d
f = interp1d(motorExtrap.Frequency.values,
motorExtrap['dBP, 72m3perH'].values) # spline coeffs.
plot(motorExtrap.Frequency, motorExtrap['dBP, 72m3perH'], '+-') # original
plot(powerInMelamine.Freq, f(powerInMelamine.Freq), '+-') # linearly interpolated.
Thursday, 7 March 2013
installing gmsh
At the moment, my favourite method is to download the automated nightly build, extract and run the binary from there.
Tuesday, 26 February 2013
subfig and figure parameters.
Adjusting caption behaviour:
singlelinecheck=True : sets centre justified if a one line caption.
parskip=5pt : Set a vertical gap when a new paragraph starts in the caption.
hangindent=10pt : Lines other than the first line in each paragraph are indented by 10pt.
indention = 10pt : All lines are indented equally. Combining this with hangindent results in lines other than the first being indented more.
The singlelinecheck results in left justified short captions; not nice to my eye.
The caption width matches that of the figure unless margin is specified,
margin=10pt sets a gap, both sides around the caption relative to the figure.
format = hang seems to set the subfig label (a / b / c etc) away from the caption body. Ugly, imho.
Set with, for example,
\captionsetup[subfigure]{style=default, indention=10pt}
\captionsetup[figure]{width=0.8\textwidth, indention=5pt}
singlelinecheck=True : sets centre justified if a one line caption.
parskip=5pt : Set a vertical gap when a new paragraph starts in the caption.
hangindent=10pt : Lines other than the first line in each paragraph are indented by 10pt.
indention = 10pt : All lines are indented equally. Combining this with hangindent results in lines other than the first being indented more.
The singlelinecheck results in left justified short captions; not nice to my eye.
The caption width matches that of the figure unless margin is specified,
margin=10pt sets a gap, both sides around the caption relative to the figure.
format = hang seems to set the subfig label (a / b / c etc) away from the caption body. Ugly, imho.
Set with, for example,
\captionsetup[subfigure]{style=default, indention=10pt}
\captionsetup[figure]{width=0.8\textwidth, indention=5pt}
Subscribe to:
Posts (Atom)