Archive for November, 2012

Updating Scisoft from 7.5 to 7.7 in Fedora 14

Posted November 23, 2012 By grigoris

Updating Scisoft in Fedora is rather easy (see the installation details). First if we have already a previous installation we can easily remove it by running (as root):

yum remove scisoft-\*

and check that the directory /scisoft has been totally removed (if something extra has been added the we should still see the scisoft directory with all the extras inside).
Then, we follow the same steps as the first time (for example see this installation notes). Since we are updating then the repository file should already exist. We don’t have anything more to do than just to edit the file /etc/yum.repos.d/scisoft.repo and edit the line containing the baseurl:


[scisoft]
name=Scisoft
baseurl=ftp://ftp.eso.org/scisoft/scisoft7.7/linux/fedora11/yum-repo
gpgcheck=0
enabled=1

Actually we just replace …7.5/… with …7.7/… . Then we install the scisoft normally:


yum clean all
yum install scisoft-\*

and everything should be just fine!

NOTE: during this installation only the scisoft-idllib-7.7.0-0.i386 was not installed due to the lack of scisoft-idl. And that’s … because it is not included (along with SuperMongo) as they are paid versions.
The installation can be skipped by using — skip-broken (after all, no need for IDL since we get Python 2.7.2 and Matplotlib 1.1.0!!!).

Linux backup and restore filesystem –notes

Posted November 23, 2012 By grigoris

A quick note on how to backup and restore (if necessary) the filesystem. We go to the root directory (/) and as root we run:

tar cvpzf backup.tgz --exclude=/lost+found --exclude=/backup.tgz /

c: create new archive
v: verbose
p: preserve permissions
z: gzip
f: use file (name of file=backup.tgz)

We exclude all the directories that we don’t want to back up (and especially the backup file itself!) and … run it!

In order to restore the system, we go again to the root directory and (as root) we run:

tar xvpfz backup.tgz -C /

WARNING: this will overwrite everything we have under your root directory (everything … means everything!).

-C: change to directory

After that, we re-create the excluded directories (like: mkdir lost+found) and we reboot our system!

[source]

matplotlib: missed errorbars in logarithmic plot

Posted November 22, 2012 By grigoris

While manipulating some data I came across to, what looked, a strange behavior with the errorbar of matplotlib, when plotting the results from linear to logarithmic scale.

Suppose these data:

import matplotlib.pyplot as plt
import numpy as np

s=[19.0, 20.0, 21.0, 22.0, 24.0]
v=[36.5, 66.814250000000001, 130.17750000000001, 498.57466666666664, 19.41]
verr=[0.28999999999999998, 80.075044597909169, 71.322124839818571, 650.11015891565125, 0.02]
plt.errorbar(s,v,yerr=verr)
plt.show()

and the result looked like this:

where the errorbars are obviously visible, but when I switched to the logarithmic scale, by using:

plt.yscale('log')
plt.show()

then the result was this:

where some errorbars are not visible (although their caps are still visible). So, what is going on?

I couldn’t figure out what was the problem, so I asked at StackOverflow. I got an answer by “Dan”, in which he pointed to the fact that some of the errors were (that large) that led to negative values (not valid for log). That’s why they were not displayed. The solution was to use asymmetric errors, by substituting basically the negative error values with a value close to 0 (actually the plotted value, but slightly over 0).
The piece of code that corrected the display is:

import matplotlib.pyplot as plt
import numpy as np

s=[19.0, 20.0, 21.0, 22.0, 24.0]
v=np.array([36.5, 66.814250000000001, 130.17750000000001, 498.57466666666664, 19.41])
verr=np.array([0.28999999999999998, 80.075044597909169, 71.322124839818571, 650.11015891565125, 0.02])
verr2 = np.array(verr)
verr2[np.where(v-verr<=.0)] = v[np.where(v-verr<=.0)]*.999999 plt.errorbar(s,v,yerr=[verr2,verr]) plt.ylim(1E1,1E4) plt.yscale('log') plt.show()

with the final output (by adjusting also the axes):

Neptune and Triton from Skinakas

Posted November 4, 2012 By grigoris