小编nrh*_*ner的帖子

拆分矩阵并重新加入

这是我的第一篇文章.如果我的问题愚蠢,请提前道歉.我是编程新手.

好的,所以我matrix(eBpvalues)在R中有一个152720行和2列.我想分成10个单独的矩阵,每个矩阵包含15272行.

我试过这个:

> newmx <-split(as.data.frame(eBpvalues), rep(1:10, each = 15272)))

> summary(newmx)  

   Length Class      Mode  
1  2      data.frame list    
2  2      data.frame list  
3  2      data.frame list  
4  2      data.frame list  
5  2      data.frame list  
6  2      data.frame list  
7  2      data.frame list  
8  2      data.frame list  
9  2      data.frame list  
10 2      data.frame list  
Run Code Online (Sandbox Code Playgroud)

我如何并排连接这些矩阵,所以我有一个20列和15272行的新矩阵?

干杯,

尼尔

split r matrix

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

在numpy中对大型3D图像进行下采样

我需要通过任意非整数因子对由一系列2d tiff切片组成的大型3D图像(30GB +)进行下采样.scipy.ndimage.zoom适用于适合RAM的输入图像.

我正在考虑读取部分堆栈并使用scipy.ndimage_map_coordintes来获取插值像素坐标.另一个想法是使用numpy.memmap创建一个内存映射数组,并在此上执行scipy.ndimage.zoom.

在我继续这个之前,有没有人有更好的方法?

python numpy image

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

从R中的多个lm()快速检索pvalues

我有一个矩阵(垫)与dims"13,20000000"和以下组

[1,] "wildtype"  
[2,] "wildtype"  
[3,] "wildtype"  
[4,] "wildtype"  
[5,] "wildtype"  
[6,] "wildtype"  
[7,] "wildtype"  
[8,] "wildtype"  
[9,] "wildtype"  
[10,] "wildtype"  
[11,] "mutant"    
[12,] "mutant"   
[13,] "mutant"
Run Code Online (Sandbox Code Playgroud)

使用以下R代码,我lm()在每个数据点上运行20M次.

lm(mat ~ groups)真的很快 需要花费很长时间的是使用每个模型提取pvalue summary(lm1).

我怎样才能加速提取pvalues?

tvals_out <-'/tmp/tvals_lm.csv'

infile <- '/tmp/tempdata.dat'
con <- file(infile, "rb")
dim <- readBin(con, "integer", 2)
mat <- matrix( readBin(con, "numeric", prod(dim)), dim[1], dim[2])
close(con)

groups = factor(c(rep('wt', 10), rep('mut', 3)))
lm1 <- lm(mat ~ groups)

# This is the longest running bit
sum_lm1 …
Run Code Online (Sandbox Code Playgroud)

statistics r

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

IE兼容模式JavaScript函数未调用

我在外部.js文件中有一些JavaScript(1.7.2)正常工作.但在检查IE兼容模式以确保它与IE7 +一起使用后,我遇到了问题.在页面加载时调用的函数loader()中,调用chooseImage(img)会阻止后续调用timeImgChange().如果我更改这两个调用的顺序,则问题仍然存在于chooseImage()未被调用.希望有人可以帮忙,尼尔.

window.onload = loader;

function loader(){
    var img = document.getElementById('selector_chicks');
    chooseImage(img); //This function call works
    timeImgChange();  //Not called. Works in IE9. Is called if chooseImage() is removed
}


function chooseImage(img){
    document.getElementById('chooseimage').src = imageMap[img.title].path;
    document.getElementById(img.id).style.background = "#A66B00";
    document.getElementById('textselected').innerHTML = imageMap[img.title].text;

    /*unselect the other divs*/
    var selectors = document.getElementsByClassName('selector');
    for (var i = 0; i < selectors.length; i++){
        if (selectors[i].title != img.title){
            selectors[i].style.background = "#261e1e";
        }
    }
}

function timeImgChange() {  /*Change the image ever x milliseconds*/
    var imgIdArray = ["selector_egg", …
Run Code Online (Sandbox Code Playgroud)

javascript jquery internet-explorer

0
推荐指数
1
解决办法
195
查看次数

标签 统计

r ×2

image ×1

internet-explorer ×1

javascript ×1

jquery ×1

matrix ×1

numpy ×1

python ×1

split ×1

statistics ×1