[sage-support] Re: Sage Server - displaying Matlab plots

2010-06-02 Thread Vinod

On Jun 1, 7:19 pm, Jason Grout  wrote:
> On 6/1/10 8:57 PM, Vinod wrote:
>
> > Yes, matlab does save the images properly to the directory. But the
> > problem here is to get the image displayed on the web browser itself.
>
> Are you saying that in the Sage notebook:
>
> 1. You can use the above code to create a matlab plot and save it to a
> specific directory (the current python directory)
>
> but
>
> 2. the image is not picked up automatically by the Sage notebook?
>
> Any image created in a Sage notebook cell "current directory" should be
> displayed in the notebook under that cell.

Right now, matlab stores the image in this directory.
/usr/local/sage/data/extcode/matlab/user/

Is this path not a proper one for the images?
Not sure how to change this to a python directory.

Thanks,
Vinod




>
> Thanks,
>
> Jason

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-06-01 Thread Vinod
Yes, matlab does save the images properly to the directory. But the
problem here is to get the image displayed on the web browser itself.

Thanks,
Vinod

On Jun 1, 4:17 pm, Jason Grout  wrote:
> On 6/1/10 5:53 PM, Vinod wrote:
>
> > hello Jason,
>
> > This doesn't work either... :(
> > matlab doesn't even start with xvfb-run command.
> > it gives lot of errors.
>
> As William pointed out, is the original problem resolved by one of the
> other messages?  If not, can you precisely state the problem as it now
> stands?
>
> Thanks,
>
> Jason

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-06-01 Thread Vinod
hello Jason,

This doesn't work either... :(
matlab doesn't even start with xvfb-run command.
it gives lot of errors.

~Vinod


On May 28, 6:24 pm, Jason Grout  wrote:
> On 5/28/10 8:08 PM, William Stein wrote:
>
>
>
> > On Fri, May 28, 2010 at 5:52 PM, Jason Grout
> >   wrote:
> >> On 5/28/10 7:47 PM, Vinod wrote:
>
> >>> X11 connection rejected because of wrong authentication.
> >>> Warning: Unable to open display 'localhost:12.0'.  You will not be
> >>> able to display graphics on the screen.
>
> >> So now it's not a Sage question, but a question of how to run Matlab over 
> >> an
> >> ssh session.  That's something that should have an answer somewhere, either
> >> through a google search or asking MathWorks.
>
> > No, that is not the problem at all.
> > What's happening is that he's giving code to Matlab that asks it to
> > pop up a plot.  Matlab
> > is then trying to make the plot appear on the screen using *XWindows*.
> >   Naturally, this fails
> > in the notebook -- it simply doesn't make any sense to do this.
>
> Right.  Thanks for reminding me the context of this conversation.  The
> same problem (needing to pop up a window) appears when trying to render
> an image using OpenGL without X.  In the OpenGL case, I believe there
> are ways of getting an opengl context to work without trying to pop up
> an XWindows window.  I believe the typical way to do this is to use a
> framebuffer.  A google search "opengl without x11" turns up lots of hits
> for doing such a thing.  Instructions for doing such a thing are also in
> the Mayavi 
> manual:http://code.enthought.com/projects/mayavi/docs/development/html/mayav...
>
> I've never done this, though.  Whether or not OpenGL is the problem
> here, using a framebuffer might solve the problem.  Maybe.  Assuming you
> are using Ubuntu, can you try following the instructions in the Mayavi
> manual?
>
> $ sudo apt-get install xvfb
> ssh in as the sage worksheet user
> $ xvfb-run matlab
>
> then try the plotting command
>
> Jason

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-05-28 Thread Vinod



