2008/11/13

Dynamic multiple inheritance

I am having a little problem with the offline measurement on the linac. My task in the linac is to produce an application to measure the electron beam energy and emittance. A long a go, we start to document it on the Alba's site.

The idea of the offline measurement was on means of all, but not so clear because we did some offline with data from other synchrotrons. But now we like to repeat the measurements we already did with our linac. Always when a measurement had been launch we store the images. Then the offline is to reload the images and deceive the system like this is real.

Problems about we didn't take care before are, for example, the magnets doesn't move precisselly to the ordered position; there is a threshold on that. And when the fit will be repeated offline we have to use the old magnet values, not the dummy motors how we use to simulate that.

Then something specific has to be programed to do this. We had macros to do the online measurements and they are not usable to load data from an old session for the offline measurement. Ok, then we need a new macro:


But, the offline macro needs to be the same to simulate energy or emittance. Then the inheritance, apart to be multiple, has to be dynamically changed...

Why not an instance? Why not all the macros only inherit from 'Macro' and has an instance of __energy or __emittance? Because the three on top right uses methods from the 'Macro' class.

class A:
def method(self):
print "A"
def methodA(self):
print "AA"

class B:
def method(self):
print "B"
def methodB(self):
print "BB"

class C:
def setA(self):
self.__class__.__bases__ = (A,)
def setB(self):
self.__class__.__bases__ = (B,)
def setAB(self):
self.__class__.__bases__ = (A,B)
def setBA(self):
self.__class__.__bases__ = (B,A)

Ok, then what can be done is:
c = C()

c has 4 methods: {c.setA(),c.setB(),c.setAB(),c.setBA}

c.setA()
now has 2 methods more {c.setA(),c.setB(),c.setAB(),c.setBA,c.method(),c.methodA()}

with a call c.setB() the list of methods changes to {c.setA(),c.setB(),c.setAB(),c.setBA,c.method(),c.methodB()}

c.setAB()
now the list of methods is
{c.setA(),c.setB(),c.setAB(),c.setBA,c.method(),c.methodA(),c.methodB()}
and notice the call c.method() uses the one from A.

with c.setBA()
the list is the same, but now the c.method() uses the one from B.

Actualization: Be careful if you use multiple objects using this. If we have multiple instances, the modification affects all of them:
c1 = C()
c2 = C()
c1.setA()
c1.method()
A
c2.setB()
c2.method()
B
c1.method()
B

2008/11/12

OpenMoko is moving

Finally I see some movement on Openmoko to say that is trying. I don't have the device but I have it running in qemu as I wrote a long ago.

Some (sub)communities starts movements creating contents with more proximity to the potential clients. Many of us are convinced to support Openmoko because we support free software on our bones, but the world is full of people who doesn't care about that and other techniques are need.

For example this case of an spanish community who are writing a wiki from a non technical point of view, more in a propagandistic way to be proximus to the final user.

Thanks the communities and feel free!

2008/09/19

Extremophile

After the land of the Phoenix in the Mars arctic, with the first results of the high salinity of the ground, I read some articles about the water is not the only one restriction to allow life.

In out planet we have places where the life exist under extreme conditions. This type of life we call it Extremophile. Working in a synchrotron I am curioused, specifically with the life that is able to be in extreme radiological conditions. I don't know how a bacteria can protect and repair what the radiation breaks, but what about the parasitoid wasp? Wikipedia says this complex life can support a hundred times more of radiation than the humans.

A few a go I read about the survivance in space conditions of the Tardigrade. It's impressive how this lifes can survive to the void with high radiation doses.

2008/09/13

how (software) patents can bother your development

Yesterday, I receive an answer from Jivson (the author of the 'ECC in OpenPGP' internet draft) from a couple of mails discussing something about how to play with the standard to made easy some future improvements.

I'm working in an improvement of the eccGnuPG project to add the feature to reset the cryptosystem using isogeny stars like Er Rostovtsev, Anton Stolbunov propouse.

To create this isogeny stars can be usefull that they have a cofactor 2 (or at most 4, like the standards recomend) in order to have easier ways to compute a path in the stars. My surprice arribes when Jivson draws me the attention on the point that cofactor division is under a patent.

I trust on it, but I cannot find this yet. Maybe this idea with I'm working now, will be patented by someone else some day. And I can be obligated again to drop some work because an stupid patent. This is the third time that patents bother my work on elliptic curves.

This is incredible, simply unacceptable.

2008/09/12

Milky Way center candidate

Continuing with the reading of Nature's last week (September, 4th), in a letter about candidate of our galaxy center I'm thinking about how hard can be to deduce who is the center of the galaxy.

Looking on another galaxy, with a good perspective on it, can be possible to approach to know around which structure the galaxy turns around. But when we are looking from in side this can be not so easy. As an example, the center of a galaxy is so briliant, but in a clear night from the Earth the center of the Milky way is not visible. We need to study it in the infrared spectrum, for example, because of the objects that are in the middle who block the visible light.

When we look to the center of the galaxy we are looking to the past because it's far from here, and the light expends 24k8 light years, to travel the 7k6 parsecs. Looking Andromeda we have a prespective that shows us objects from a similar time, but from inside our galaxy the light of diferent objects arribes here from different historyc moments.

By the way, our candidate as a center is Sagittarius A*, a supermassive black hole that can have 4 million solar masses, with in an space that can be 45 AU. (realize that all the planets in our solar system are closer to the sun than this distance).

2008/09/11

recicling photographed conference slides

I'm reading in the Nature of last week (September, 4th) about the nervousness of some scientist with the colleges that goes to a conference and takes photos with digital cameras and uses the data for their own publications.

I cannot definitely understand this position. The first ones, the lecturers are presenting some data in public and they can have the title of the first of publish it. At the same time this can be used as a base of the next publication upgrade, or to find any mistake that exists.

In this second possibility, imagine that in this PAMELA presentation they announce the dark matter detection (implies existence) with a mistaken proves that no one in the conference can study because of their obscurity. I'm not saying they should did mistakes, I'm saying not other scientist can check it. Yes, they like to review with some other colleges chosen by themselves, but this doesn't mean publish.

If they don't trust a 100% to their study why they publish it? Because no one else publish it before but saving the dress if they made a mistake? Oh, please! This have more sense in politics, or some where than the only important think is naming. There is no price for the second who discover dark matter, I understand it. But what happens if another scientist team is closer to the verified results and publish it; will this ones says 'they copy it from us' with an ultra-hidden camera in the conference?

Actualization: Reading more about this column in Nature, I understand the problem is more because the copyright of many publications than specifically because the scientist doesn't like it. Many times the slides are published after the conference, but the problem can come when the journals decides which data can be publish out them. How is the owner of the investigations?

2008/09/03

New expired patent

A few days before the ephemeris of the expiration of the RSA patent an obsolete new one arribes from Microsoft. Remember in September 20th 2000 expires a patent from the 1983 (about an algorithm invented in 1977) how license exclusivelly the rsa company to explode the use of:

c = m^e (mod n)

Patent it's suposed to mean a technological advance that the company developer needs to has an exclusive to explodes in term of refund the inversion. But if you (and me) think what can be a discover when the algorithm date from 6 years before, we will not understand about the new microsoft patent...

How can be, now a day, patented the ``Page Up'' and ``Page Down''? Read in many places about this question (spanish, english). For how long this keys are in the keyboards doing the task recently patented?