- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
Python中是否有任何模块/方法可以过滤掉图中的 transient 部分?我有一个包含 transient 分量和稳态分量的图。我正在尝试从使用 matplotlib 生成的图形中提取稳态值。使用的代码和结果图如下:
from numpy import genfromtxt
import matplotlib.pyplot as plt
per_data=genfromtxt('output-3.csv',delimiter=',',names=['x', 'y'])
print(type(per_data))
plt.xlabel ('x stuff')
plt.ylabel ('y stuff')
plt.title('my test result')
plt.plot(per_data['y'])
plt.show()
最佳答案
如果我理解正确的话,你可以有效地将稳态响应定义为图形的一部分,其中该点的导数的绝对值接近于 0,也就是说变化率接近于 0。同样,我们可以说相反,如果导数的绝对值大于接近0,则其是 transient 的。
这应该很容易过滤掉,但是当你说“分离稳态”时,你可能意味着一百万件事。您只想保持稳定状态吗?您只想保持连续的稳定状态吗?您如何处理处于稳定状态之间的部件?您忽略了在这里指定您想要什么,所以我只是向您展示如何分离这两个部分,然后您可以决定如何处理它们。
首先决定你想要什么作为导数界限。你可以尝试一下,我只是选择 0.1。然后我们需要弄清楚如何计算导数。我们的数据显然(从你所显示的来看)不连续。通过查找斜率来近似相邻点之间的导数的简单数值方法应该适合您的问题。
您将将此导数应用于图表上的每一对,然后您可以根据这些导数值过滤列表。
这是一个例子:
#spacing is the distance between each point on the x axis
def find_derivative(y1, y2, spacing)
return (y2 - y1)/ spacing
# note index should obviously be < len and not negative, but garbage
# in garbage out, so no need for an assertion on that point
def consecutive_derivative(datapoints, index, spacing)
assert len(datapoints) >= 2, "Error, why would we need the derivative of one point?"
if index < (len(datapoints)):
y1 = list[index]
y2 = list[index+1]
else:
y1 = list[index-1]
y2 = list[index]
return find_derivative(y1, y2, spacing)
def to_derivative_list(datapoints, spacing):
return [consecutive_derivative(datapoints, i, spacing) for i in range(len(datapoints)]
# ... some code for list creation ...
steady_state_cutoff = 0.1
derivatives = to_derivative_list(per_data, per_data_spacing)
steady_state_indicies = []
transient_state_indicies = []
for index, derivative in enumerate(derivatives):
if abs(derivative) < steady_state_cutoff
steady_state_indicies.append(index)
else
transient_state_indicies.append(index)
#now you even have each index which is a steady state and
#those that are transient, so you can form your own new graphs off of
#these
关于python - 在Python中从线图中分离稳态分量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44060275/
我想使用错误组件显示我的错误消息,但不想在 中加载组件对于经过身份验证的用户,导航菜单也不应显示。 我有这样的应用程序组件.. 我有错误处理程序,它使用 router.navigate 路由
我正在尝试获取 RGB 图像,将其转换为 LAB(又名 CIE L* a* b*)色彩空间,然后提取 L* 分量。 这是我的代码: from skimage import io, color from
我在我的一个模型中定义了以下常量。 export const NEWS_TYPE_TEXT = { News: 'News', Interview: 'Intervie
我有一个Electron(6)/Angular(8)应用程序。 在正面( Angular ),我通过IPCRenderer向背面发送一条消息。 在背面,IPCMain接收消息并执行所需的操作,例如,获
我正在尝试在我的应用程序中创建一个可重用的 quickView 模式,以使用 ng-bootstrap modal library 动态加载任何组件。 就我加载文档中所示的相同示例组件而言,它工作正常
我需要将一个名为“photos”的数组从我的 component.ts 传递到 component.html。这是我的 component.ts 文件 export class PhotosCompo
我有一个按钮,单击该按钮会转到新路线并打开附加到该路线的另一个组件。 有没有一种方法可以从 DOM 中删除我们单击以转到不同组件的组件?示例:当单击“单击我返回主页”按钮时,它会打开另一个组件。在这种
这个问题在这里已经有了答案: Detect click outside Angular component (12 个答案) 5天前关闭。 我知道这方面有无数的问题,我尝试了每一个解决方案,但没有一个
我想将显示值的格式传递给 Angular 分量。 例如: format="'(utc, offset) location (tz)'" === '(UTC -04:00) New York (EDT)
我正在使用 Angular 组件将动态图表加载到我的小部件中: 这是我的组件的示例: angular.module("generalApp").component("chartPie", { temp
假设我有一个组件在被点击时发出一个事件,即 @Component({ selector: 'component-checkout-payment', template:
我有一个问题。 我正在处理另一个人的代码,有一个 JFrame 有很多 JSeparators(他用它们作为“面板”的边框)现在我将它们替换为 JBorderedPanel 类,该类遵循与整体相同的边
所以我在这里想做的是制作一个 Angular 组件并将其注入(inject)到我的 Angular 应用程序中。这是 Angular 分量的代码: (function(angular) { 'use
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 4 年前。 Improve this ques
我正在创建一个像这样的可重用组件: submit 我想在属性 isDisabled 为 true 时禁用点击事件,我尝试了类似的操作,但它不起作用。 packages/component/my-b
一种简单的说法是,当 RGB 分量相等时,它们形成灰色。然而,这还不是全部,因为如果它们只有细微的差别,它们看起来仍然是灰色的。 假设观看者具有健康的色彩视觉,我如何确定给定值是否会被视为灰色(大概具
您好我正在尝试使用带 Angular Electron 构建桌面应用程序,主要问题是在用户登录后我找不到正确加载主要组件的方法。正如您在 main.js 中看到的,这是我创建两个窗口(1 个用于登录的
new AngularJS 1.5 中似乎没有“替换”选项组件概念(就像指令一样)。 如果我想要表格行,你有什么建议元素作为组件?就有效的 HTML 而言是不可能的吗? 真实示例:mailBox组件内
我有颜色=#12FFFF。这是这种格式的颜色,其中 12FFFF 是十六进制数。现在我想获取每个独立的 R、G、B 分量的十进制。我该如何在java中做到这一点? 最佳答案 目前尚不清楚你的问题是什么
我需要一些关于 Java 的 ImageIO API 的帮助。我似乎迷失在 ComponentColorModel 类中。我需要逐像素检查 *.png 文件来检测它是灰度图像还是彩色图像。但是,我不知
我是一名优秀的程序员,十分优秀!