On May 28, 12:38 pm, Jason Grout  wrote:
> On 5/28/10 1:53 AM, Vinod wrote:
>
>
>
> > Now I have a different error message in the terminal when I try to
> > execute the matlab code involving plots in the webserver
> > " X11 connection rejected because of wrong authentication."
>
> > I verified all the X11 settings and it looks fine.
> > The link lists all the check points one should look for:
> >http://www.cyberciti.biz/faq/x11-connection-rejected-because-of-wrong...
>
> > The sage server was setup using the method discussed under the  last
> > section " Other Instructions -from JasonGrout" in the below link.
> >http://wiki.sagemath.org/DanDrake/JustEnoughSageServer
>
> I wonder if you'll have to do something to the Sage worksheet process
> users.  See, for example,http://umdmath.blogspot.com/
>
> What happens if you ssh into a Sage worksheet account and try running
> matlab?
>
> ssh sageus...@localhost
>
> then try running matlab from the command line.
>
> My guess is that if you get that working, then Sage will be able to get
> matlab to work.


I tried all this and it displays the following error message when the
matlab is started from the command line.

X11 connection rejected because of wrong authentication.
Warning: Unable to open display 'localhost:12.0'.  You will not be
able to display graphics on the screen.

So if we get this working, I can make other softwares like octave
working too.

>
> Note that there might be legal issues with providing access to matlab
> via a webserver (whether or not it is a private webserver).  I don't
> know, but it would be something to be aware of if it is an issue.
>

Yes, We are planning to have a word with matlab before we bring this
to our students.

> Thanks,
>
> Jason

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-05-28 Thread Vinod


