You are not logged in.

#1 2009-02-21 09:28:45

navaburo
Member
From: NYC
Registered: 2009-01-18
Posts: 11
Website

Accelerometer Issue with Mathematica - klis3lv02d

Whenever I plot a particular parametric3D plot in Mathematica 7 and then manually rotate it around I get huge spikes in X's CPU usage (expected) which then drops a few seconds after I finish rotating X's usage drops (also expected). What is NOT expected is that my accelerometer driver (klis3lv02d) starts using 30% of my CPU during and after rotating. It will continue to do this even after closing that origonal mathematica notebook, only relaxing after I exit from or kill mathematica.

I am running an HP nw8440 notebook with everything stock except an upgraded harddrive.

I am fully aware that Mathematica is not supported, and may not play nicely with the FOSS universe, but this is a very strange behavior which I thought should be reported!

Here's the offending mathematica code if anyone is curious (it's for visualizing the time evolution of spin 1/2 system in quantum mechanics):

DoubleBallMap[v_]:={Extract[v,{3}],Extract[v,{4}],Sign[Extract[v,{2}]]*(Extract[v,{1}]+1)/2}/Sqrt[Sum[Extract[v,{\[Mu]}]^2,{\[Mu],1,4}]];
C2toR4[v_]:={Re[Extract[v,{1}]],Im[Extract[v,{1}]],Re[Extract[v,{2}]],Im[Extract[v,{2}]]};
SpinKet[\[Beta]_,t_] := List[Sin[\[Beta]/2]Exp[-I 2\[Pi] t],Cos[\[Beta]/2]Exp[I 2\[Pi] t]];
ParametricPlot3D[Map[(DoubleBallMap[C2toR4[SpinKet[#,t]]])&,Range[0,\[Pi],\[Pi]/16]],{t,0,2\[Pi]}]

Offline

#2 2009-02-21 17:25:54

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Accelerometer Issue with Mathematica - klis3lv02d

I have tried Mathematica v7 too and it seems it does not play well with Arch, I get random crashes and other issues that I don't have with v6.
If you can downgrade to v6, I guess you will be happier with it for now ... otherwise fill a bug report with Mathworks if you can.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#3 2009-02-23 02:27:58

cjpembo
Member
Registered: 2008-08-06
Posts: 105

Re: Accelerometer Issue with Mathematica - klis3lv02d

This is a wild guess...

Mathematica allows you to use joysticks and gamepads etc as input.  Perhaps your accelerometer is being mistaken for joystick input?

Do the following in mathematica:

ControllerInformation[]

See anything?

If so, these next steps should be a blast!

Create a simple 3D plot:

Plot3D[Sin[x] Cos[y], {x, 0, Pi}, {y, 0, PI}]

Select your graph.  Hold down the shift key and shake your laptop.   Did the graph zoom?
If so, hold down the ctrl key and shake again.  Did the graph pan?

Write a notebook that records rollercoaster g-forces and head to Disney world for research.

But, I'm probably wrong.  And it will be turn out to be something much less interesting.

Offline

#4 2009-02-23 15:39:07

navaburo
Member
From: NYC
Registered: 2009-01-18
Posts: 11
Website

Re: Accelerometer Issue with Mathematica - klis3lv02d

When I do:

Dynamic[PolarPlot[-Sin[
    3 t - 3 ArcTan[
       ControllerState[
         "Unknown Axis"]/(.5 - 
          ControllerState["Unknown Axis 3"])]], {t, 0, 2 \[Pi]}]]

I get a plot that stays upright whenever I tilt the laptop!

This is AWSOME!!!!

Thanks sooo much for the suggestion... (Darnit, i have to go to class... and this will look very suspicious to the prof)

peaceout big_smile

Offline

#5 2009-02-24 07:04:30

cjpembo
Member
Registered: 2008-08-06
Posts: 105

Re: Accelerometer Issue with Mathematica - klis3lv02d

You've got to be kidding me!  I was (mostly) kidding when I suggested that!  That opens up a world of possibilities for some neat projects.  I'm posting a link to this thread on the Mathematica users mailing list; I want to see if this is a known feature or a cool linux "bug" I hope they never fix.  Have fun.

Offline

#6 2009-02-28 19:24:01

cjpembo
Member
Registered: 2008-08-06
Posts: 105

Re: Accelerometer Issue with Mathematica - klis3lv02d

Just as a follow-up:

You can of course unload the accelerometer module if you're not using it.

Someone named Rob on the mathematica users list gave the following advice:

On Linux, Mathematica will treat devices at /dev/input/js0 through jsN
as controllers.  As you discovered, apparently this laptop's
accelerometer masquerades as a joystick. The high CPU usage is caused
by the driver sending many updates to the device file descriptor,
which Mathematica watches and does work whenever the values change.
This can be disabled by adding the name of the controller (as returned
by ControllerInformation[]) to the value list for the undocumented
option "DisableControllers":

SetOptions[$FrontEnd, DisableControllers -> Prepend
[DisableControllers /. Options[$FrontEnd, DisableControllers], "DEVICE
NAME HERE"]]

-Rob

Offline

Board footer

Powered by FluxBB