小编Ell*_*iot的帖子

如何编译用于Python的Fortran库?(f2py可能不是一个选项)

我正在尝试编译fortran90库(特别是这个)以便从python(3.4.0)调用它.通常在这种情况下,我会为f2py编写一个包装器并将其称为一天,但是库本身会使用派生类型,这似乎使f2py失败.完整的stderr 粘贴在这里,但相关的线是

getctype: No C-type found in "{'typename': 'optim_type', 'typespec': 'type'}", assuming void.
Run Code Online (Sandbox Code Playgroud)

另一个基于numpy文档的选项是使用ctypes,它也会失败

Python 3.4.0 (default, Jun 19 2015, 14:20:21) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.ctypeslib.load_library('libLBFGS', '/home/kaplane/src/TOOLBOX_OPTIMIZATION_shared/lib')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kaplane/.local/lib/python3.4/site-packages/numpy/ctypeslib.py", line 123, in load_library
    return ctypes.cdll[libpath]
  File "/usr/lib/python3.4/ctypes/__init__.py", line 426, in __getitem__
    return getattr(self, name)
  File "/usr/lib/python3.4/ctypes/__init__.py", line 421, in …
Run Code Online (Sandbox Code Playgroud)

python fortran numpy f2py

6
推荐指数
1
解决办法
1148
查看次数

如何在散景中设置所选/未选定字形的属性

我有一个由几个可观察量的时间序列组成的数据集,我想使用散景来查看时间序列中不同点的相图.我想知道的是如何更改所选或未选定字形的属性(在这种情况下,我想减少未选择点的alpha或更改所选字符的颜色).

下面的代码在ipython笔记本中创建了我想要的界面,并基于用户指南中的示例http://bokeh.pydata.org/en/0.10.0/docs/user_guide/interaction.html#linked-brushing.我找不到任何明显的选项设置,我真的宁愿不必为这一件事学习javascript.

import numpy as np
from pandas import DataFrame
from bokeh.plotting import figure, output_notebook, show, gridplot
from bokeh.models import ColumnDataSource, widgets

def znzt_ts():#, plot_antisym=False, **kwargs):
    t = np.arange(1000)
    Eu = np.sin(t * np.pi/10) + np.random.random(1000)
    Ez = np.cos(t * np.pi/10) + np.random.random(1000)
    ts = DataFrame({'t': t, 'Eu': Eu, 'Ez': Ez})
    tools = 'box_zoom,pan,reset,save,box_select'
    source = ColumnDataSource(data=ts)
    original_source = ColumnDataSource(data=ts)

    p1 = figure(plot_width=300, plot_height=300, 
                tools=tools)
    p2 = figure(plot_width=300, plot_height=300, tools=tools,)
    p1.circle('t', 'Eu', source=source, size=1)
    p2.circle('Eu', 'Ez', …
Run Code Online (Sandbox Code Playgroud)

javascript python bokeh

5
推荐指数
1
解决办法
1673
查看次数

标签 统计

python ×2

bokeh ×1

f2py ×1

fortran ×1

javascript ×1

numpy ×1