All the data is filled with NAN because the energize function tries to sqrt a negative number, which should not be happening.