转换为熵中的黄道坐标

时间:2019-11-19 15:41:12

标签: python astropy

我对astropy并不陌生,并试图掌握坐标转换模块。

我从一些简单的工作开始,这些工作与文档中的工作相似。例如:

bootstrap_ttest <- function(data1,data2,resamples){

    delta_real <- mean(data1) - mean(data2) ##real diff btwn means
    pooled_data <- c(data1, data2)

    null_differences <-c()
    for(x in 1:1000){

        data1_null <- sample(pooled_data,size=length(data1), replace=T)
        data2_null <- sample(pooled_data,size=length(data2), replace=T)

        delta_null <- mean(data1_null) - mean(data2_null)
        null_differences <- c(null_differences, delta_null )

    }## end of resampling loop 

    pvalue <- sum(abs(null_differences) > abs(delta_real))/length(null_differences)
    cat("pvalue:", pvalue)
    assign("pvalue", pvalue,.GlobalEnv) 
    assign("null_dist", null_differences,.GlobalEnv )
    assign("delta_obs", delta_real,.GlobalEnv )

}
ac_pvals = vector(length = ncol(ants))
ap_pvals = vector(length = ncol(ants))
sc_pvals = vector(length = ncol(ants))
sp_pvals = vector(length = ncol(ants))

for(i in 1:ncol(ants)){

  ants = data.frame(mainbroca[,9:13])

test1 = bootstrap_ttest(data1=mainbroca$Attack_count[ants == 0], 
                data2=mainbroca$Attack_count[ants>0], resamples=1000)
test2 = bootstrap_ttest(data1=mainbroca$Attack_percent[ants == 0], 
                data2=mainbroca$Attack_percent[ants>0], resamples=1000)
test3 = bootstrap_ttest(data1=mainbroca$Survival_count[ants == 0], 
                data2=mainbroca$Survival_count[ants>0], resamples=1000)
test4 = bootstrap_ttest(data1=mainbroca$Survival_percent[ants == 0], 
                data2=mainbroca$Survival_percent[ants>0], resamples=1000)

ac_pvals[1] = c(test1)
ap_pvals[1] = c(test2)
sc_pvals[1] = c(test3)
sp_pvals[1] = c(test4)

}

#reproducible

fakerow1 <- c(1,2,3,4,100,80,60,40,20)
fakerow2 <- c(1,2,3,4,100,80,60,40,20)
fakedata = rbind(fakerow1,fakerow2)
colnames(fakedata) = c('ac','ap','sc','sp','ant1','ant2','ant3','ant4','ant5')

给出FK5目录中银河北极的正确值。这是赤道参考系,但是我如何才能转换为黄道参考系呢?我找不到能完成这项工作的类似方法。有通用的transform_to()方法,但问题是我无法找到可用帧的完整列表。显然,所有文档和/或示例都遵循其中的一些,即:galactic,fk4 / 5,icrs,它们都是赤道和Galactic的。

1 个答案:

答案 0 :(得分:0)

如果它不在文档中,则始终可以求助于手动检查对象的所有属性。在交互式python shell中,如果您这样做

import astropy.coordinates as co
dir(co)

它将打印coordinates对象的所有属性。这是一个很长的清单,对于天体坐标或天文坐标我还不了解,无法确切地知道您需要什么,因此下面是打印内容的一部分:

'CIRS', 'FK4', 'FK4NoETerms', 'FK5', 'GCRS', 'Galactic', 'GalacticLSR', 'Galactocentric', 'GenericFrame', 'GeocentricMeanEcliptic', 'GeocentricTrueEcliptic', 'HCRS', 'HeliocentricEclipticIAU76', 'HeliocentricMeanEcliptic', 'HeliocentricTrueEcliptic', 'ICRS', 'ITRS', 

也许您需要GeocentricTrueEcliptic