On May 28, 12:08 am, William Stein  wrote:
> On Thu, May 27, 2010 at 11:53 PM, Vinod  wrote:
>
> > On May 27, 6:40 pm, William Stein  wrote:
> >> On Thu, May 27, 2010 at 6:39 PM, Vinod  wrote:
> >> > That's Awesome! Thanks for the help.
> >> > When would the sage4.4.3 release? Should I wait till then or is it
> >> > possible for you guys to post the patch here in the forum?
>
> >> > Vinod
>
> >> Just type
>
> >>   sage:   
> >> hg_sage.apply('http://trac.sagemath.org/sage_trac/attachment/ticket/9070/trac_9070.p...)
>
> >> exit sage, then type
>
> >>   sage -br
>
> >> And you should have the patch installed into your copy of Sage.
>
> >> William
>
> > Thank you William and Mike. I installed the patch and tried with the
> > matlab again.
>
> > Now I have a different error message in the terminal when I try to
> > execute the matlab code involving plots in the webserver
>
> What code are you executing.  What if you try:
>
> h = figure('Visible', 'off')
> plot(1:.1:10, sin(1:.1:10))
> saveas(h,'foo.png')
>
>  -- William
>
>


Even this doesn't display the plot.

Here is the snapshot of what I tried.
http://math.asu.edu/~scimm/images/screenshot_code1.png

Below is the snapshot with the other matlab code that I tried earlier
http://math.asu.edu/~scimm/images/screenshot_code2.png

In both  cases, the image is created in the directory.

Vinod


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-05-27 Thread Vinod


On May 27, 6:40 pm, William Stein  wrote:
> On Thu, May 27, 2010 at 6:39 PM, Vinod  wrote:
> > That's Awesome! Thanks for the help.
> > When would the sage4.4.3 release? Should I wait till then or is it
> > possible for you guys to post the patch here in the forum?
>
> > Vinod
>
> Just type
>
>   sage:   
> hg_sage.apply('http://trac.sagemath.org/sage_trac/attachment/ticket/9070/trac_9070.p...)
>
> exit sage, then type
>
>   sage -br
>
> And you should have the patch installed into your copy of Sage.
>
> William
>

Thank you William and Mike. I installed the patch and tried with the
matlab again.

Now I have a different error message in the terminal when I try to
execute the matlab code involving plots in the webserver
" X11 connection rejected because of wrong authentication. "

I verified all the X11 settings and it looks fine.
The link lists all the check points one should look for:
http://www.cyberciti.biz/faq/x11-connection-rejected-because-of-wrong-authentication/

The sage server was setup using the method discussed under the  last
section " Other Instructions -from JasonGrout" in the below link.
http://wiki.sagemath.org/DanDrake/JustEnoughSageServer

Is there anything wrong with the server setup itself?

Vinod

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-05-27 Thread Vinod
That's Awesome! Thanks for the help.
When would the sage4.4.3 release? Should I wait till then or is it
possible for you guys to post the patch here in the forum?

Vinod

On May 27, 6:00 pm, William Stein  wrote:
> Positive review -- this will be in sage-4.4.3.
>
>
>
> On Thu, May 27, 2010 at 5:54 PM, Mike Hansen  wrote:
> > On Thu, May 27, 2010 at 5:42 PM, William Stein  wrote:
> >> Mike Hansen just told me that he will create such a patch tonight.
>
> >>http://trac.sagemath.org/sage_trac/ticket/9072
>
> > The patch is up, but it needs testing.
>
> > --Mike
>
> > --
> > To post to this group, send email to sage-support@googlegroups.com
> > To unsubscribe from this group, send email to 
> > sage-support+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/sage-support
> > URL:http://www.sagemath.org
>
> --
> William Stein
> Professor of Mathematics
> University of Washingtonhttp://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-05-27 Thread Vinod
Yes William, Your code works for me as well. I get a neat plot
displayed as yours. Here the software chosen is sage.

My question is:

Is it not possible to write a simple matlab code as I wrote before and
select the option Matlab instead of sage in the list of softwares
available and have it working?
It does all the math and displays the result but not the plot.

Vinod

On May 27, 2:05 pm, William Stein  wrote:
> On Thu, May 27, 2010 at 12:23 PM, Mike Hansen  wrote:
> > On Thu, May 27, 2010 at 12:20 PM, Vinod  wrote:
> >> The simple matlab code I wrote is functional and the sage server
> >> evaluates it properly and generates the .png file in the directory.
> >> Only issue that need to be addressed is to get the sage server display
> >> the plots in the web browser itself. We are planning to provide this
> >> to a set of students who take summer classes and
> >> it would be really great if we can get this working.
>
> >> rightnow, this creates the nicefig2.png file in the directory  home/
> >> sageserver/matlab/user/
>
> >> Is it something to do with the directory it writes?
>
> > Yes.  In order for this to work, someone needs to implement the chdir
> > method for the Matlab interface.  See the example in
> > sage/interfaces/mathematica.py
>
> In the meantime, try this:
>
> import os
> filename = os.path.join(os.path.abspath('.'),'matlabfig1.png')
> matlab.eval("h = figure('Visible', 'off')")
> matlab.eval("plot(1:.1:10, sin(1:.1:10))")
> out = matlab.eval("saveas(h,'%s')"%filename)
>
> See screenshot for proof this works...
>
> --
> William Stein
> Professor of Mathematics
> University of Washingtonhttp://wstein.org
>
>  Screen shot 2010-05-27 at 2.04.31 PM.png
> 52KViewDownload

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-05-27 Thread Vinod


On May 27, 9:21 am, William Stein  wrote:
> On Thursday, May 27, 2010, Harald Schilly  wrote:
> > On May 26, 11:40 pm, Vinod  wrote:
> >> Is there anything else that needs to be done?
>
> > It's not working for me either. What I did in a cell is this:
>
> > import os
> > filename = os.path.join(SAGE_TMP,'matlabfig1.png')
> > matlab("h = figure('Visible', 'off')")
> > matlab("plot(1:4,5:8)")
> > matlab("saveas(h,'"+filename+"')")
>
> That should not work, since you are not writing then file to the
> current python directory.
>
> William
>

yes. It didn't work for me either.

Below is the list of steps followed:
  1. Log in to the sage webserver with firefox browser.
  2. create a new worksheet.
  3. select the matlab option in the list of softwares available.
  4. write the below code in the editor
Delay = [1 2 3 4 5 6]
Vctrl = [0.781 1.025 1.19 1.37 1.469 1.533]
plot(Vctrl,Delay)
savefig('nicefig2', 'png', '-rgb', '-c0.1', '-r250')
   5. press evaluate.

The simple matlab code I wrote is functional and the sage server
evaluates it properly and generates the .png file in the directory.
Only issue that need to be addressed is to get the sage server display
the plots in the web browser itself. We are planning to provide this
to a set of students who take summer classes and
it would be really great if we can get this working.

rightnow, this creates the nicefig2.png file in the directory  home/
sageserver/matlab/user/

Is it something to do with the directory it writes?

Thank you all for your sincere replies.

Vinod




> > h
>
> > --
> > To post to this group, send email to sage-support@googlegroups.com
> > To unsubscribe from this group, send email to 
> > sage-support+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/sage-support
> > URL:http://www.sagemath.org
>
> --
> William Stein
> Professor of Mathematics
> University of Washingtonhttp://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-05-26 Thread Vinod
Hello Jason,

Thanks for the reply.  Can you please let me know what "current
directory" you  exactly referred to?
is it the sage path or matlab working directory?

Thanks,
Vinod

On May 26, 7:38 am, Jason Grout  wrote:
> On 5/25/10 9:32 PM, Vinod wrote:
>
> > I tried installing a sage server and did succeed with it partially.
>
> > Now the server is up and my aim is get the sage, matlab, mathematica,
> > and maple softwares function properly displaying  plots.
> > but as of now, I could only get sage working with plot options.
>
> > Can anyone please give some information on how to get the matlab and
> > other softwares display plots using sage notebook webserver?
>
> > Any help would be appreciated...
>
> If you can get matlab to generate an image in the current directory, the
> sage notebook will automatically display the image.
>
> Jason

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Sage Server - displaying Matlab plots

2010-05-26 Thread Vinod
William,

Thanks for the note.  I tried using the savefig command and it does
create a .png file in the directory
 but doesn't get the image displayed on the sage notebook webserver.

below is the simple matlab code that I used:

Delay = [95e-3 119e-3 142e-3 190e-3 238e-3 285e-3 333e-3 380e-3 428e-3
476e-3]
Vctrl = [0.781 1.025 1.19 1.37 1.469 1.533 1.578 1.61 1.636 1.656]
plot(Vctrl,Delay)
savefig('nicefig1', 'png', '-rgb', '-c0.1', '-r250')

Is there anything else that needs to be done?

Thanks,
Vinod

On May 26, 1:03 am, William Stein  wrote:
> On Tue, May 25, 2010 at 7:32 PM, Vinod  wrote:
> > I tried installing a sage server and did succeed with it partially.
>
> > Now the server is up and my aim is get the sage, matlab, mathematica,
> > and maple softwares function properly displaying  plots.
> > but as of now, I could only get sage working with plot options.
>
> One important point is that in the Sage notebook, if you run a command
> and it creates a .png image as output, then that image will appear.
> This might be helpful for some of these other systems.
>
> E.g., matlab has a savefig command:
>
> http://www.mathworks.com/matlabcentral/fileexchange/10889-savefig
>
>
>
> > Can anyone please give some information on how to get the matlab and
> > other softwares display plots using sage notebook webserver?
>
> > Any help would be appreciated...
>
> > Thanks,
> > Vinod
>
> > --
> > To post to this group, send email to sage-support@googlegroups.com
> > To unsubscribe from this group, send email to 
> > sage-support+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/sage-support
> > URL:http://www.sagemath.org
>
> --
> William Stein
> Professor of Mathematics
> University of Washingtonhttp://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Sage Server - displaying Matlab plots

2010-05-26 Thread Vinod
I tried installing a sage server and did succeed with it partially.

Now the server is up and my aim is get the sage, matlab, mathematica,
and maple softwares function properly displaying  plots.
but as of now, I could only get sage working with plot options.

Can anyone please give some information on how to get the matlab and
other softwares display plots using sage notebook webserver?

Any help would be appreciated...

Thanks,
Vinod

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org