问题标签 [resampling]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
6346 浏览

python - 使用另一个时间序列的索引重新采样一个时间序列

我有 2 个具有相同列但日期时间索引不同的数据框。我想重新采样其中一个以使用另一个的索引,并在另一个没有数据的索引中的任何日期从一个转发填充数据。

'a' 表示我想将其索引用作重采样参考的数据框。'b' 代表我想要重新采样和转发填充数据的数据框。'c' 代表我希望结果的样子。

请注意,“b”缺少“a”中存在的“2012-03-20”索引。“c”使用索引“2012-03-19”的“b”列中的数据填充索引“2012-03-20”的列

pandas 是否具有执行此操作的功能。

提前致谢。

皮尔

0 投票
1 回答
786 浏览

r - R:行重采样循环速度提高

我正在从具有各种 c("s_size","re​​ps") 的 c("x","y","density") 列的数据帧中对行进行二次采样。Reps = 复制,s_size = 从整个数据帧中二次采样的行数。

这是行子样本函数:

这太慢了,我用应用函数尝试了几次,但没有运气。我将从 1:250 开始为每个 s_size 做大约 1,000-10,000 次重复。

让我知道你的想法!提前致谢。

==================================================== ======================= 更新编辑:从中采样的示例数据: https ://www.dropbox.com/s/47mpo36xh7lck0t/density.csv

Joran 在函数中的代码(在 source function.R 文件中):

调用函数

输出数据,不幸的是带有此警告消息:

0 投票
2 回答
950 浏览

r - 在 R 中重新采样纵向数据集

我有一个纵向数据集,其中包含所有个人的每个观察的一行。每次观察都有几个测量值,其中一些可能会丢失。个人的观察数量变化很大,并且有大量的辍学。这是数据集的一部分

我需要的是从该数据集中生成引导样本,其中保留了各个集群,这样如果对个体进行采样,则该 ID 的整个观察集都会进入引导样本。当然,一个人可能会被多次采样,在这种情况下,它应该输入重新采样的数据适当的次数,并且理想情况下会收到一个更改的 ID 号,例如 10056.1、10056.2。

现在,我将尽力解决这个问题,但如果有人对我如何快速做到这一点有任何想法,我将不胜感激。

编辑:我最终使用了什么

0 投票
2 回答
2862 浏览

audio - Gstreamer:从视频(flv)中提取音频,重新采样率和管道到流式接收器 - 无法重新采样到流式

我正在使用 gstreamer 从视频中提取音频并将音频重新采样为不同的采样率。我的管道适用于文件到文件的对话,但我无法正确设置流式传输案例以将其链接到插孔接口:

文件到文件(效果很好):

gst-launch-0.10 filesrc location=/data/Opinion.flv !播放器!音频/MPEG!解码器!音频转换!音频/x-raw-int,通道=1!音频重采样!音频/x-raw-int,速率=16000,深度=16!波浪!文件接收器位置=./recordingOut2.wav

要流式传输的文件(不起作用):

gst-launch-0.10 filesrc location=/data/Opinion.flv !播放器!音频/MPEG!解码器!音频转换!音频/x-raw-int,通道=1!音频重采样!音频/x-raw-int,速率=16000,深度=16!插孔音频接收器

警告:错误的管道:无法将 audioresample0 链接到 jackaudiosink0

以下管道运行,但输出的采样率错误:

gst-launch-0.10 filesrc location=/data/Opinion.flv !播放器!音频/MPEG!解码器!音频转换!音频重采样!插孔音频接收器

你有什么发现我做错了吗?

可以重新采样音频并通过管道传输到流输出吗?

我已经四处寻找,但没有找到任何相关的解决方案。您的任何见解/指针将不胜感激!

0 投票
1 回答
1452 浏览

r - How to bootstrap respecting within-subject information?

This is the first time I post to this forum, and I want to say from the start I am not a skilled programmer. So please let me know if the question or code were unclear!

I am trying to get the 95% confidence interval (CI) for an interaction (that is my test statistic) by doing bootstrapping. I am using the package "boot". My problem is that for every resample, I would like the randomization to be done within subjects, so that observations from different subjects are not mixed. Here is the code to generate a dataframe similar to mine. As you can see, I have two within-subjects factors ("Num" and "Gram" and I am interested in the interaction between both):

This is the code I used to get the empirical interaction value:

As you can see, the interaction between my two factors is -348. I want to get a bootstrap confidence interval for this statistic, which I can generate using the "boot" package:

My problem is that I think the resamples should be generated without mixing the individual subjects observations: that is, to generate the new resamples, the observations from subject 1 (S1) should be shuffled within subject 1, not mixing them with the observations from subjects 2, etc... I don't know how "boot" is doing the resampling (I read the documentation but don't understand how the function is doing it)

Does anyone know how I could make sure that the resampling procedure used by "boot" respects subject level information?

Thanks a lot for your help/advice!

0 投票
0 回答
4248 浏览

android - 设置 Android 输出音频采样率

我正在尝试捕获 Android 的系统输出音频数据。现在我通过修改AudioFlinger中的代码来实现它。我能够捕获它并将其写入文件。而且效果很好。但是我被要求使用的编码器只支持 48kHz,而 AudioFlinger 给了我 44100Hz 的数据。有什么方法可以在 Android 中将采样频率设置为 48KHz。

0 投票
0 回答
346 浏览

python-2.7 - 当我尝试使用日期时间索引重新采样数据框时未实现错误

这就是我的数据框:

当我尝试重新采样时,我得到了一个未“实现的错误”

我的代码就是例如b.resample('5Min', how = 'ohlc')

0 投票
3 回答
3654 浏览

datetime - 圆形熊猫日期时间索引?

我正在将多个时间序列电子表格读入一个熊猫数据帧,并将它们与一个常见的熊猫日期时间索引连接在一起。记录时间序列的数据记录器不是 100% 准确,这使得重新采样非常烦人,因为根据时间是略高于还是略低于采样间隔,它会创建 NaN 并开始使我的系列看起来像一条折线。这是我的代码

这是索引的一个想法:

数据索引

类'pandas.tseries.index.DatetimeIndex'> [2012-08-27 12:05:00.000002, ..., 2013-07-12 15:10:00.000004] 长度:91910,频率:无,时区:无

将索引四舍五入到最接近的分钟的最快和最通用的方法是什么?

0 投票
1 回答
11974 浏览

matlab - 在 MATLAB 中重采样音频

我有一个已导入 MATLAB 的 wav 文件,样本频率为 44.1 kHz。我正在尝试将此音频文件重新采样为 22.05 kHz,然后将其恢复为 44.1 kHz。但是,我对如何在 MATLAB 中使用 resample 函数感到困惑,如果这甚至是我应该用来执行此操作的函数。任何帮助将不胜感激。谢谢!

0 投票
2 回答
8077 浏览

interpolation - 重采样还是插值?

我不清楚图像处理中重采样和插值之间的区别。如果我有一个 geotiff 并且我想提高它的分辨率,我应该使用最近邻居等重采样方法,对吗?例如,我找到了 gdalwarp 函数来执行此操作。
那么插值方法,即克里金法呢?如果我的数据不是均匀分布的会更好吗?如果我还想考虑数字高程模型来校正我的图像怎么办?非常感谢您的帮助,很抱歉造成混淆。

劳拉