ipython

plotting a sphere in python for an orbital trajectory

僤鯓⒐⒋嵵緔 提交于 2020-01-03 03:32:09
问题 How can I put a sphere of radius 1737 at the location of (384400,0,0) ? This sphere would be the moon in my trajectory. Everything else with the code is fine, I just don't know how to add a sphere in that location with that radius. import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D me = 5.974 * 10 ** (24) # mass of the earth mm = 7.348 * 10 ** (22) # mass of the moon G = 6.67259 * 10 ** (-20) # gravitational parameter

How to display large image from IPython notebook with scrolling?

拟墨画扇 提交于 2020-01-03 03:19:08
问题 How can I display a large image with scrollbars inside an IPython notebook output cell? The example below scales down the image to fit into the cell, and width does not have any effect. from IPython.core.display import Image, display display(Image('https://i.ytimg.com/vi/j22DmsZEv30/maxresdefault.jpg', width=1900)) 回答1: Use unconfined=True to disable max-width confinement of the image: from IPython.core.display import Image, display display(Image('https://i.ytimg.com/vi/j22DmsZEv30

AutoComplete in ipython with pandas Seems to be broken

我怕爱的太早我们不能终老 提交于 2020-01-02 17:56:31
问题 I have a pandas dataframe named frame I want to invoke the frame[SomeCoulmnname].value_counts() method The issue is that ipython doesnt autocomplete even after i type v after the . In fact it doesnt even return any suggestions. But if i simply type Series . and press the tab it return me the possible methods that i am looking for. My question is why is iPython behaving like this?The same work with PyCharm though! Any help on this will be greatly appreciated.Thanks 回答1: This isn't specific to

Setting the working directory of IPython Shell to that of the python file being executed in Canopy

非 Y 不嫁゛ 提交于 2020-01-02 15:45:21
问题 I am new to IPython and I am using the Canopy distribution. The default value of the shell's working directory is /home/username. This is a bit painful, when I work on files which need other files present in the corresponding folder that I am working in. So, I always manually change it to folder in which the file (which I am trying to execute) is present. I found this relevant question, but my question is slightly different. Also, I couldn't understand the answer provided there really well.

Changing the font in iPython notebook markdown cells

故事扮演 提交于 2020-01-02 10:01:39
问题 I just wanted to change the default font in Ipython (1.0.0) notebook markdown cells to something else, and tried doing this using style tags in a markdown cell instead of going through the path of creating a custom.css. I do not know CSS, and my needs are very minimal. After some research, I found the following code snippet: <style> div.text_cell_render { font-family: "Times New Roman", serif; ... } </style> I applied the above CSS code to a markdown cell, however the font in the other

How to insert python code in a bat file?

为君一笑 提交于 2020-01-02 08:44:20
问题 Would like to insert python code or run ipython code in a windows bat file (Not in a separate .py file). After searching, could not find any solution. EDIT: This is for ipython code (not python). 回答1: Try this (batch-python polyglot script ): 0<0# : ^ ''' @echo off echo batch code python %~f0 %* exit /b 0 ''' print("python code") the ''' respectively starts and ends python multi line comments. 0<0# : ^ is more interesting - due to redirection priority in batch it will be interpreted like :0<0

Centering output on IPython notebook

♀尐吖头ヾ 提交于 2020-01-02 06:46:26
问题 I have a similar question to here. I have an IPython notebook, I'd like the output to have centered plots. I've copied the css file and everything as instructed in the above link, and, whilst the plots change style, they don't center on my screen. 回答1: This might come a bit late but maybe Google brings more people here looking for a solution. We can style the output in the custom.css in the IPython profile and add the following: with (older) IPython .ui-wrapper { margin-left: auto !important;

Detach from IPython kernel without terminating it

给你一囗甜甜゛ 提交于 2020-01-02 06:26:26
问题 Can someone please tell me how I can detach from an IPython kernel without terminating it? I see in the documentation of quit() that there is a parameter keep_kernel , but unfortunately quit(keep_kernel=True) won't work. 回答1: If you are connected to the kernel via the IPython console client and are on a Unix-like OS, you can detach using Ctrl-\ 来源: https://stackoverflow.com/questions/23680786/detach-from-ipython-kernel-without-terminating-it

How do I start ipython's qtconsole cleanly on Win7

心不动则不痛 提交于 2020-01-02 06:15:40
问题 I have python 3.4 and ipython 2.3.1 installed on Windows 7. I installed ipython using pip from a wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs/ (Thanks, Chris!). This install procedure does not create any start menu shortcuts, even when run as administrator. I can successfully run "ipython qtconsole" from a cmd window, but then I have to have that command window open and the process doesn't fork--it's just and extra window hosting the child process. If I create a shortcut to do the

IPython notebook ~ Using javascript to run python code?

此生再无相见时 提交于 2020-01-02 06:08:54
问题 I am trying to execute python code through javascript directly: I fire up IPython Notebook on Chrome Using chrome developer tools I open up the javascript console. In the javascript consolde, I type: IPython.notebook.kernel.execute("2+2") But I get a strange output: "6CEA73CC644648DDA978FDD6A913E519" Is there any way to take advantage of all the IPython javascript functions available, to run python code from the javascript console as depicted in the image? I'm sure there's a way but I've been