interactive

Update mayavi plot in loop

早过忘川 提交于 2019-12-07 12:30:50
问题 What I want to do is to update a mayavi plot in a loop. I want the updating of the plot to be done at a time specified by me (unlike, e.g., the animation decorator). So an example piece of code I would like to get running is: import time import numpy as np from mayavi import mlab V = np.random.randn(20, 20, 20) s = mlab.contour3d(V, contours=[0]) for i in range(5): time.sleep(1) # Here I'll be computing a new V V = np.random.randn(20, 20, 20) # Update the plot with the new information s.mlab

IPython notebook interactive function: how to save the updated function parameters

心已入冬 提交于 2019-12-07 12:20:46
问题 I wrote the code below in Ipython notebook to generate a sigmoid function controlled by parameters a which defines the position of the sigmoid center, and b which defines its width: %matplotlib inline import numpy as np import matplotlib.pyplot as plt def sigmoid(x,a,b): #sigmoid function with parameters a = center; b = width s= 1/(1+np.exp(-(x-a)/b)) return 100.0*(s-min(s))/(max(s)-min(s)) # normalize sigmoid to 0-100 x = np.linspace(0,10,256) sigm = sigmoid(x, a=5, b=1) fig = plt.figure

Custom scroll bar behavior in Javascript?

爱⌒轻易说出口 提交于 2019-12-07 09:08:41
问题 I'd like to reproduce an effect similar to this page: http://artofflightmovie.com/ where the vertical scrollbar controls the progression of the browser "viewport" over a pre-defined path. I am thinking the easiest way of going about this is through the use of javascript to read the scroll bar value and position background elements accordingly. Is it possible to obtain the vertical scroll bar value in Javascript? Am I approaching this design wrong? 回答1: Is it possible to obtain the vertical

Python Get Docstring Without Going into Interactive Mode

青春壹個敷衍的年華 提交于 2019-12-07 06:49:20
问题 I want to grab the docstring in my commandline application, but every time I call the builtin help() function, Python goes into interactive mode. How do I get the docstring of an object and not have Python grab focus? 回答1: Any docstring is available through the .__doc__ property: >>> print str.__doc__ In python 3, you'll need parenthesis for printing: >>> print(str.__doc__) 回答2: You can use dir( {insert class name here} ) to get the contents of a class and then iterate over it, looking for

why the interactive mode of my gnuplot installation won't rotate when it will for batch.dem files and also for Octave

对着背影说爱祢 提交于 2019-12-07 05:06:30
问题 I have gnuplot 4.6 working on Mac OS X. It works from Octave as well. This isn't an octave related question, just trying to convince you that gnuplot seems to be installed fine. My problem is that while I CAN rotate plots with the mouse (am using x11 as the plotting window) in a batch sort of mode (e.g. $unixPrompt> gnuplot pm3d.dem works fine: I can rotate/zoom them), and ALSO can rotate 3d plots created from within Octave, but I CANNOT just go into gnuplot and rotate any such plot from the

Using bokeh to plot interactive pie chart in Jupyter/Python

和自甴很熟 提交于 2019-12-06 17:46:26
I am new to Bokeh and I would really appreciate some help in figuring out how to use Bokeh to plot a simple interactive pie chart in Jupyer/Python. I am planning to use 'CustomJS with a Python function' in Bokeh as explained at the bottom of the page here . The pie chart consists of two entries with a slider that can change the shape of one pie 'v2' inside the circle shape of (v1+v2). I have tried to follow the example in bokeh website that shows the interactivity with a sine plot, but I just cannot get it to work with my pie chart. Any help would be greatly appreciated. Below is the code

R programming function without ()

余生颓废 提交于 2019-12-06 17:02:55
问题 So, I Have the following very simple map.r file. I'm trying to have the user type "click" in interactive mode and then have the function . Since it's a function, the user has to type "click()" how can I make it so that they only have to the word (w/o parentheses), and then have that function do something with the img. So the user types: mydist("image.pnm") click //And then the function click does what it's supposed to mydist <- function(mapfile) { img <- read.pnm(mapfile) plot(img) } click <-

git bash shell on Windows “Your edited hunk does not apply”

最后都变了- 提交于 2019-12-06 16:56:05
I have a very frustrating error when trying to manually edit hunks while using the command: git add -p I have already looked through many of the existing questions on this site, including this one , and this one . I am at the point where I try to manually edit a hunk, make no changes to the file opened by git for manual editing, and still getting the error "Your edited hunk does not apply". I thought this might have to do with CRLF vs. LF EOL characters. I am editing in Notepad++, and I can see that all of my line endings are CRLF. I naively tried to change all the line endings to LF, but to

Interactive labeling of images in jupyter notebook

随声附和 提交于 2019-12-06 13:43:20
I have a list of pictures: pictures = {im1,im2,im3,im4,im5,im6} Where im1: im2: im3: im4: im5: im6: I want to assign the pictures to labels (1,2,3,4 etc.) For instance, here pictures 1 to 3 belong to label 1, picture 4 belongs to label 2, picture 5 to label 3, and picture 6 to label 4. -> label = {1,1,1,2,3,4} Since I need to see the images when I label them, I need a method to do that while labeling them. I was thinking of creating an array of images: And then I define the ranges by clicking on the first and last picture belonging to the same labels, so for example: What do you think ? Is

ruby ssh: interactive command “su”: How further after successfull logged in?

╄→尐↘猪︶ㄣ 提交于 2019-12-06 07:41:53
I want work on a remote machine within a SSH session: login on the remote server su make my work With my script a can do step 1 and 2 works. While executing the su command, I can send the password, and got the answer I'm expecting ( on_data: data = gis@v04ree:~> got gis@v04ree:~> But then, what should I do? I'm sitting on my channel, nothing happens. How can I make the channel understand that the command has finished and that I want to make my wor on the remote machine? require 'net/ssh' require 'net/sftp' class Connection def connect host = 'host' user = 'user' #1. Login Net::SSH.start(host,