PENELOPE软件包的移植与应用实例

合集下载

o2plsda软件包说明书

o2plsda软件包说明书

Package‘o2plsda’October14,2022Type PackageTitle Multiomics Data IntegrationVersion0.0.18Description Provides functions to do'O2PLS-DA'analysis for multiple omics data integration.The algorithm came from``O2-PLS,a two-block(X±Y)latent variable regression(LVR)method with an integral OSCfilter''which published by Johan Trygg and Svante Wold at2003<doi:10.1002/cem.775>.'O2PLS'is a bidirectional multivariate regression method that aims to separate the covariance be-tweentwo data sets(it was recently extended to multiple data sets)(Löfst-edt and Trygg,2011<doi:10.1002/cem.1388>;Löfst-edt et al.,2012<doi:10.1016/j.aca.2013.06.026>)from the systematic sources of variance being specific for each data set separately.License GPL-3Imports Rcpp(>=1.0.7),dplyr,magrittr,parallel,ggplot2,ggrepel,methods,statsDependsEncoding UTF-8Suggests knitr,markdown,rmarkdownVignetteBuilder knitrLinkingTo Rcpp,RcppArmadilloRoxygenNote7.1.2NeedsCompilation yesRepository CRANAuthor Kai Guo[aut,cre],Junguk Hur[aut],Eva Feldman[aut]Maintainer Kai Guo<*****************>Date/Publication2022-08-1207:10:02UTC12loadings R topics documented:loadings (2)loadings.o2plsda (3)loadings.plsda (3)o2cv (4)o2pls (5)O2pls-class (7)oplsda (7)plot.O2pls (8)plot.o2plsda (10)plot.plsda (11)plsda (12)print.O2pls (14)print.plsda (14)scores (15)scores.O2pls (15)scores.o2plsda (16)scores.plsda (16)summary.O2pls (17)summary.plsda (18)vip (18)Index20 loadings Extract the loadings from an O2PLSfitDescriptionThis function extracts loading parameters from an O2PLSfitThis function extracts loading parameters from an O2PLSfitUsageloadings(x,...)##S3method for class O2plsloadings(x,loading=c("Xjoint","Yjoint","Xorth","Yorth"),...)Argumentsx Object of class O2pls...For consistencyloading the loadings for one of"Xjoint","Yjoint","Xorth","Yorth"loadings.o2plsda3 ValueLoading matrixLoading matrixloadings.o2plsda extract the loading value from the O2PLSDA analysisDescriptionextract the loading value from the O2PLSDA analysisUsage##S3method for class o2plsdaloadings(x,loading="Xloading",...)Argumentsx Object of class o2plsdaloading the loadings for one of"Xjoint","Yjoint","Xorth","Yorth"...For consistencyloadings.plsda extract the loading value from the PLSDA analysisDescriptionextract the loading value from the PLSDA analysisUsage##S3method for class plsdaloadings(x,...)Argumentsx Object of class plsda...For consistency4o2cv o2cv Cross validation for O2PLSDescriptionCross validation for O2PLSUsageo2cv(X,Y,nc,nx,ny,group=NULL,nr_folds=5,ncores=1,scale=FALSE,center=FALSE)ArgumentsX a Numeric matrix(input)Y a Numeric matrix(input)nc Integer.Number of joint PLS components.nx Integer.Number of orthogonal components in Xny Integer.Number of orthogonal components in Ygroup a vector to indicate the group for Ynr_folds Integer to indicate the folds for cross validationncores Integer.Number of CPUs to use for cross validationscale boolean values determining if data should be scaled or notcenter boolean values determining if data should be centered or notValuea data frame with the Q and RMSE valuesAuthor(s)Kai GuoExamplesset.seed(123)X=matrix(rnorm(500),50,10)Y=matrix(rnorm(500),50,10)X=scale(X,scale=TRUE)Y=scale(Y,scale=TRUE)#group factor could be omitted if you don t have any groupgroup<-rep(c("Ctrl","Treat"),each=25)cv<-o2cv(X,Y,1:2,1:2,1:2,group=group,nr_folds=2,ncores=1)o2plsfit O2PLS model with best nc,nx,nyDescriptionfit O2PLS model with best nc,nx,nyUsageo2pls(X,Y,nc,nx,ny,scale=FALSE,center=FALSE) ArgumentsX a Numeric matrix(input)Y a Numeric matrix(input)nc Integer.Number of joint PLS components.nx Integer.Number of orthogonal components in Xny Integer.Number of orthogonal components in Yscale boolean values determining if data should be scaled or not center boolean values determining if data should be centered or not ValueAn object containingXscore Joint X scoresXloading Joint X loadingsYscore Joint Y scoresYloading Joint Y loadingsTYosc Orthogonal X scoresPYosc Orthogonal X loadingsWYosc Orthogonal X weightsUXosc Orthogonal Y scoresPXosc Orthogonal Y loadingsCXosc Orthogonal Y weightsBU Regression coefficient in Tt~UBT Regression coefficient in U~TtR2Xhat Prediction of X with YR2Yhat Prediction of Y with XR2X Variation of the modeled part in X(defined by Joint+Orthogonal variation)as proportion of total variation in XR2Y Variation of the modeled part in Y(defined by Joint+Orthogonal variation)as proportion of total variation in YR2Xcorr Variation of the joint part in XR2Ycorr Variation of the joint part in YR2Xo Variation of the orthogonal part in X as proportion of variation in XR2Yo Variation of the orthogonal part in Y as proportion of variation in YR2Xp Variation in X joint part predicted by Y Joint partR2Yp Variation in Y joint part predicted by X Joint partvarXj Variation in each Latent Variable(LV)in X Joint partvarYj Variation in each Latent Variable(LV)in Y Joint partvarXorth Variation in each Latent Variable(LV)in X Orthogonal partvarYorth Variation in each Latent Variable(LV)in Y Orthogonal partExy Residuals in XFxy Residuals in YAuthor(s)Kai GuoExamplesset.seed(123)X=matrix(rnorm(500),50,10)Y=matrix(rnorm(500),50,10)X=scale(X,scale=TRUE)Y=scale(Y,scale=TRUE)fit<-o2pls(X,Y,1,2,2)summary(fit)O2pls-class7 O2pls-class Class"O2pls"This class represents the Annotation informationDescriptionClass"O2pls"This class represents the Annotation informationSlotsX a Numeric matrix(input)Y a Numeric matrix(input)params paramaters ysed in o2pls analysisresults list of o2pls resultsAuthor(s)Kai Guooplsda Orthogonal partial least squares discriminant analysisDescriptionComputes orthogonal scores partial least squares regressions with the NIPALS algorithm.It returna comprehensive set of pls outputs(e.g.scores and vip).Usageoplsda(X,Y,nc,scale=FALSE,center=TRUE,maxiter=100,tol=1e-05)ArgumentsX a O2pls object or a matrix of predictor variables.Y a single vector indicate the groupnc the number of pls components(the one joint components+number of orthogo-nal components).scale logical indicating whether X must be scaled(suggest TRUE).center boolean values determining if data should be centered or notmaxiter maximum number of iterations.tol limit for convergence of the algorithm in the nipals algorithm.Valuea list containing the following elements:•nc the number of components used(one joint components+number of orthogonal components •scores a matrix of scores corresponding to the observations in X,The components retrieved correspond to the ones optimized or specified.•Xloadings a matrix of loadings corresponding to the explanatory variables.The components retrieved correspond to the ones optimized or specified.•Yloadings a matrix of partial least squares loadings corresponding to Y•vip the VIP matrix.•xvar a matrix indicating the standard deviation of each component(sd),the variance ex-plained by each single component(explained_var)and the cumulative explained variance(cu-mulative_explained_var).These values are computed based on the data used to create the projection matrices.•projection_matrix the matrix of projection matrix•weight a matrix of partial least squares("pls")weights.Author(s)Kai GuoExamplesX<-matrix(rnorm(50),10,5)Y<-matrix(rnorm(50),10,5)fit<-o2pls(X,Y,2,1,1)yy<-rep(c(0,1),5)fit0<-oplsda(fit,yy,2)plot.O2pls Score or loading plot for the O2PLS resultsDescriptionScore or loading plot for the O2PLS resultsUsage##S3method for class O2plsplot(x,type="score",var="Xjoint",group=NULL,ind=c(1,2),color=NULL,top=20,ellipse=TRUE,order=FALSE,pt.size=3,label=TRUE,label.size=4,repel=TRUE,rotation=FALSE,...)Argumentsx an O2pls objecttype score or loadingvar specify Xjointgroup color used for score plotind which components to be used for score plot or loading plot color color used for score or loading plottop the number of largest loading value to plotellipse TRUE/FALSEorder order by the value or notpt.size point sizelabel plot label or not(TRUE/FALSE)label.size label sizerepel use ggrepel to show the label or notrotationflip thefigure or not(TRUE/FALSE)...For consistencyValuea ggplot2objectAuthor(s)Kai GuoExamplesX<-matrix(rnorm(50),10,5)Y<-matrix(rnorm(50),10,5)fit<-o2pls(X,Y,2,1,1)plot(fit,type="score")plot.o2plsda Score,VIP or loading plot for the O2PLS resultsDescriptionScore,VIP or loading plot for the O2PLS resultsUsage##S3method for class o2plsdaplot(x,type="score",var="Xjoint",group=NULL,ind=c(1,2),color=NULL,top=20,ellipse=TRUE,order=FALSE,pt.size=3,label=TRUE,label.size=4,repel=FALSE,rotation=FALSE,...)Argumentsx an o2plsda objecttype score,vip or loadingvar specify Xjointgroup color used for score plotind which components to be used for score plot or loading plot color color used for score or loading plottop the number of largest loading value to plotellipse TRUE/FALSEorder order by the value or notpt.size point sizelabel plot label or not(TRUE/FALSE)label.size label sizerepel use ggrepel to show the label or notrotationflip thefigure or not(TRUE/FALSE)...For consistencyplot.plsda11 Valuea ggplot2objectAuthor(s)Kai GuoExamplesX<-matrix(rnorm(50),10,5)Y<-matrix(rnorm(50),10,5)fit<-o2pls(X,Y,2,1,1)yy<-rep(c(0,1),5)fit0<-oplsda(fit,yy,2)plot(fit0,type="score",group=factor(yy))plot.plsda Score,VIP or loading plot for the plsda resultsDescriptionScore,VIP or loading plot for the plsda resultsUsage##S3method for class plsdaplot(x,type="score",group=NULL,ind=c(1,2),color=NULL,top=20,ellipse=TRUE,order=FALSE,pt.size=3,label=TRUE,label.size=4,repel=FALSE,rotation=FALSE,...)Argumentsx an plsda objecttype score,vip or loadinggroup color used for score plotind which components to be used for score plot or loading plotcolor color used for score or loading plottop the number of largest loading value to plotellipse TRUE/FALSEorder order by the value or notpt.size point sizelabel plot label or not(TRUE/FALSE)label.size label sizerepel use ggrepel to show the label or notrotationflip thefigure or not(TRUE/FALSE)...For consistencyValuea ggplot2objectAuthor(s)Kai GuoExamplesX<-matrix(rnorm(500),10,50)Y<-rep(c("a","b"),each=5)fit0<-plsda(X,Y,2)plot(fit0,type="score",group=factor(Y))plsda Partial least squares discriminant analysisDescriptionPerform a PLS discriminant analysisUsageplsda(X,Y,nc,scale=TRUE,center=TRUE,cv=TRUE,nr_folds=5)ArgumentsX a matrix of predictor variables.Y a single vector indicate the groupnc the number of pls components(the one joint components+number of orthogo-nal components).scale logical indicating whether X must be scaled(suggest TRUE).center logical indicating whether X must be centered(suggest TRUE).cv logical indicating whether cross-validation will be performed or not(suggest TRUE).nr_folds nr_folds Integer to indicate the folds for cross validation.Valuea list containing the following elements:•nc the number of components used(one joint components+number of orthogonal components •scores a matrix of scores corresponding to the observations in X,The components retrieved correspond to the ones optimized or specified.•Xloadings a matrix of loadings corresponding to the explanatory variables.The components retrieved correspond to the ones optimized or specified.•vip the VIP matrix.•xvar variance explained of X by each single component.•R2Y variance explained of Y by each single component.•codePRESSThe residual sum of squares for the samples which were not used tofit the model •codeQ2quality of cross-validationAuthor(s)Kai GuoExamplesX<-matrix(rnorm(500),10,50)Y<-rep(c("a","b"),each=5)fit<-plsda(X,Y,2)14print.plsda print.O2pls Print the summary of O2PLS results.DescriptionPrint the summary of O2PLS results.Usage##S3method for class O2plsprint(x,...)Argumentsx An O2pls object...For consistencyAuthor(s)Kai GuoExamplesX<-matrix(rnorm(50),10,5)Y<-matrix(rnorm(50),10,5)object<-o2pls(X,Y,1,1,1)print(object)print.plsda Print the summary of plsda results.DescriptionPrint the summary of plsda results.Usage##S3method for class plsdaprint(x,...)Argumentsx An plsda object...For consistencyscores15Author(s)Kai GuoExamplesX<-matrix(rnorm(500),10,50)Y<-rep(c("a","b"),each=5)fit<-plsda(X,Y,2)print(fit)scores Extract the scores from an O2PLSfitDescriptionThis function extracts score matrices from an O2PLSfitUsagescores(x,...)Argumentsx Object of class O2pls...For consistencyValueScores matrixscores.O2pls Extract the scores from an O2PLSfitDescriptionThis function extracts scores parameters from an O2PLSfitUsage##S3method for class O2plsscores(x,score=c("Xjoint","Yjoint","Xorth","Yorth"),...)Argumentsx Object of class O2plsscore the scores matrix for one of"Xjoint","Yjoint","Xorth","Yorth"...Other arguments16scores.plsdaValuescore matrixscores.o2plsda Extract the scores from an O2PLS DA analysisDescriptionExtract the scores from an O2PLS DA analysisUsage##S3method for class o2plsdascores(x,...)Argumentsx Object of class o2plsda...Other argumentsValuescore matrixAuthor(s)Kai Guoscores.plsda Extract the scores PLSDA analysisDescriptionExtract the scores PLSDA analysisUsage##S3method for class plsdascores(x,...)Argumentsx Object of class plsda...Other argumentssummary.O2pls17 Valuescore matrixAuthor(s)Kai Guosummary.O2pls Summary of an O2PLS objectDescriptionSummary of an O2PLS objectUsage##S3method for class O2plssummary(object,...)Argumentsobject a O2pls object...For consistencyValueDetail of O2PLS resultsAuthor(s)Kai GuoExamplesX<-matrix(rnorm(50),10,5)Y<-matrix(rnorm(50),10,5)object<-o2pls(X,Y,1,1,1)summary(object)18vip summary.plsda Summary of an plsda objectDescriptionSummary of an plsda objectUsage##S3method for class plsdasummary(object,...)Argumentsobject a plsda object...For consistencyValueDetail of plsda resultsAuthor(s)Kai GuoExamplesX<-matrix(rnorm(500),10,50)Y<-rep(c("a","b"),each=5)fit<-plsda(X,Y,2)summary(fit)vip Extract the VIP values from the O2PLS-DA objectDescriptionExtract the VIP values from the O2PLS-DA objectUsagevip(x)Argumentsx the o2plsda object or plsda objectvip19Valuea data frameIndex∗classesO2pls-class,7loadings,2loadings.o2plsda,3loadings.plsda,3o2cv,4o2pls,5O2pls-class,7oplsda,7plot.O2pls,8plot.o2plsda,10plot.plsda,11plsda,12print.O2pls,14print.plsda,14scores,15scores.O2pls,15scores.o2plsda,16scores.plsda,16summary.O2pls,17summary.plsda,18vip,1820。

PowerPlay应用程序的移植

PowerPlay应用程序的移植

译制作品怎样移植你的POWERPLAY应用程序中青旅尚洋电子技术有限公司数据仓库事业部王晓刚版权所有©二00四年八月一、移植前的准备工作 (2)1.需要进行COGNOS POWERPLAY 应用移植的若干情况 (2)2.进行移植需做的工作 (3)3.移植前的准备工作 (6)二、将应用程序打包 (6)1. 导出安全认证信息源 (6)2.将Upfront数据打包 (7)2.1将Upfront Data Store打包 (7)2.2拷贝Upfront显示主题 (9)3.拷贝PowerPlay对象 (9)4.将文件移到目标环境中 (10)三、将应用程序解包 (10)1. 导入安全认证信息源 (11)2. 建立到数据源的联接 (11)3.将Upfront数据解包 (12)3.1解包Upfront Data Store (16)3.2修改Upfront显示主题 (18)3.3修改NewsItem的URL (18)3.4修改网关的URL (19)4.更新PowerPlay (19)4.1拷贝PPSRoot目录、CUBE和报表 (20)5. 测试目标环境 (21)一、移植前的准备工作1.需要进行COGNOS POWERPLAY 应用移植的若干情况♦从开发环境向生产环境迁移。

♦从开发环境向测试环境迁移。

♦重新部署到不同的机器。

在生产环境中,由于性能的原因,可能需要将COGNOS POWERPLAY 应用的部分组件分布到不同的计算机上。

你的COGNOS POWERPLAY 应用可能已经安装在一台计算机上,但随着访问用户的激增等原因,可能需要将COGNOS POWERPLAY 应用的一个或几个组件分布到另一台或多台计算机上。

♦改变存储在Upfront Data Store中的名字空间(Namespace)COGNOS POWERPLAY 应用的安全认证源被引用为名字空间(Namespace),因为Upfront在Upfront data store存贮了指向namespace的一个引用,当你改变了名字空间(Namespace),你也必须随之改变Upfront data store中对namespace的引用。

openscenegraph项目案例

openscenegraph项目案例

在本文中,我将为您撰写一篇关于openscenegraph项目案例的文章。

openscenegraph是一个开源的三维图形和可视化工具包,可用于创建高质量的虚拟现实和增强现实应用程序。

我将从简单的介绍开始,然后逐步深入讨论其项目案例,以帮助您更好地理解这一主题。

1. openscenegraph项目简介openscenegraph是一个强大的三维图形和可视化工具包,具有可伸缩性和高性能。

它广泛用于虚拟现实、增强现实、模拟、游戏开发等领域。

openscenegraph基于C++编程语言开发,提供了丰富的功能和灵活的工具,可以帮助开发人员轻松创建复杂的三维场景和图形效果。

2. openscenegraph项目案例具体来说,openscenegraph可以应用于各种项目中,例如飞行模拟器、医学可视化、工程建模、地理信息系统等。

下面我将为您介绍几个实际的openscenegraph项目案例,以便更好地理解其应用范围和实际效果。

2.1 飞行模拟器openscenegraph被广泛应用于飞行模拟器项目中,它可以模拟真实飞行环境,包括飞机、场景、天气等多个方面。

开发人员可以利用openscenegraph的强大功能,快速构建逼真的飞行模拟器,帮助飞行员进行飞行训练和飞行技能的提升。

2.2 医学可视化在医学领域,openscenegraph可以用于创建高质量的医学可视化工具,用于解剖学教学、手术模拟、病例分析等方面。

通过openscenegraph的渲染和建模技术,医生和学生可以更清晰地观察人体结构、器官功能等内容,有助于提高医学教育和临床实践的效率。

2.3 工程建模在工程领域,openscenegraph可以帮助工程师们进行复杂的工程建模和数据可视化,例如建筑设计、城市规划、工业设计等。

开发人员可以利用openscenegraph的三维建模功能,轻松创建真实的建筑场景,观察工程结构的变化、进行设计优化等工作。

ACNE软件包用户指南说明书

ACNE软件包用户指南说明书

Package‘ACNE’June25,2023Version0.9.0Depends R(>=3.0.0),aroma.affymetrix(>=2.14.0)Imports MASS,R.methodsS3(>=1.7.0),R.oo(>=1.23.0),R.utils(>=2.1.0),matrixStats(>=0.50.0),R.filesets(>=2.9.0),aroma.core(>=2.14.0)Suggests DNAcopyTitle Affymetrix SNP Probe-Summarization using Non-Negative MatrixFactorizationDescription A summarization method to estimate allele-specific copy number signals for Affymetrix SNP microarrays using non-negative matrix factorization(NMF).License LGPL(>=2.1)URL https:///HenrikBengtsson/ACNEBugReports https:///HenrikBengtsson/ACNE/issuesLazyLoad TRUEbiocViews aCGH,CopyNumberVariants,SNP,Microarray,OneChannel,TwoChannel,GeneticsNeedsCompilation noAuthor Maria Ortiz[aut],Henrik Bengtsson[aut,cre,cph],Angel Rubio[aut]Maintainer Henrik Bengtsson<*****************>Repository CRANDate/Publication2023-06-2518:30:02UTCR topics documented:ACNE-package (2)doACNE (2)NmfPlm (3)NmfSnpPlm (5)12doACNEIndex7ACNE-package Package ACNEDescriptionA summarization method to estimate allele-specific copy number signals for Affymetrix SNP mi-croarrays using non-negative matrix factorization(NMF).Installation and updatesThis package requires the aroma.affymetrix package.To install this package,do:install.packages("ACNE") To get started1.For a one-command pipeline,see the doACNE()method.2.For other usages,see the NmfPlm class.LicenseLGPL(>=2.1)Author(s)Maria Ortiz,Henrik Bengtsson,Angel RubioReferences[1]M.Ortiz-Estevez,H.Bengtsson,A.Rubio,ACNE:a summarization method to estimate allele-specific copy numbers for Affymetrix SNP arrays,Bioinformatics,2010[PMC2913655].doACNE(ACNE)Description(ACNE)based on[1].The algorithm is processed in bounded memory,meaning virtually anynumber of arrays can be analyzed on also very limited computer systems.Usage##S3method for class AffymetrixCelSetdoACNE(csR,fln=FALSE,drop=TRUE,verbose=FALSE,...)##Default S3method:doACNE(dataSet,...,verbose=FALSE)ArgumentscsR,dataSet An AffymetrixCelSet(or the name of an AffymetrixCelSet).fln If TRUE,CRMAv2-style PCR fragment-length normalization is performed,oth-erwise not.drop If TRUE,the RMA summaries are returned,otherwise a named list of all inter-mediate andfinal results.verbose See Verbose....Additional arguments used to set up AffymetrixCelSet(when argument dataSet is specified).ValueReturns a named list,iff drop==FALSE,otherwise a named list of AromaUnitTotalCnBinarySet and AromaUnitFracBCnBinarySet.Author(s)Henrik BengtssonReferences[1]M.Ortiz-Estevez,H.Bengtsson,A.Rubio,ACNE:a summarization method to estimate allele-specific copy numbers for Affymetrix SNP arrays,Bioinformatics,2010[PMC2913655]. NmfPlm The NmfPlm classDescriptionPackage:ACNEClass NmfPlmObject~~|~~+--ParametersInterface~~~~~~~|~~~~~~~+--Model~~~~~~~~~~~~|~~~~~~~~~~~~+--UnitModel~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~+--MultiArrayUnitModel~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~+--ProbeLevelModel~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~+--NmfPlmDirectly known subclasses:NmfSnpPlmpublic abstract static class NmfPlmextends ProbeLevelModelThis class represents the NMF model of[REF].UsageNmfPlm(...,maxIter=10L,maxIterRlm=20L,refs=NULL,flavor=c("v4","v3","v2","v1"))Arguments...Arguments passed to ProbeLevelModel.maxIter The maximum number of iteration in the NMF step.maxIterRlm A positive integer specifying the maximum number of iterations used in rlm.refs An index vector(integer or logical)specifying the reference samples.IfNULL,all samples are used as a reference.flavor(Internal/developmental only)A character string specifying which algorithmto use.Fields and MethodsMethods:getAsteriskTags-Methods inherited from ProbeLevelModel:calculateResidualSet,calculateWeights,fit,getAsteriskTags,getCalculateResidualsFunction,getChip-EffectSet,getProbeAffinityFile,getResidualSet,getRootPath,getWeightsSetMethods inherited from MultiArrayUnitModel:getListOfPriors,setListOfPriors,validateMethods inherited from UnitModel:findUnitsTodo,getAsteriskTags,getFitSingleCellUnitFunction,getParametersMethods inherited from Model:as.character,fit,getAlias,getAsteriskTags,getDataSet,getFullName,getName,getPath,getRoot-Path,getTags,setAlias,setTagsMethods inherited from ParametersInterface:getParameterSets,getParameters,getParametersAsStringMethods inherited from Object:$,$<-,[[,[[<-,as.character,attach,attachLocally,clearCache,clearLookupCache,clone,detach,equals,extend,finalize,getEnvironment,getFieldModifier,getFieldModifiers,getFields,getInstan-tiationTime,getStaticInstance,hasField,hashCode,ll,load,names,objectSize,print,save,asThis Author(s)Henrik BengtssonReferences[1]M.Ortiz-Estevez,H.Bengtsson,A.Rubio,ACNE:a summarization method to estimate allele-specific copy numbers for Affymetrix SNP arrays,Bioinformatics,2010[PMC2913655].See AlsoInternally,for each SNP the NMF model isfitted using the fitSnpNmf()function. NmfSnpPlm The NmfSnpPlm classDescriptionPackage:ACNEClass NmfSnpPlmObject~~|~~+--ParametersInterface~~~~~~~|~~~~~~~+--Model~~~~~~~~~~~~|~~~~~~~~~~~~+--UnitModel~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~+--MultiArrayUnitModel~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~+--ProbeLevelModel~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~+--NmfPlm~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+--SnpPlm~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+--NmfSnpPlmDirectly known subclasses:public abstract static class NmfSnpPlmextends SnpPlmUsageNmfSnpPlm(...,mergeStrands=FALSE)Arguments...Arguments passed to NmfPlm.mergeStrands If TRUE,the sense and the anti-sense strands arefitted together,otherwise sepa-rately.Fields and MethodsMethods:No methods defined.Methods inherited from SnpPlm:getCellIndices,getChipEffectSet,getMergeStrands,getParameters,getProbeAffinityFile,setMergeS-trandsMethods inherited from NmfPlm:getAsteriskTagsMethods inherited from ProbeLevelModel:calculateResidualSet,calculateWeights,fit,getAsteriskTags,getCalculateResidualsFunction,getChip-EffectSet,getProbeAffinityFile,getResidualSet,getRootPath,getWeightsSetMethods inherited from MultiArrayUnitModel:getListOfPriors,setListOfPriors,validateMethods inherited from UnitModel:findUnitsTodo,getAsteriskTags,getFitSingleCellUnitFunction,getParametersMethods inherited from Model:as.character,fit,getAlias,getAsteriskTags,getDataSet,getFullName,getName,getPath,getRoot-Path,getTags,setAlias,setTagsMethods inherited from ParametersInterface:getParameterSets,getParameters,getParametersAsStringMethods inherited from Object:$,$<-,[[,[[<-,as.character,attach,attachLocally,clearCache,clearLookupCache,clone,detach, equals,extend,finalize,getEnvironment,getFieldModifier,getFieldModifiers,getFields,getInstan-tiationTime,getStaticInstance,hasField,hashCode,ll,load,names,objectSize,print,save,asThisAuthor(s)Henrik BengtssonIndex∗classesNmfPlm,3NmfSnpPlm,5∗packageACNE-package,2ACNE(ACNE-package),2ACNE-package,2AffymetrixCelSet,3 AromaUnitFracBCnBinarySet,3 AromaUnitTotalCnBinarySet,3 character,4doACNE,2,2fitSnpNmf,5integer,4list,3logical,4Model,3,5MultiArrayUnitModel,3,5NmfPlm,2,3,5,6NmfSnpPlm,4,5NULL,4Object,3,5ParametersInterface,3,5 ProbeLevelModel,3–5SnpPlm,5,6TRUE,3,6UnitModel,3,5vector,4Verbose,37。

PeneloPET:一种PET专用的蒙特卡罗仿真工具

PeneloPET:一种PET专用的蒙特卡罗仿真工具

理 组研 发 的 , 目前 的最 新版 本是 20 0 7年 6月 发 布 的 1 1 本 。P nlP T具 有 以下 特 点 : .版 ee E o
Ma Sx平 台 下运 行 Pn lP T 均 不 会 出现 cO ee E , o
移 植 问题 。 而 另 一 仿 真 软 件 G T 则 不 能 在 A E,
刘豪佳 , 书俊 , 赵 张 斌 , 山虎 周
( 郑州大学 , 河南郑州 4 0 0 ) 50 1
摘要 : ee P T是 一种基 于 P N L P P nl E o E E O E的 P T专用 蒙特卡 罗仿真 工具 。文 章介绍 了 P nlP T E ee E o
的主要特点及使用 Pnl E ee P T进行 P T仿真的一般过程 , 以 G e ha 的双环型 e p r Vs i o E 并 EH a c e h r Xle ia — o tm
收稿 日期 : 1 2 0—1 —0 0 1 5
作者简介: 刘豪佳(95 )女, 1 一 , 河南平顶山 硕士 8 人,
研究生 , 研究方向为核医学图像处理。
1 P n lP T的特点 ee E o
Pnl E ee P T是 由马德 里 康 普 顿 斯 大 学 核 物 。
1 43 l
第3卷 1
21 年 01
第 1 O期
1 0月
核 电子 学与探 测 技术
N c e rE e to is& Dee t n T c n l g u la l cr n c t ci e h oo y o
V I 3 No. 0 o_ l 1 0t 2 c. 0l1
P n lP T:一种 P T专 用 的蒙 特 卡 罗仿 真 工 具 ee E o E

PENELOPE软件包的移植与应用实例

PENELOPE软件包的移植与应用实例

第5卷第3期 上海大学学报(自然科学版) V o l.5,N o.3 1999年6月 JOU RNAL O F SHAN GHA IUN I V ER S IT Y(NA TU RAL SC IEN CE) June1999PENELO PE软件包的移植与应用实例X罗文芸 王传珊 黄 伟  (化学与化工学院) (理学院) 提 要 PEN ELO PE是电子2光子簇射的M on te2Carlo模拟计算软件包(F.Salvat,1996),能量范围为1keV至几百M eV;模拟计算方法为混合模拟,即硬事件的详细模拟与软事件的压缩模拟相结合;有构造简单的几何软件包,能模拟光子2电子在由二次曲面构成的复杂几何体中的输运过程.本文作者在133微机上实现了对PEN ELO PE的移植,并给出了两个应用实例.关键词 M on te2Carlo方法;混合模拟;能量沉积;电子2光子簇射中图法分类号 T P311.54;TL99The Portable of PENELOPE and Appl ied Exam plesL uo W enyun W ang Chuan shan(Schoo l of Chem istry and Chem ical Engineering,ShanghaiU n iversity)H uang W ei(Schoo l of Sciences,ShanghaiU n iversity)Abstract:PEN ELO PE p erfo rm s M on te2Carlo si m u lati on of electron2p ho ton show ers in arb itrary fo r a w ide energy range,from1keV to several hundred M eV.T he m ethod of si m u lati on is a m ixed p rocedu re,w h ich com b ines detailed si m u lati on of hard even ts w ith conden sed si m u lati on of soft in teracti on s.A si m p le geom etry p ackage p erm its the generati on of random electron2p ho ton show ers in m aterial system s con sisting of hom ogeneou s bodies li m ited by quadric su rface.T he po rtab le of th is code and tw o app lied exam p les have been given.Key words:M on te2Carlo m ethod;m ixed si m u lati on;depo sited energy;electron2p ho ton show ers M on te2Carlo方法在粒子输运上的应用是它最成功的应用,多年来M on te2Carlo方法编制的软件和研究论文一直很多,仅对高能电子而言,常用的就有ETRAN[1](B erger,1988)、IT S3[2](H alb leib, 1992)、EGS4[3](N elson,1985)、GEAN T[4](B run, 1986)等.可是,高能电子的详细模拟是有困难的,因为电子在与介质的一次相互作用后损失的能量很小,只有几十个电子伏特量级,这样,一个高能电子在被介质吸收之前与介质相互作用的次数相当巨大,详细模拟效率非常低.多次散射理论的引入,是将给定路程段中的大量事件作为一个整体效应处理,这样的M on te2Carlo模拟叫做压缩(Conden sed) M on te2Carlo方法.基于多次散射的压缩M on te2 Carlo方法是近似的模拟,有系统误差,而且模拟结果与所取步长有关,只有当步长足够小时,计算结果才稳定,故耗费的机时太多.同时过小的步长也可能X收稿日期:1998211226 罗文芸,女,1965年生,硕士,助研;上海大学化学与化工学院射线应用研究所,上海市嘉定区城中路20号(201800)阻止某些相互作用的发生而影响模拟结果的准确性.此外,这种方法在介质存在界面时也会产生新的困难.上述的M on te2Carlo程序都是这种方法.F. Salvat于1988年提出了压缩M on te2Carlo方法与微分截面的解析解相结合的方法,其散射模型是将数值的总截面(阻止本领)和不同相互作用机制下解析的微分截面(对不同反应道)结合起来,因此程序的结构非常简单.在对电子进行模拟时,采用这种混合过程,即对散射角或能量损失大于截止值的硬相互作用事件详细模拟,只要截止值选择适当,每个径迹中的硬事件数是相对较小的,详细模拟完全可行.而对散射角和能量损失都不超过截止值的软相互作用事件用多次散射方法处理.这样,所引起的横向歧离小,跨越界面时的误差也小.这种M on te2Carlo方法,对具有复杂辐射环境和复杂几何条件问题提供了解决方法.我们的目的是建立一个可以方便地在普通微机上实现的高能电子的M on te2Carlo程序,基于PEN ELO PE[5]较之其他程序的优势,故选择了对PEN ELO PE的移植和开发.1 软件移植PEN ELO PE是模拟电子2光子簇射的M on te2 Carlo软件包(F.Salvat,1996),能量范围为1keV 至几百M eV;有很全面的数据库,自然界中存在的92种元素和由其组成的近300种常用材料的有关信息,都有现成的数据可调用,对这300种以外的材料,可以自己生成数据;还有一个灵活可变的几何软件,运行几何软件可以生成任何可以用二次曲面表示的几何体的组合;除此之外,它还有强大的计算功能,对于有复杂结构物体的剂量分布通过一次计算就可以全部得出.整个软件主要由三个程序包和一个数据库组成:(a)模拟程序包该程序包是软件的核心,即主体程序,由几十个子程序组成,模拟电子2光子在介质中的运动历史.(b)几何程序包该程序包主要是解决由于介质的整体不均匀性给电子模拟带来的困难.用它可以检验径迹是否跨界面,自动实现模拟的几何要求.(c)材料程序包该程序包由一个辅助程序M A T ER I AL和若干子程序组成,实现从数值的数据库中提取相关原子的相互作用数据,形成反映介质各种特性的材料数据文件.(d)数据库该数据库除包含序号1~92的92种元素的相互作用截面和核外电子层数据,还附有包括92种元素在内的近三百种不同材料的组成数据.主程序的流程图可由图1表示.图1 主程序流程图我们在通读整个软件包的基础上,对其源程序进行了适当修改,特别是对电子(或光子)入射部分,使其不仅适用点源和面源,也适用于其他复杂几何的入射情况.根据实践,由于模拟过程涉及众多的变量,而且模拟结果的可靠性在很大程度上取决于模拟的初始粒子数是否足够多,因此PEN ELO PE的・412・ 上海大学学报(自然科学版) 第5卷实际运行对所用计算机的内存和速度有比较高的要求.在安装了W I NDOW S 下的FO R TRAN 编译系统、内存容量为32M 的奔腾133微机上,该软件的运行情况是比较理想的.下面给出两个应用实例.2 模拟计算2.1 半无限厚平板介质被模拟的介质由三层组成,第一层钛窗(0.03mm ),第二层空气(10c m ),第三层为半无限厚的平板碳材料;电子能量2M eV ,平行正入射.跟踪10万个入射电子,给出电子在平板碳材料中的能量沉积深度分布,并与实验进行比较,结果符合较好,见图2.图中实验数据摘自参考文献[6].图2 2M eV 电子在碳中的能量沉积分布2.2 电缆选择铝芯交联聚乙烯绝缘架空电缆为模拟对象,电缆的外半径为1c m ,铝芯的半径为0.75c m ,聚乙烯绝缘层厚度为0.25c m .假设加速器产生的电子为平行电子束,能量为2M eV ,在辐照过程中电缆线不进行旋转,即单面辐照,见示意图(图3).图3 电缆截面示意图把绝缘层沿径向从外到里分为5层(layer 1~layer 5),每层厚度为0.05c m ,再沿极角方向(见图3)将每层36等分,算出电子在每个小体积元内能量沉积的平均值,跟踪20万个入射电子后,给出在每层绝缘层中,电子能量沉积沿极角H 的分布情况,见图4.图4 2M eV 电子在电缆绝缘层中能量沉积分布由图4可以看出,绝缘层上表面(0°≤H <180°)最外层(layer 1)电子能量沉积小,而里层(layer 5)反而大,但在近0°和180°处,出现相反现象,外层大里层小.这主要是铝芯背散射的结果,因为背散射系数与原子序数成正比[7],铝的原子序数大于聚乙烯的等效原子序数,受铝芯背散射效应的影响,绝缘层上表面里层的电子能量沉积明显增大,而在近0°和180°处,背散射影响小,则出现相反现象;其次,在电子平行正入射的情况下,根据深度剂量分布规律[8],电子在吸收体中的能量沉积并不是呈线性下降的趋势,而总是呈一个先上升再下降的分布形状(见图2),峰位和宽度与电子能量、吸收体原子序数和阻止本领等因素有关,在本例模拟计算中,由于假设电缆线是受单面辐照,平行电子束只有在上表面正中间的地方可以近似为正入射,其它地方电子的入射情况都只能看作斜入射,能量沉积分布更为复杂.这也是导致上述结果的原因之一.绝缘层下表面(180°≤H <360°)电子能量沉积几乎为零,这表明电子大部分截止在铝芯内,电缆绝缘层下表面基本辐照不到.如果将电缆线不停地进行旋转,电子的入射方向可以近似为沿径向的正入射,加上铝芯的背散射作用,对绝缘层稍厚一些的电缆线,也能基本达到均匀辐照的效果.因此,在辐照・512・第3期 罗文芸等:PEN ELO PE 软件包的移植与应用实例过程中,电缆线的旋转是十分必要的.3 讨 论PEN ELO PE软件包采用混合的M on te2Carlo 模拟方法,把电子与物质的相互作用区分为硬、软碰撞,仅仅对硬碰撞做详细模拟,对软碰撞用多次散射理论模拟,这样可以相应缩短机时,提高计算效率,同时,混合模拟使介质中界面的处理也变得十分容易,当电子在两次硬碰撞之间遇到界面时,自动调整步长,使电子停止在界面处,调用新材料的有关信息后,再继续模拟下一次碰撞,这样处理在程序上容易实现,对复杂几何体的模拟也能得到比较准确的结果.PEN ELO PE作为模拟电子2光子簇射的M on te2Carlo软件包,能在微机上实现,有很宽的能量范围,能模拟任意材料和有复杂结构的介质,这对射线应用而言,无疑是增加了一种很好的研究手段.本文对PEN ELO PE应用于多层平板介质和多层圆柱体作了模拟计算,其中,多层平板介质的计算结果与其它实验室的实验结果作了比较.多层平板和多层圆柱体都是结构比较简单的几何体,我们将PEN ELO PE应用在模拟电子加速器和卫星空间辐射环境上,得到了令人满意的结果,以后将另文发表.参 考 文 献1 Jenk in s T W,N elson W R,R indi A.M on te Carlo tran spo rt of electron s and pho ton s,19882 H alb leib J A,Ken sek R P,M eh lho rn T A,et al.R e2 po rt SAND9121632Sandia N ati onal L abo rato ries,1992 3 N elson W R,H irayam a H,Rogers D W O.Stanfo rd lin2 ear accelerato r cen ter repo rt.SLA C2265,19854 B run R,B ruyan t F,M aireM,et al.CERN R epo rt DD EE8421,19865 Salvat F,Fernandez2V area J M,Baro J,et rm es tecn ico s ciem at,1996.7996 A ndreo P,Ito R,T abata T.A tom ic data and nuclear data tab les,1994,56:1057 王传珊等.电子束在多层材料中的背散射效应.核技术, 1995,18(3):1668 地人书馆(日本).R adiati on do si m etry of electron beam s fo r radiati on p rocessing,1992.122^・612・ 上海大学学报(自然科学版) 第5卷。

openscenegraph编译

openscenegraph编译

openscenegraph编译OpenSceneGraph是一个强大的开源3D图形引擎,可以用于游戏开发、模拟和数据可视化等领域。

如果你想学习和使用OpenSceneGraph,那么编译它是一个重要的步骤。

以下是一些基本的步骤,可以帮助你编译OpenSceneGraph:1. 下载OpenSceneGraph源代码。

可以从OpenSceneGraph官网或GitHub上下载源代码。

选择你想要的版本,下载后解压缩到一个目录中。

2. 安装必要的依赖项。

OpenSceneGraph需要一些依赖项,包括OpenGL、GLUT、OpenAL、FreeType等。

你需要安装它们的开发库。

在Ubuntu上,可以使用以下命令安装:sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev libglut-dev libopenal-dev libfreetype6-dev在Fedora上,可以使用以下命令安装:sudo dnf install mesa-libGL-devel mesa-libGLU-devel freeglut-devel openal-soft-devel freetype-devel在Windows上,你需要安装OpenGL、GLUT、OpenAL和FreeType 的开发库,并将它们添加到系统路径中。

你也可以使用第三方工具(如CMake)来自动化此过程。

3. 配置和编译。

在Linux上,可以使用以下命令进行配置和编译:./configuremake -j4sudo make install在Windows上,你可以使用Visual Studio或MinGW等IDE进行配置和编译。

你需要将OpenSceneGraph源代码添加到项目中,设置依赖项并进行编译。

4. 测试。

编译完成后,你可以使用OpenSceneGraph提供的示例程序来测试它是否正常工作。

permPATH软件包用户指南说明书

permPATH软件包用户指南说明书

Package‘permPATH’September5,2023Type PackageTitle Permutation Based Gene Expression Pathway AnalysisVersion1.3Description Can be used to carry out permutation based gene expression pathway analy-sis.This work was supported by a National Institute of Allergy and Infectious Dis-ease/National Institutes of Health contract(No.HHSN272200900059C).Depends R(>=3.4.0),R2HTML(>=2.3.2),xtable(>=1.8-2)VignetteBuilder knitrSuggests knitrLicense GPL-3LazyLoad yesNeedsCompilation yesAuthor Ivo D.Shterev[aut,cre],Kouros Owzar[aut],Gregory D.Sempowski[aut],Kenneth Wilder[ctb,cph](wrote original version of ranker.h)Maintainer Ivo D.Shterev<*******************>Repository CRANDate/Publication2023-09-0504:00:03UTCR topics documented:permPath-package (2)perm.path (2)permPATH2HTML (4)Index61permPath-package Permutation Based Gene Expression Pathway Analysis.DescriptionCan be used to carry out permutation based gene expression pathway analysis.This work was supported by a National Institute of Allergy and Infectious Disease/National Institutes of Health contract(No.HHSN272200900059C).Author(s)I.D.Shterev,K.Owzar and G.D.SempowskiMaintainer:I.D.Shterev<******************>ReferencesB.Efron,R.Tibshirani(2007)On Testing the Significance of Sets of Genes.The Annals of AppliedStatistics.Vol.1,No1,107–129.A.Subramanian,P.Tamayo,V.K.Mootha,S.Mukherjee,B.L.Ebert,M.A.Gillette,A.Paulovich,S.L.Pomeroy,T.R.Golub,nder and J.P.Mesirov(2005),Gene Set Enrichment Analysis:A knowledge-based Approach for Interpreting Genome-Wide Expression Profiles.Proc.Natl.A.Vol.102,No43,15545–15550.perm.path Perform Permutation Based Pathway AnalysisDescriptionThis is the package main function.Usageperm.path(expr,y,local.test,global.test="wilcoxon",B,gset,min.num=2,max.num, imputeval=NULL,transfun=function(x){x},sort="pval",anno=NULL)Argumentsexpr An K×n matrix of gene expression data,where K is the number of genes and n is the number of samples.y An outcome vector of length n.local.test Local test statistic of each gene.Current possible choices are t−test,W ilcoxon test,P earson,Spearman and JT test.global.test Global test statictic,used to compute the score.Current possible choices are mean,meanabs(mean of absolute values)and maxmean.B specifies the number of random permutations to be performed.gset A list of pathways.Each element is a vector of gene names.The list element names are the pathway names.min.num Specifies the minimum number of genes that a pathway should have.Pathways with smaller number of genes will be excluded.max.num Specifies the maximum number of genes that a pathway should have.Pathways with larger number of genes will be excluded.imputeval The gene expression value to be imputed in case of missing values.The default choice is NULL in which case no imputation is done.transfun Specifies transformation of the gene expression data.The default option is un-transformed gene expression data.sort Specifies sorting of the results.If sort=”pval”sorting is done in order of increasing p−values.If sort=”score”sorting is done in order of decreasingscores.anno If T RUE the output contains annotation of each pathway.ValueThis function returns a list consisting of the following elements:res Data frame consisting of the pathway names(Pathway),the genes involved in each pathway(Genes),the number of genes in each pathway(Size),thescore for each pathway(Score),the permutation raw p-value(pval),the FWER-adjusted permutation p-value(pfwer),the FDR-adjusted permutation p-value,the Bonferroni-adjusted permutation p-value(bonferroni)stats The individual test statistic for each genescores A matrix of scores.The matrix is of dimension(B+1)×K,where K is the number of pathways.Thefirst column contains the unpermuted scores,theremaining B columns contain the scores computed after each permutation. ReferencesB.Efron,R.Tibshirani(2007)On Testing the Significance of Sets of Genes.The Annals of AppliedStatistics.Vol.1,No1,107–129.A.Subramanian,P.Tamayo,V.K.Mootha,S.Mukherjee,B.L.Ebert,M.A.Gillette,A.Paulovich,S.L.Pomeroy,T.R.Golub,nder and J.P.Mesirov(2005),Gene Set Enrichment Analysis:A knowledge-based Approach for Interpreting Genome-Wide Expression Profiles.Proc.Natl.A.Vol.102,No43,15545–15550.Examplesset.seed(1234)##Generate toy phenotype and gene expression data sets##This example consists of40genes grouped into5pathways and100patients##grp is a binary trait(e.g.,case vs control)##bp is a continuous trait(e.g.,blood pressure)##g is a group indicatorn=100K=40grp=rep(1:0,each=n/2)bp=rnorm(n)g=rep(1:(n/20),rep(20,n/20))pdat=data.frame(grp,bp,g)rm(grp,bp)expdat=matrix(rnorm(K*n),K,n)##Assign marker names g1,...,gK to the expression data set and##patient ids id1,...,idn to the expression and phenotype datagnames=paste("g",1:K,sep="")rownames(expdat)=gnamespatid=paste("id",1:n,sep="")rownames(pdat)=patidcolnames(expdat)=patid#Group the K genes into M pathways of sizes n1,...,nMM=5p=runif(M)p=p/sum(p)nM=rmultinom(1,size=K,prob=p)gset=lapply(nM,function(x){gnames[sample(x)]})names(gset)=paste("pathway",1:M,sep="")##Carry out permutation analysis with grp as the outcome##using the two-sample Wilcoxon with B=100random permutationsperm.path(expdat,y=pdat[["grp"]],local.test="wilcoxon",global.test="maxmean",B=100, gset=gset,min.num=2,max.num=50,sort="score")##Carry out permutation analysis with g as the outcome##using the JT test with B=100random permutationsperm.path(expdat,y=pdat[["g"]],local.test="jt",global.test="maxmean",B=100,gset=gset,min.num=2,max.num=50,sort="score")permPATH2HTML This is a function for creating an HTMLfileDescriptionThe function creates an HTMLfile.UsagepermPATH2HTML(dat,dir,fname,title=NULL,bgcolor="#BBBBEE")Argumentsdat A data frame.dir Directory in which to store thefile.fname File name.title The title of the htmlfile.bgcolor Color for the html background.Examples##Generate toy phenotype and gene expression data sets##This example consists of40genes grouped into5pathways and100patients##grp is a binary trait(e.g.,case vs control)##bp is a continuous trait(e.g.,blood pressure)set.seed(1234)n=100K=40grp=rep(1:0,each=n/2)bp=rnorm(n)pdat=data.frame(grp,bp)rm(grp,bp)expdat=matrix(rnorm(K*n),K,n)##Assign marker names g1,...,gK to the expression data set and##patient ids id1,...,idn to the expression and phenotype datagnames=paste("g",1:K,sep="")rownames(expdat)=gnamespatid=paste("id",1:n,sep="")rownames(pdat)=patidcolnames(expdat)=patid#Group the K genes into M pathways of sizes n1,...,nMM=5p=runif(M)p=p/sum(p)nM=rmultinom(1,size=K,prob=p)gset=lapply(nM,function(x){gnames[sample(x)]})names(gset)=paste("pathway",1:M,sep="")##Carry out permutation analysis with grp as the outcome##using the two-sample Wilcoxon with B=100random permutationsres=perm.path(expdat,y=pdat[["grp"]],local.test="wilcoxon",global.test="maxmean", B=100,gset=gset,min.num=2,max.num=50,sort="score")#create an html file#epermPATH2HTML(rstab,dir="/dir/",fname="tophits")Indexperm.path,2permPath(permPath-package),2permPATH-package(permPath-package),2 permPath-package,2permPATH2HTML,46。

cPseudoMaRg软件包说明说明书

cPseudoMaRg软件包说明说明书

Package‘cPseudoMaRg’October12,2022Type PackageTitle Constructs a Correlated Pseudo-Marginal SamplerVersion1.0.1Description The primary function makeCPMSampler()generates a sampler function which per-forms the correlated pseudo-marginal method of Deligianni-dis,Doucet and Pitt(2017)<arXiv:1511.04992>.If the'rho='argument of makeCPMSam-pler()is set to0,then the generated sampler function performs the original pseudo-marginal method of Andrieu and Roberts(2009)<DOI:10.1214/07-AOS574>.The sam-pler function is constructed with the user's choice of prior,parameter proposal distribu-tion,and the likelihood approximation scheme.Note that this algorithm is not automati-cally tuned--each one of these arguments must be carefully chosen.License MIT+file LICENSERoxygenNote7.1.1Suggests knitr,rmarkdownVignetteBuilder knitrNeedsCompilation noAuthor Taylor Brown[aut,cre]Maintainer Taylor Brown<*******************>Repository CRANDate/Publication2021-09-0500:30:12UTCR topics documented:isBadNum (2)makeCPMSampler (2)mean.cpmResults (4)plot.cpmResults (5)print.cpmResults (5)Index61isBadNum checks if a log-density evaluation is not a valid numberDescriptionchecks if a log-density evaluation is not a valid numberUsageisBadNum(num)Argumentsnum evaluation of a log-densityValueTRUE or FALSEExamplesisBadNum(NaN)makeCPMSampler correlated pseudo-marginal:generates functions that output a bigvectorDescriptioncorrelated pseudo-marginal:generates functions that output a big vectorUsagemakeCPMSampler(paramKernSamp,logParamKernEval,logPriorEval,logLikeApproxEval,yData,numU,numIters,rho=0.99,storeEvery=1,nansInLLFatal=TRUE)ArgumentsparamKernSamp function(theta)->theta proposallogParamKernEvalfunction(oldTheta,newTheta)->logDensity.logPriorEval function(theta)->logDensity.logLikeApproxEvalfunction(y,thetaProposal,uProposal)->logApproxDensity.yData the observed datanumU integer number of u samplesnumIters integer number of MCMC iterationsrho correlation tuning parameter(-1,1)storeEvery increase this integer if you want to use thinningnansInLLFatal terminate the entire chain on NaNs,or simply disregard sample Valuevector of theta samplesExamples#sim datarealTheta1<-.2+.3realTheta2<-.2realParams<-c(realTheta1,realTheta2)numObs<-10realX<-rnorm(numObs,mean=0,sd=sqrt(realTheta2))realY<-rnorm(numObs,mean=realX,sd=sqrt(realTheta1-realTheta2)) #tuning paramsnumImportanceSamps<-1000numMCMCIters<-1000randomWalkScale<-1.5recordEveryTh<-1sampler<-makeCPMSampler(paramKernSamp=function(params){return(params+rnorm(2)*randomWalkScale)},logParamKernEval=function(oldTheta,newTheta){dnorm(newTheta[1],oldTheta[1],sd=randomWalkScale,log=TRUE)+dnorm(newTheta[2],oldTheta[2],sd=randomWalkScale,log=TRUE)},logPriorEval=function(theta){if((theta[1]>theta[2])&all(theta>0)){}else{-Inf}},4mean.cpmResults logLikeApproxEval=function(y,thetaProposal,uProposal){if((thetaProposal[1]>thetaProposal[2])&(all(thetaProposal>0))){xSamps<-uProposal*sqrt(thetaProposal[2])logCondLikes<-sapply(xSamps,function(xsamp){sum(dnorm(y,xsamp,sqrt(thetaProposal[1]-thetaProposal[2]),log=TRUE))})m<-max(logCondLikes)log(sum(exp(logCondLikes-m)))+m-log(length(y))}else{-Inf}},realY,numImportanceSamps,numMCMCIters,.99,recordEveryTh)res<-sampler(realParams)mean.cpmResults calculates the posterior mean point estimateDescriptioncalculates the posterior mean point estimateUsage##S3method for class cpmResultsmean(x,...)Argumentsx a cpmResults object...arguments to be passed to or from methods.Valuea vector of parameter estimates(posterior mean)plot.cpmResults5 plot.cpmResults plots a cpmResults objectDescriptionplots a cpmResults objectUsage##S3method for class cpmResultsplot(x,...)Argumentsx a cpmResults object...arguments to be passed to or from methods.print.cpmResults prints a cpmResults objectDescriptionprints a cpmResults objectUsage##S3method for class cpmResultsprint(x,...)Argumentsx a cpmResults object...arguments to be passed to or from methods.Valuethe same cpmResults objectIndexisBadNum,2makeCPMSampler,2mean.cpmResults,4plot.cpmResults,5print.cpmResults,56。

polylabelr包说明书

polylabelr包说明书

Package‘polylabelr’October14,2022Title Find the Pole of Inaccessibility(Visual Center)of a PolygonVersion0.2.0Description A wrapper around the C++library'polylabel'from'Mapbox',providing an efficient routine forfinding the approximate pole ofinaccessibility of a polygon,which usually serves as an excellent candidatefor labeling of a polygon.License MIT+file LICENSECopyright seefile COPYRIGHTSEncoding UTF-8LazyData trueURL https:///jolars/polylabelr,https://jolars.github.io/polylabelrBugReports https:///jolars/polylabelr/issuesDepends R(>=3.3.0)LinkingTo RcppImports RcppRoxygenNote7.1.0Suggests covr,testthat,spelling,sfLanguage en-USNeedsCompilation yesAuthor Johan Larsson[aut,cre](<https:///0000-0002-4029-5945>), Kent Johnson[ctb],Mapbox[cph](polylabel,variant,and geometry libraries)Maintainer Johan Larsson<************************>Repository CRANDate/Publication2020-04-1915:00:09UTCR topics documented:poi (2)12poiIndex4 poi Pole of Inaccessibility(Visual Center)of a PolygonDescriptionThis function computes and returns the approximate pole of inaccessibility for a polygon using aquadtree-based algorithm developed by the people from Mapbox.Usagepoi(x,y=NULL,precision=1)Argumentsx a vector of x coordinates or a matrix or data.frame of x and y coordinates,alist of components x and y,a time series(see grDevices::xy.coords()fordetails),or a simple features object from package sf.y a vector of y coordinates.Only needs to be provided if x is vector.precision the precision to use when computing the centerDetailsIf there are any NA values in the input,they will be treated as separators for multiple paths(rings)ofthe polygon,mimicking the behavior of graphics::polypath().ValueA list with itemsx x coordinate of the centery y coordinate of the centerdist distance to the enclosing polygonSourceGarcia-Castellanos&Lombardo,2007.Poles of inaccessibility:A calculation algorithm for theremotest places on earth Scottish Geographical Journal,V olume123,3,227-233.https://dx./10.1080/14702540801897809https:///mapbox/polylabelhttps:///a-new-algorithm-for-finding-a-visual-center-of-a-polygon-7c77e6492fbcSee AlsogrDevices::xy.coords(),graphics::polypath()poi3Examplesplot_path<-function(x,y,...){plot.new()plot.window(range(x,na.rm=TRUE),range(y,na.rm=TRUE))polypath(x,y,...)}x<-c(5,10,10,5,5,6,6,7,7,6,8,8,9,9,8)y<-c(5,5,10,10,5,6,7,7,6,6,8,9,9,8,8)plot_path(x,y,col="grey",border=NA)points(poi(x,y))##Not run:#Find visual centers for North Carolina countieslibrary(sf)nc<-st_read(system.file("shape/nc.shp",package="sf"))locations=do.call(rbind,poi(nc,precision=0.01))plot(st_geometry(nc))points(locations)##End(Not run)Indexgraphics::polypath(),2grDevices::xy.coords(),2poi,24。

ggpie包的介绍和描述说明书

ggpie包的介绍和描述说明书

Package‘ggpie’November16,2022Type PackageTitle Pie,Donut and Rose Pie PlotsVersion0.2.5Maintainer Yabing Song<********************>Description Create pie,donut and rose pie plot with'ggplot2'.URL https:///showteeth/ggpieLicense MIT+file LICENSEEncoding UTF-8RoxygenNote7.1.1Imports dplyr,grDevices,RColorBrewer,scales,tibble,ggnewscale,ggplot2,ggrepel,magrittr,rlang,utils,stringrSuggests rmarkdown,cowplot,prettydoc,knitrVignetteBuilder knitrNeedsCompilation noAuthor Yabing Song[aut,cre]Repository CRANDate/Publication2022-11-1607:40:06UTCR topics documented:ggdonut (2)ggnestedpie (4)ggpie (7)ggpie3D (10)ggrosepie (11)Index141ggdonut Create donut plot.DescriptionCreate donut plot.Usageggdonut(data,group_key=NULL,count_type=c("count","full"),fill_color=NULL,label_info=c("count","ratio","all"),label_split="[[:space:]]+",label_len=40,label_color="black",label_type=c("circle","horizon","none"),label_pos=c("in","out"),label_gap=0.05,label_threshold=NULL,label_size=4,border_color="black",border_size=1,r0=1,r1=3,bel=TRUE,bel.size=4,bel.color="red",nudge_x=1,nudge_y=1)Argumentsdata Data frame contains full data or summarized data.group_key Column used to summarize the data.Default:NULL.count_type Data frame type,chosen from"count"and"full"."count"means summarized data and"full"means full data.Default:count.fill_color Colors used.Default:NULL(conduct automatic selection).label_info Label information type,chosen from count,ratio and all(count and ratio).De-fault:count.label_split Pattern used to split the label,support regular expression.Default:space.label_len The length of label ed when label_split is NULL.Default:40.label_color Color of the label.Default:black.label_type Label style,chosen from circle,horizon and none(no label).Default:circle.label_pos Label position,chosen from in and out.Default:in.label_gap Gap between label and pie plot,used when label_pos is out.label_thresholdThreshold of the ratio to determine label position(in/out pie).Default:NULL.label_size Size of the label.Default:4.border_color Border color.Default:black.border_size Border thickness.Default:1.r0The radius of inner blank circle.Default:1.r1The radius of outer circle.Default:3.bel Logical value,whether to show total number in the center of the plot.Default: TRUE.bel.sizeThe label size of center label.Default:4.bel.colorThe color of center label.Default:red.nudge_x Parameter of geom_text_repel.Default:1.nudge_y Parameter of geom_text_repel.Default:1.ValueA ggplot2object.Exampleslibrary(ggpie)library(ggplot2)data(diamonds)#circle label and out of pieggdonut(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="circle",label_size=4,label_pos="out")#circle label and in pie plot,with no splitggdonut(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="circle",label_split=NULL,label_size=4,label_pos="in")#horizon label and in pie plot,with no splitggdonut(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_split=NULL,label_size=4,label_pos="in")#horizon label and in pie plotggdonut(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_size=4,label_pos="in")#horizon label and out of pie plot,with no splitggdonut(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_split=NULL, label_size=4,label_pos="out")#horizon label and out of pie plotggdonut(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_size=4,label_pos="out")#with label thresholdggdonut(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_split=NULL, label_size=4,label_pos="in",label_threshold=10)ggdonut(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_size=4,label_pos="in",label_threshold=10)ggnestedpie Create nested pie plot.DescriptionCreate nested pie plot.Usageggnestedpie(data,group_key=NULL,count_type=c("count","full"),r0=0.5,r1=1.5,r2=2.5,inner_thick=1,outer_thick=1,inner_fill_color=NULL,inner_label=TRUE,inner_label_info=c("count","ratio","all"),inner_label_color="black",inner_label_split="[[:space:]]+",inner_label_len=40,inner_label_threshold=NULL,inner_label_size=4,outer_fill_color=NULL,outer_label_type=c("circle","horizon","none"),outer_label_pos=c("in","out"),outer_label_info=c("count","ratio","all"),outer_label_split="[[:space:]]+",outer_label_len=40,outer_label_color="black",outer_label_gap=0.05,outer_label_threshold=NULL,outer_label_size=4,border_color="black",border_size=1,outer_nudge_x=1,outer_nudge_y=1)Argumentsdata Data frame contains full data or summarized data.group_key Column used to summarize the data.Default:NULL.count_type Data frame type,chosen from"count"and"full"."count"means summarized data and"full"means full data.Default:count.r0The radius of inner blank circle.Default:0.5(donut plot).When set to0,inner plot is pie.r1The radius of inner pie plot.Default:1.5.r2The radius of outer pie plot.Default:2.5.inner_thick The width of inner pie plot.Default:1.outer_thick The width of outer pie plot.Default:1.inner_fill_colorColors used for inner pie plot.Default:NULL(conduct automatic selection).inner_label Logical value,whether to show label on inner pie label.Default:TRUE.inner_label_infoLabel information type of inner pie plot,chosen from count,ratio and all(countand ratio).Default:count.inner_label_colorColor of the label on inner pie.Default:black.inner_label_splitPattern used to split the label of inner pie,support regular expression.Default:space.inner_label_lenLabel text length of inner ed when inner_label_split is NULL.De-fault:40.inner_label_thresholdThreshold of the ratio to determine label or not on inner pie.Default:NULL.inner_label_sizeSize of the label on inner pie.Default:4.outer_fill_colorColors used for outer pie plot.Default:NULL(conduct automatic selection).outer_label_typeLabel style of outer pie plot,chosen from circle,horizon and none(no label).Default:circle.outer_label_posLabel position of outer pie,chosen from in and out.Default:in.outer_label_infoLabel information type of outer pie plot,chosen from count,ratio and all(countand ratio).Default:count.outer_label_splitPattern used to split the label of outer pie,support regular expression.Default:space.outer_label_lenLabel text length of outer ed when outer_label_split is NULL.De-fault:40.outer_label_colorColor of the label on outer pie.Default:black.outer_label_gapGap between label and outer pie plot,used when outer_label_pos is out.outer_label_thresholdThreshold of the ratio to determine label position(in/out pie).Default:NULL.outer_label_sizeSize of the label on outer pie.Default:4.border_color Border color.Default:black.border_size Border thickness.Default:1.outer_nudge_x Parameter of geom_text_repel.Default:1.outer_nudge_y Parameter of geom_text_repel.Default:1.ValueA ggplot2object.Exampleslibrary(ggpie)library(ggplot2)data(diamonds)#inner circle label,outer circle label and in pie plotggnestedpie(data=diamonds,group_key=c("cut","color"),count_type="full",inner_label_info="all",inner_label_split=NULL,outer_label_type="circle",outer_label_pos="in",outer_label_info="all")#inner circle label,outer circle label and in pie plot,remove fraction below1of inner pie ggnestedpie(data=diamonds,group_key=c("cut","color"),count_type="full",inner_label_info="all",inner_label_split=NULL,inner_label_threshold=1,inner_label_size=3,outer_label_type="circle",outer_label_pos="in",outer_label_info="all")#inner circle label,outer circle label and out of pie plotggnestedpie(data=diamonds,group_key=c("cut","color"),count_type="full",inner_label_info="all",inner_label_split=NULL,outer_label_type="circle",outer_label_pos="out",outer_label_info="all")#inner circle label and no split,outer horizon label and out of pie plot,#remove fraction below1of inner pieggnestedpie(data=diamonds,group_key=c("cut","color"),count_type="full",inner_label_info="all",inner_label_split=NULL,inner_label_threshold=1,inner_label_size=3,outer_label_type="horizon",outer_label_pos="out",outer_label_info="all")#inner circle label and no split,outer horizon label and in pie plot,#remove fraction below1of inner pie,#adjust fraction below10to out of pie of outer pie plot.ggnestedpie(data=diamonds,group_key=c("cut","color"),count_type="full",inner_label_info="all",inner_label_split=NULL,inner_label_threshold=1,inner_label_size=3,outer_label_type="horizon",outer_label_pos="in",outer_label_info="all",outer_label_threshold=10)#create blank between inner and outer pieggnestedpie(data=diamonds,group_key=c("cut","color"),count_type="full",r0=0.5,r1=1.5,r2=2.6, inner_label_info="all",inner_label_split=NULL,inner_label_threshold=1,inner_label_size=3,outer_label_type="horizon",outer_label_pos="in",outer_label_info="all",outer_label_threshold=10)ggpie Create Pie plot.DescriptionCreate Pie plot.Usageggpie(data,group_key=NULL,count_type=c("count","full"),fill_color=NULL,label_info=c("count","ratio","all"),label_split="[[:space:]]+",label_len=40,label_color="black",label_type=c("circle","horizon","none"),label_pos=c("in","out"),label_gap=0.05,label_threshold=NULL,label_size=4,border_color="black",border_size=1,nudge_x=1,nudge_y=1)Argumentsdata Data frame contains full data or summarized data.group_key Column used to summarize the data.Default:NULL.count_type Data frame type,chosen from"count"and"full"."count"means summarized data and"full"means full data.Default:count.fill_color Colors used.Default:NULL(conduct automatic selection).label_info Label information type,chosen from count,ratio and all(count and ratio).De-fault:count.label_split Pattern used to split the label,support regular expression.Default:space.label_len The length of label ed when label_split is NULL.Default:40.label_color Color of the label.Default:black.label_type Label style,chosen from circle,horizon and none(no label).Default:circle.label_pos Label position,chosen from in and out.Default:in.label_gap Gap between label and pie plot,used when label_pos is out.label_thresholdThreshold of the ratio to determine label position(in/out pie).Default:NULL.label_size Size of the label.Default:4.border_color Border color.Default:black.border_size Border thickness.Default:1.nudge_x Parameter of geom_text_repel.Default:1.nudge_y Parameter of geom_text_repel.Default:1.ValueA ggplot2object.Exampleslibrary(ggpie)library(ggplot2)data(diamonds)#with no labelggpie(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="none")#circle label and out of pieggpie(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="circle",label_size=4,label_pos="out")#circle label and in pie plot,with no splitggpie(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="circle",label_split=NULL,label_size=4,label_pos="in")#horizon label and in pie plot,with no splitggpie(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_split=NULL, label_size=4,label_pos="in")#horizon label and in pie plot,split with spaceggpie(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_size=4,label_pos="in")#horizon label and out pie plot,with no splitggpie(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_split=NULL, label_size=4,label_pos="out")#with label thresholdggpie(data=diamonds,group_key="cut",count_type="full",label_info="all",label_type="horizon",label_split=NULL, label_size=4,label_pos="in",label_threshold=10)ggpie3D Create3D pie plot.DescriptionCreate3D pie plot.Usageggpie3D(data,group_key=NULL,count_type=c("count","full"),fill_color=NULL,start_degrees=0,tilt_degrees=-20,height=0.1,darken=0.15,camera_eye=c(0,3,5),camera_look_at=c(0,0,0),show_label=TRUE,label_info=c("count","ratio","all"),label_split="[[:space:]]+",label_len=40,label_size=4)Argumentsdata Data frame contains full data or summarized data.group_key Column used to summarize the data.Default:NULL.count_type Data frame type,chosen from"count"and"full"."count"means summarized data and"full"means full data.Default:count.fill_color Colors used.Default:NULL(conduct automatic selection).start_degrees starting angle forfirst pie slice(in degrees).Default:0.tilt_degrees angle by which to tilt the pie towards the camera(in degrees).Default:0.height height of the pie.Default:0.1.darken Shadow degree.Default:0.15.camera_eye location of camera eye.Default:c(0,3,5).camera_look_at at what point is the camera looking.Default:c(0,0,0).show_label Logical value,whether to show label or not.Default:TRUE.label_info Label information type,chosen from count,ratio and all(count and ratio).De-fault:count.label_split Pattern used to split the label,support regular expression.Default:space.label_len The length of label ed when label_split is NULL.Default:40.label_size Size of the label.Default:4.ValueA ggplot2object.Exampleslibrary(ggpie)library(ggplot2)data(diamonds)ggpie3D(data=diamonds,group_key="cut",count_type="full",tilt_degrees=-10) ggpie3D(data=mtcars,group_key="cyl",count_type="full",tilt_degrees=-10,start_degrees=0)data<-data.frame(group=letters[1:5],count=c(1,2,3,1,1),stringsAsFactors=FALSE) ggpie3D(data=data,start_degrees=0,label_split=NULL)ggrosepie Create rose pie plot.DescriptionCreate rose pie plot.Usageggrosepie(data,group_key=NULL,count_type=c("count","full"),fill_color=NULL,label_info=c("count","ratio","all"),label_split=NULL,label_len=40,label_color="black",sort=TRUE,show_tick=TRUE,tick_break=NULL,show_label=TRUE,label_sep="|",label_gap=0.05,label_size=4,donut_frac=0.1,donut_label=TRUE,donut_label_size=4,donut_label_color="red",border_color="black",border_size=1)Argumentsdata Data frame contains full data or summarized data.group_key Column used to summarize the data,one or two are acceptable.Default:NULL.count_type Data frame type,chosen from"count"and"full"."count"means summarized data and"full"means full data.Default:count.fill_color Colors used.When length of group_key is two,color the subgroup,otherwise the main group.Default:NULL(conduct automatic selection).label_info Label information type,chosen from count,ratio and all(count and ratio).De-fault:count.label_split Pattern used to split the label,support regular expression.Default:NULL.label_len The length of label ed when label_split is NULL.Default:40.label_color Color of the label.When length of group_key is two,this should be set to one color.Default:black.sort Logical value,whether to order the plot by counts.Default:TRUE.show_tick Logical value,whether to show the tick.Default:TRUE.tick_break The break of tick.Default:NULL(conduct automatic selection).show_label Logical value,whether to show the label.Default:TRUE.label_sep The separator between group and count info.Default:|.label_gap The gap between label and plot.Default:0.05(count+0.05*count).label_size The size of label.Default:4.donut_frac The fraction of donut.Default:0.1(0.1*max(count)).donut_label Logical value,whether to show total number in the center of the plot.Default: TRUE.donut_label_sizeThe label size of center label.Default:4.donut_label_colorThe color of center label.Default:red.border_color Border color.Default:black.border_size Border thickness.Default:1.ValueA ggplot2object.Exampleslibrary(ggpie)library(ggplot2)data(diamonds)#do not show tickggrosepie(diamonds,group_key="color",count_type="full",label_info="all",show_tick=FALSE,donut_frac=0.3,donut_label_size=3)#show tick and with automatic selectionggrosepie(diamonds,group_key="color",count_type="full",label_info="all",donut_frac=0.3,donut_label_size=3)#show tick and with specific breakggrosepie(diamonds,group_key="color",count_type="full",label_info="all",tick_break=c(3000,5000,7000,11000),donut_frac=0.3,donut_label_size=3 )#two group variable,and do not show tickggrosepie(diamonds,group_key=c("color","clarity"),count_type="full",label_info="all",show_tick=FALSE,donut_frac=0.3,donut_label_size=3)#two group variable,show tick and with automatic selectionggrosepie(diamonds,group_key=c("color","clarity"),count_type="full",label_info="all",donut_frac=0.3,donut_label_size=3)#two group variable,show tick and with specific breakggrosepie(diamonds,group_key=c("color","clarity"),count_type="full",label_info="all",tick_break=c(3000,5000,7000,11000),donut_frac=0.3,donut_label_size=3 )Indexgeom_text_repel,3,6,8ggdonut,2ggnestedpie,4ggpie,7ggpie3D,10ggrosepie,1114。

nlopt python用法

nlopt python用法

nlopt python用法NLopt是一个用于非线性优化问题的开源库,它提供了多种优化算法和接口,可以在Python中进行使用。

在本文中,我们将一步一步回答关于NLopt Python用法的问题,帮助您理解如何使用NLopt库解决各种优化问题。

1. 什么是NLopt?NLopt是一个免费的开源库,用于解决非线性优化问题。

它提供了多种优化算法,适用于各种约束和目标函数。

NLopt库支持C语言和Python等多种编程语言,并具有易于使用的接口。

2. 如何安装NLopt?首先,确保您已经安装了Python和pip工具。

然后,在命令行中运行以下命令来安装NLopt库:bashpip install nlopt这将自动下载和安装NLopt库及其依赖项。

3. 如何导入NLopt?在Python脚本的开头,使用以下代码导入NLopt库:pythonimport nlopt4. 如何定义目标函数和约束条件?在NLopt中,目标函数和约束条件是指用户定义的函数。

目标函数是需要最小化或最大化的函数,而约束条件是问题的限制条件。

目标函数应该接受一个向量x作为输入,并返回一个标量值作为输出。

约束条件函数也应该接受向量x作为输入,但返回一个值,指示该点是否满足约束条件。

下面是一个例子,展示如何定义一个目标函数和一个约束条件函数:pythondef objective(x, grad):# 计算目标函数值return f(x)def constraint(x, grad):# 计算约束条件值return g(x)在这个例子中,我们假设f(x)是目标函数,g(x)是约束条件函数。

5. 如何选择优化算法?NLopt库提供了多种优化算法,您可以根据具体的问题和要求选择合适的算法。

以下是一些常用的优化算法:- 全局优化算法:GN_ISRES、GN_ESCH、GN_DIRECT、GN_DIRECT_L、GN_CRS2_LM- 局部优化算法:LN_SBPLX、LN_BOBYQA、LN_COBYLA、LN_NELDERMEAD、LN_PRAXIS要选择算法,可以使用`nlopt.algorithm_name`函数,并传递算法的名称作为参数。

pulp 用例 -回复

pulp 用例 -回复

pulp 用例-回复Pulp 用例在计算机科学和信息技术领域,"pulp",即"Python Linear Programming",是一个用于线性规划问题的开源库。

它是用Python语言编写的,旨在为用户提供一个灵活而高效的工具,以解决各种规模的线性规划问题。

本文将逐步介绍pulp的主要功能、用法和实际应用例子,以帮助读者更好地理解和运用pulp。

一、Pulp 的安装和配置首先,我们需要通过pip来安装pulp库。

打开终端(或命令提示符)并输入以下命令:pip install pulp安装完成后,我们可以通过导入pulp模块来使用它。

下面是一个简单的示例:pythonimport pulp这样,我们就成功地安装并配置好了pulp库,可以开始使用它来解决线性规划问题了。

二、Pulp 的基本用法Pulp提供了一种简洁而直观的方式来定义和解决线性规划问题。

其中,包含了线性目标函数、约束条件和变量的定义,以及对其求解并获取结果的过程。

1. 定义问题首先,我们需要创建一个问题对象,并指定是最大化还是最小化模型。

例如,我们创建一个最大化模型的示例:pythonmodel = pulp.LpProblem("Example", pulp.LpMaximize)2. 定义变量接下来,我们需要定义所需的变量。

可以使用LpVariable类来创建一个新的变量,并指定其名称、最小值和最大值。

例如,我们创建一个名为x 的变量,并将其范围限制在0到5之间:pythonx = pulp.LpVariable("x", lowBound=0, upBound=5)我们还可以指定变量的类型,例如整数或二进制。

下面是一个创建二进制变量的示例:pythony = pulp.LpVariable("y", cat=pulp.LpBinary)3. 添加目标函数接下来,我们可以使用LpAffineExpression类来创建目标函数。

Panel 2020 电板计算软件用户手册说明书

Panel 2020 电板计算软件用户手册说明书

Panel 2020LoadCalculation Software User’s Manual ArrayCopyright 2019Durand & AssociatesPANEL 2020COPYRIGHT 2019 - DURAND & ASSOCIATESThis software and manual are protected by Federal Copyright Laws and may not be copied or duplicated for the purpose of resale or distribution. A registered user may copy the template files for their own personal use provided they retain sole possession of such copies.The Panel 2020 Panel 2020Panel 2020 software is a spreadsheet template software program for calculating panel loads,transformer sizes, sub panels, and feeder sizes. This program may be used for industrial andcommercial loads. The Panel 2020 Panel 2020 Panel 2020 software is for reference purposes only, and Durand & Associatescannot assume any responsibility for the accuracy of the programs content. In using this program the user agrees to hold harmless and wave all claims against Durand & Associates.SOFTWARE REQUIREMENTSPanel 2020 was created with Microsoft Excel 97. To use these templates you must have Microsoft Excel, Version 97 or later installed on your computer.INTRODUCTIONThe Panel 2020 Panel 2020Panel 2020 software is a spreadsheet template program. The program was designed for use in conjunction with Microsoft Excel on the Windows platform. The program should also work on other platforms that can read and write Microsoft Excel 97 file formats.LOADING THE PROGRAM Insert the CD in your drive and follow the setup instructions.The installation of Panel 2020 will create the following folder on your C drive.C:\Panel 2020LOCATING THE PROGRAM FILESThe Panel templates are located on your C: drive.If you double click on the Panel folder, you will find one (1) file.Panel 2020 Folder Panel 2020 File Excel 2003 or EarlierDouble click on thePanel Manual toprint the instructionsPanel 2020 File Excel 2007 or Later.USING THE PROGRAMGo to your START MENU, select ALL PROGRAMS, and select EXCEL.Select ExcelThis will start your Excel spreadsheet program.Select the FILE OPEN command and locate the Panel 2020 folder on your C: drive.Double click the Panel 2020 folder to display the contents. Array Double click on the Panel 2020 icon to open the template file.After the template file is open, use the SAVE-AS command to rename the file.Enter new file name and click SAVE.The template has thirteen (13) tabs.The first six tabs are for the Panel and the second five tabs are for the Sub Panel. Each tab has a special purpose:Panel T absInput - This sheet is used to enter information.Schedule - This sheet is used to review and print the panel schedule.Calcs - This sheet is used to review and print the load calculations.1-Line - This sheet is used to review and print the 1-Line drawing.Directory - This sheet is used to review and print the circuit directory.Errors - This sheet is used to review and print the errors.Sub PanelSub Panel T T absS-Input - This sheet is used to enter information.S-Schedule - This sheet is used to review and print the subpanel schedule.S-Calcs - This sheet is used to review and print the subpanel load calculations.S-Directory - This sheet is used to review and print the subpanel circuit directory.S-Errors - This sheet is used to review and print the subpanel errors.Misc T absCopy/Paste - This sheet explains the Pate Values command for Excel.CAD - This sheet explains how to use the Copy Picture command andpaste into a CAD program.GENERAL ENTRIESSome cells in the template files are protected. You may only enter information intocertain cells. If you are using a color monitor, these cells are yellow or lime green.Each unprotected yellow cell requires a user entry. If an invalid entry is made, a RED error message will appear to the left of the entry or an error message will appear in a pop up box.Yellow CellsWhen you select a cella hint box will appear.You may also usethe pulldown menu.Enter the panel name such as LPA. If entry is too long it may be cut off when printed. (As a general rule 22 characters are allowed.)Enter the power source for this panel.Enter number of circuits. (Even number from 6 to 84) or use the pulldown menu.Enter line to line voltage.Enter line to neutral voltage Enter phase. Note: You may put a 1-Phase panel on a 3-Phase source.Select Auto or Full. (3-Phase Delta Only)Select Auto, Full or Minimum Most of the time you will select Full and the neu-tral conductor will be sized the same as the line conductor. If you select Auto, the neutral will be sized per NEC requirements. If you select Mini-mum, you must identify each line to neutral circuit with a (N) on the panel schedule.You may enter zero and the program will calcu-late the proper wire size. You may also enter a minimum value and the program will use the minimum value. If the minimum value is less than the neutral load, the program will size the neutral to handle the neutral load. The program will size the neutral to carry at least 34 percent of the line conductors per NEC requirements.Enter Y or N. If you enter Y , an equipment ground conductor will be added to the feeder conduit(s).Select the wire type.Enter CU or AL.PANEL# OF CIRCUITSHI VOLTAGEPHASEFED FROMLOW VOLTAGENEUTRAL SIZEMIN NET AMPSHI-LEG SIZEGND WIRE Y/NWIRE TYPEWIRE CU/AL?Enter the wire insulation temperature.Enter wire length.Select conduit type.Enter minimum amps. If the load exceeds the minimum amps, the program will automatically size the wire for Code requirements.Enter minimum amps for hi-leg (L2). If the load exceeds the minimum amps, the program will automatically size the wire per Code.Enter the number of kitchen loads.Enter percentage factor. Example: If you enter 20,the program will provide 20% spare capacity for future loads. You may also use this factor to adjust for voltage drop.Enter percentage factor for hi-leg (L2). Example:If you enter 20, the program will provide 20%spare capacity for future loads. You may also use this factor to adjust for voltage drop.Enter Y or N. If you enter Y , the program will size the main breaker. If this is a 3-phase delta panel with a reduced size hi-leg (L2), the program will size overcurrent protection using fuses.Select MANUAL if you want to calculate the fault current. Select NONE if you do not wish to have fault current calculations.Enter the Available Fault Current (AFC)Select 1.0 or 1.1WIRE TEMPWIRE LENGTHCONDUIT TYPEMINIMUM AMPSMINIMUM AMPS (L2)KITCHEN LOADS% FACTOR% FACTOR (L2)MAIN BKR / FUSEAFC METHODAFC START POINTUTILITY ADJUSTSelect choice from pulldown menu. If you want a sub panel fed from this panel, select 1-Phase or 3-Phase.If you have a subpanel, select the breaker position from the pulldown menu.Select the Code year from the pulldown menu.Select yes or no from the pulldown menu. If you select yes the fault current calculations will appear on the Cacl’s page.Select yes or no from the pulldown menu. If you select yes, the voltage drop calculations will appear on the Cacl’s page.Select “CT & METER”, “METER”, “NO METER”Select “OVERHEAR” or ‘UNDERGROUND”Select “YES”, or “NO”SUB PANEL BKRBREAKER POSITIONCODE YEARDISPLAY FAULT CURRENTDISPLAY VOLTAGE DROPMETER AND OR CTUNDERGROUNDOR OVERHEADUFER GROUNDYou may enter any information in the green cellsand it will appear on the panel schedule.DISPLAY ONLY Also, in the general information section there are a group of cells displaying wire and conduit size information. These cells only display information when no errors are present in the tem-plate.CIRCUIT ENTRIESOnce you have completed the general entries, you may begin making the circuit entries.Each circuit entry consists of the following:BREAKER CIRCUIT DESCRIPTIONEnter breaker type.Enter circuit description.3-PHASE DELTA CIRCUITSIf you are entering 1-phase (line to neutral loads) on a 3-phase delta panel, do not putthem in the orange cells.LOAD IDENTIFIERSH (HARMONIC LOAD)On 3-phase wye panels loads subject to harmonic currents (such as electronic ballast and computer equipment) must be identified by placing an “H” in the harmonic identifier column.HOW THE PROGRAM CALCULATES HARMONIC LOADS.When the harmonic load is 50% or more of the load ( on 3-phase wye panels) the NEC re-quires the neutral conductor to be considered a current carrying conductor.Therefore, the feeder conduit has four (4) current carrying conductors and the conductor ampacity must be derated to 80%. The program does this automatically.No 1-phase (line to neutral) loads.Hi-Leg (L2)Enter “H” or a space (Space Bar)NEUTRAL LOADS If you have selected MINIMUM for neutral sizing, the program will calculate the neutral load and size the neutral separate from the line conductors. This is known as reduced neutral sizing.For this to work properly you need to identify each line to neutral load in the panel.HOW THE PROGRAM CALCULATES NEUTRAL CONDUCTOR SIZE In the auto sizing mode the largest line to neutral load is the ampacity used. The neutral con-ductor is sized on that load or 34% of line conductor ampacity per Code requirements.CIRCUIT LOAD IDENTIFIERSThere are several ways to identify loads. Listed below are the options.G - General LoadD - Receptacle Load (Diversity)C - Continuous LoadK - Kitchen LoadM - Motor LoadEnter “N” or a space (Space Bar)Enter ( G, C, D, K, or M )ENTERING CIRCUIT LOADSLINE TO NEUTRAL LOADS (1-Pole Breaker)Enter the VA (Volts X Amps) into the cell.LINE TO LINE LOADS (2-Pole Breaker)Enter one half of the VA in each cell.Example:(50 Amps X 240 Volts) = 12,000 VA(12,000 VA ÷ 2) = 6,000 VA in each cellLINE TO LINE LOADS (3-Pole Breaker)Enter one third of the VA in each cell.Example:(40 Amps X 208 Volts X 1.732) = 14,410 VA (14,410 VA ÷ 3 ) = 4,803 VA in each cellSUB PANEL GENERAL ENTRIESSelect Choice If you select a transformer, you can select the KVA rating or select AUTO and the program will size the transformer automatically.If you are using a transformer, a voltage drop adjustment appears. Use this rather than % Factor to adjust for voltage drop.If you are using a transformer, a transformer% Z rating appears. Enter the % Z rating of thetransformer.FED FROM P1KVAVD ADJUSTMENT XMFR % Z RATINGPRINTOUTS Each panel schedule template is designed to print out four (4) sheets for the panel and four (4) sheets for the sub panel.- Panel Schedule- Load Calculation- Directory - Error Checking Report Using the mouse, click on the tab to display the sheet you wish toprint. When the sheet is displayed, use the FILE/PRINT command.NO COPY/PASTEDo not use the COPY Do not use the COPY and P and P and PASTE commands on this template asASTE commands on this template as they can corrupt the file.Each cell in this template has been formatted with error checking and performance codes.When you copy a cell and use the paste command, these formats and performance codes are pasted to the new location.PASTE SPECIAL (Values Only)To avoid corrupting the file use the COPY and the EDIT/PASTE SPECIAL command selecting VALUES from the paste special menu.Click on “Values”and click OK。

python pegen 例子

python pegen 例子

python pegen 例子标题:Python PEGEN例子1. Python PEGEN简介Python PEGEN是一个用于生成解析器的Python库。

它可以根据用户定义的语法规则生成解析器代码,用于解析和处理特定格式的文本数据。

这样的解析器可以用于构建编译器、解释器、数据处理工具等应用。

2. 如何安装Python PEGEN安装Python PEGEN非常简单,只需使用pip命令即可。

在命令行中运行以下命令:pip install pegen3. Python PEGEN的基本语法Python PEGEN使用类似正则表达式的语法来定义语法规则。

用户可以定义终结符和非终结符,并使用操作符(如*、+、|等)来组合规则。

下面是一个简单的例子:expr = term ('+' term)*term = number | '(' expr ')'number = digit+4. 解析简单算术表达式下面是一个使用Python PEGEN解析简单算术表达式的例子:from pegen import Parserclass ArithmeticParser(Parser):expr = term ('+' term)*term = number | '(' expr ')'number = digit+parser = ArithmeticParser()result = parser.parse("1 + 2 * (3 + 4)")print(result) # 输出: 155. 解析自定义语言Python PEGEN不仅可以用于解析算术表达式,还可以用于解析自定义的语言。

下面是一个解析简单函数调用的例子:from pegen import Parserclass FunctionCallParser(Parser):expr = func_callfunc_call = identifier '(' arg_list? ')'arg_list = expr (',' expr)*identifier = letter (letter | digit)*letter = 'a' | 'b' | ... | 'z' | 'A' | 'B' | ... | 'Z'digit = '0' | '1' | ... | '9'parser = FunctionCallParser()result = parser.parse("print(a, b, c)")print(result) # 输出: ['print', 'a', 'b', 'c']6. 错误处理Python PEGEN提供了灵活的错误处理机制,可以捕获语法错误并提供有意义的错误提示。

clustree软件包用户指南说明书

clustree软件包用户指南说明书

Package‘clustree’November5,2023Type PackageTitle Visualise Clusterings at Different ResolutionsVersion0.5.1Date2023-11-05Maintainer Luke Zappia<***************.au>Description Deciding what resolution to use can be a difficult question when approaching a clustering analysis.One way to approach this problem is tolook at how samples move as the number of clusters increases.This package allows you to produce clustering trees,a visualisation for interrogatingclusterings as resolution increases.License GPL-3Encoding UTF-8LazyData trueURL https:///lazappi/clustree,https://lazappi.github.io/clustree/BugReports https:///lazappi/clustree/issues VignetteBuilder knitrDepends R(>=3.5),ggraphImports checkmate,igraph,dplyr,grid,ggplot2(>=3.4.0),viridis,methods,rlang,tidygraph,ggrepelSuggests testthat(>=2.1.0),knitr,rmarkdown,SingleCellExperiment, Seurat(>=2.3.0),covr,SummarizedExperiment,pkgdown,spellingRoxygenNote7.2.3Language en-GBNeedsCompilation noAuthor Luke Zappia[aut,cre](<https:///0000-0001-7744-8565>), Alicia Oshlack[aut](<https:///0000-0001-9788-5690>),Andrea Rau[ctb],Paul Hoffman[ctb](<https:///0000-0002-7693-8957>)1Repository CRANDate/Publication2023-11-0519:10:02UTCR topics documented:clustree-package (2)clustree (2)clustree_overlay (6)nba_clusts (10)sc_example (10)Index12 clustree-package ClustreeDescriptionDeciding what resolution to use can be a difficult question when approaching a clustering analy-sis.One way to approach this problem is to look at how samples move as the number of clusters increases.This package allows you to produce clustering trees,a visualisation for interrogating clusterings as resolution increases.clustree Plot a clustering treeDescriptionCreates a plot of a clustering tree showing the relationship between clusterings at different resolu-tions.Usageclustree(x,...)##S3method for class matrixclustree(x,prefix,suffix=NULL,metadata=NULL,count_filter=0,prop_filter=0.1,layout=c("tree","sugiyama"),use_core_edges=TRUE,highlight_core=FALSE,node_colour=prefix,node_colour_aggr=NULL,node_size="size",node_size_aggr=NULL,node_size_range=c(4,15),node_alpha=1,node_alpha_aggr=NULL,node_text_size=3,scale_node_text=FALSE,node_text_colour="black",node_text_angle=0,node_label=NULL,node_label_aggr=NULL,node_label_size=3,node_label_nudge=-0.2,edge_width=1.5,edge_arrow=TRUE,edge_arrow_ends=c("last","first","both"),show_axis=FALSE,return=c("plot","graph","layout"),...)##S3method for class data.frameclustree(x,prefix,...)##S3method for class SingleCellExperimentclustree(x,prefix,exprs="counts",...)##S3method for class seuratclustree(x,prefix="res.",exprs=c("data","raw.data","scale.data"),...)##S3method for class Seuratclustree(x,prefix=paste0(assay,"_snn_res."),exprs=c("data","counts","scale.data"),assay=NULL,...)Argumentsx object containing clustering data...extra parameters passed to other methodsprefix string indicating columns containing clustering informationsuffix string at the end of column names containing clustering informationmetadata data.frame containing metadata on each sample that can be used as node aes-theticscount_filter count threshold forfiltering edges in the clustering graphprop_filter in proportion threshold forfiltering edges in the clustering graphlayout string specifying the"tree"or"sugiyama"layout,see igraph::layout_as_tree() and igraph::layout_with_sugiyama()for detailsuse_core_edges logical,whether to only use core tree(edges with maximum in proportion fora node)when creating the graph layout,all(unfiltered)edges will still be dis-playedhighlight_core logical,whether to increase the edge width of the core network to make it easier to seenode_colour either a value indicating a colour to use for all nodes or the name of a metadata column to colour nodes bynode_colour_aggrif node_colour is a column name than a string giving the name of a function toaggregate that column for samples in each clusternode_size either a numeric value giving the size of all nodes or the name of a metadata column to use for node sizesnode_size_aggr if node_size is a column name than a string giving the name of a function to aggregate that column for samples in each clusternode_size_rangenumeric vector of length two giving the maximum and minimum point size forplotting nodesnode_alpha either a numeric value giving the alpha of all nodes or the name of a metadata column to use for node transparencynode_alpha_aggrif node_aggr is a column name than a string giving the name of a function toaggregate that column for samples in each clusternode_text_size numeric value giving the size of node text if scale_node_text is FALSEscale_node_textlogical indicating whether to scale node text along with the node sizenode_text_colourcolour value for node text(and label)node_text_anglethe rotation of the node textnode_label additional label to add to nodesnode_label_aggrif node_label is a column name than a string giving the name of a function toaggregate that column for samples in each clusternode_label_sizenumeric value giving the size of node label textnode_label_nudgenumeric value giving nudge in y direction for node labelsedge_width numeric value giving the width of plotted edgesedge_arrow logical indicating whether to add an arrow to edgesedge_arrow_endsstring indicating which ends of the line to draw arrow heads if edge_arrow isTRUE,one of"last","first",or"both"show_axis whether to show resolution axisreturn string specifying what to return,either"plot"(a ggplot object),"graph"(atbl_graph object)or"layout"(a ggraph layout object)exprs source of gene expression information to use as node aesthetics,for SingleCellExperiment objects it must be a name in assayNames(x),for a seurat object it must be oneof data,raw.data or scale.data and for a Seurat object it must be one ofdata,counts or scale.dataassay name of assay to pull expression and clustering data from for Seurat objectsDetailsData sourcesPlotting a clustering tree requires information about which cluster each sample has been assigned toat different resolutions.This information can be supplied in various forms,as a matrix,data.frameor more specialised object.In all cases the object provided must contain numeric columns with thenaming structure PXS where P is a prefix indicating that the column contains clustering information,X is a numeric value indicating the clustering resolution and S is any additional suffix to be removed.For SingleCellExperiment objects this information must be in the colData slot and for Seuratobjects it must be in the meta.data slot.For all objects except matrices any additional columns canbe used as aesthetics,for matrices an additional metadata data.frame can be supplied if required.FilteringEdges in the graph can befiltered by adjusting the count_filter and prop_filter parameters.The count_filter removes any edges that represent less than that number of samples,while theprop_filter removes edges that represent less than that proportion of cells in the node it pointstowards.Node aestheticsThe aesthetics of the plotted nodes can be controlled in various ways.By default the colour in-dicates the clustering resolution,the size indicates the number of samples in that cluster and thetransparency is set to100%.Each of these can be set to a specific value or linked to a suppliedmetadata column.For a SingleCellExperiment or Seurat object the names of genes can also beused.If a metadata column is used than an aggregation function must also be supplied to combinethe samples in each cluster.This function must take a vector of values and return a single value.LayoutThe clustering tree can be displayed using either the Reingold-Tilford tree layout algorithm orthe Sugiyama layout algorithm for layered directed acyclic graphs.These layouts were selectedas the are the algorithms available in the igraph package designed for trees.The Reingold-Tilford algorithm places children below their parents while the Sugiyama places nodes in layerswhile trying to minimise the number of crossing edges.See igraph::layout_as_tree()andigraph::layout_with_sugiyama()for more details.When use_core_edges is TRUE(default)only the core tree of the maximum in proportion edges for each node are used for constructing thelayout.This can often lead to more attractive layouts where the core tree is more visible.Valuea ggplot object(default),a tbl_graph object or a ggraph layout object depending on the value ofreturnExamplesdata(nba_clusts)clustree(nba_clusts,prefix="K")clustree_overlay Overlay a clustering treeDescriptionCreates a plot of a clustering tree overlaid on a scatter plot of individual samples.Usageclustree_overlay(x,...)##S3method for class matrixclustree_overlay(x,prefix,metadata,x_value,y_value,suffix=NULL,count_filter=0,prop_filter=0.1,node_colour=prefix,node_colour_aggr=NULL,node_size="size",node_size_aggr=NULL,node_size_range=c(4,15),node_alpha=1,node_alpha_aggr=NULL,edge_width=1,use_colour=c("edges","points"),alt_colour="black",point_size=3,point_alpha=0.2,point_shape=18,label_nodes=FALSE,label_size=3,plot_sides=FALSE,side_point_jitter=0.45,side_point_offset=1,...)##S3method for class data.frameclustree_overlay(x,prefix,...)##S3method for class SingleCellExperimentclustree_overlay(x,prefix,x_value,y_value,exprs="counts",red_dim=NULL,...)##S3method for class seuratclustree_overlay(x,x_value,y_value,prefix="res.",exprs=c("data","raw.data","scale.data"),red_dim=NULL,...)##S3method for class Seuratclustree_overlay(x,x_value,y_value,prefix=paste0(assay,"_snn_res."),exprs=c("data","counts","scale.data"),red_dim=NULL,assay=NULL,...)Argumentsx object containing clustering data...extra parameters passed to other methodsprefix string indicating columns containing clustering informationmetadata data.frame containing metadata on each sample that can be used as node aes-theticsx_value numeric metadata column to use as the x axisy_value numeric metadata column to use as the y axissuffix string at the end of column names containing clustering informationcount_filter count threshold forfiltering edges in the clustering graphprop_filter in proportion threshold forfiltering edges in the clustering graphnode_colour either a value indicating a colour to use for all nodes or the name of a metadatacolumn to colour nodes bynode_colour_aggrif node_colour is a column name than a string giving the name of a function toaggregate that column for samples in each clusternode_size either a numeric value giving the size of all nodes or the name of a metadatacolumn to use for node sizesnode_size_aggr if node_size is a column name than a string giving the name of a function toaggregate that column for samples in each clusternode_size_rangenumeric vector of length two giving the maximum and minimum point size forplotting nodesnode_alpha either a numeric value giving the alpha of all nodes or the name of a metadatacolumn to use for node transparencynode_alpha_aggrif node_aggr is a column name than a string giving the name of a function toaggregate that column for samples in each clusteredge_width numeric value giving the width of plotted edgesuse_colour one of"edges"or"points"specifying which element to apply the colour aes-thetic toalt_colour colour value to be used for edges or points(whichever is NOT given by use_colour)point_size numeric value giving the size of sample pointspoint_alpha numeric value giving the alpha of sample pointspoint_shape numeric value giving the shape of sample pointslabel_nodes logical value indicating whether to add labels to clustering graph nodeslabel_size numeric value giving the size of node labels is label_nodes is TRUEplot_sides logical value indicating whether to produce side on plotsside_point_jitternumeric value giving the y-direction spread of points in side plotsside_point_offsetnumeric value giving the y-direction offset for points in side plotsexprs source of gene expression information to use as node aesthetics,for SingleCellExperiment objects it must be a name in assayNames(x),for a seurat object it must be oneof data,raw.data or scale.data and for a Seurat object it must be one ofdata,counts or scale.datared_dim dimensionality reduction to use as a source for x_value and y_valueassay name of assay to pull expression and clustering data from for Seurat objectsDetailsData sourcesPlotting a clustering tree requires information about which cluster each sample has been assigned to at different resolutions.This information can be supplied in various forms,as a matrix,data.frame or more specialised object.In all cases the object provided must contain numeric columns with the naming structure PXS where P is a prefix indicating that the column contains clustering information, X is a numeric value indicating the clustering resolution and S is any additional suffix to be removed.For SingleCellExperiment objects this information must be in the colData slot and for Seurat objects it must be in the meta.data slot.For all objects except matrices any additional columns can be used as aesthetics.FilteringEdges in the graph can befiltered by adjusting the count_filter and prop_filter parameters.The count_filter removes any edges that represent less than that number of samples,while the prop_filter removes edges that represent less than that proportion of cells in the node it points towards.Node aestheticsThe aesthetics of the plotted nodes can be controlled in various ways.By default the colour in-dicates the clustering resolution,the size indicates the number of samples in that cluster and the transparency is set to100%.Each of these can be set to a specific value or linked to a supplied metadata column.For a SingleCellExperiment or Seurat object the names of genes can also be used.If a metadata column is used than an aggregation function must also be supplied to combine the samples in each cluster.This function must take a vector of values and return a single value.Colour aestheticThe colour aesthetic can be applied to either edges or sample points by setting use_colour.If "edges"is selected edges will be coloured according to the clustering resolution they originate at.If "points"is selected they will be coloured according to the cluster they are assigned to at the highest resolution.Dimensionality reductionsFor SingleCellExperiment and Seurat objects precomputed dimensionality reductions can be used for x or y aesthetics.To do so red_dim must be set to the name of a dimensionality reduction in reducedDimNames(x)(for a SingleCellExperiment)or x@dr(for a Seurat object).x_value and y_value can then be set to red_dimX when red_dim matches the red_dim argument and X is the column of the dimensionality reduction to use.Valuea ggplot object if plot_sides is FALSE or a list of ggplot objects if plot_sides is TRUEExamplesdata(nba_clusts)clustree_overlay(nba_clusts,prefix="K",x_value="PC1",y_value="PC2")10sc_examplenba_clusts Clustered NBA positions datasetDescriptionNBA positions dataset clustered using k-means with a range of values of kUsagenba_clustsFormatnba_clusts is a data.frame containing the NBA positions dataset with additional columns holdingk-means clusterings at different values of k and thefirst two principal components•Position-Player position•TurnoverPct-Turnover percentage•ReboundPct-Rebound percentage•AssistPct-Assist percentage•FieldGoalPct-Field goal percentage•K1-K5-Results of k-means clustering•PC1-First principal component•PC2-Second principal componentSourceNBA positions downloaded from https:///lazappi/nba_positions.The source dataset is available from Kaggle at https:///drgilermo/nba-players-stats/ data?select=Seasons_Stats.csv and was originally scraped from Basketball Reference.See https:///lazappi/clustree/blob/master/data-raw/nba_clusts.R for de-tails of how clustering was performed.sc_example Simulated scRNA-seq datasetDescriptionA simulated scRNA-seq dataset generated using the splatter package and clustered using the SC3and Seurat packages.Usagesc_examplesc_example11Formatsc_example is a list holding a simulated scRNA-seq dataset.Items in the list included the simulated counts,normalised log counts,tSNE dimensionality reduction and cell assignments from SC3and Seurat clustering.Source#Simulationlibrary("splatter")#Version1.2.1sim<-splatSimulate(batchCells=200,nGenes=10000,group.prob=c(0.4,0.2,0.2,0.15,0.05),de.prob=c(0.1,0.2,0.05,0.1,0.05),method="groups",seed=1)sim_counts<-counts(sim)[1:1000,]#SC3Clusteringlibrary("SC3")#Version1.7.6library("scater")#Version1.6.2sim_sc3<-SingleCellExperiment(assays=list(counts=sim_counts))rowData(sim_sc3)$feature_symbol<-rownames(sim_counts)sim_sc3<-normalise(sim_sc3)sim_sc3<-sc3(sim_sc3,ks=1:8,biology=FALSE,n_cores=1)sim_sc3<-runTSNE(sim_sc3)#Seurat Clusteringlibrary("Seurat")#Version2.2.0sim_seurat<-CreateSeuratObject(sim_counts)sim_seurat<-NormalizeData(sim_seurat,display.progress=FALSE)sim_seurat<-FindVariableGenes(sim_seurat,do.plot=FALSE,display.progress=FALSE)sim_seurat<-ScaleData(sim_seurat,display.progress=FALSE)sim_seurat<-RunPCA(sim_seurat,do.print=FALSE)sim_seurat<-FindClusters(sim_seurat,e=1:6,resolution=seq(0,1,0.1),print.output=FALSE)sc_example<-list(counts=counts(sim_sc3),logcounts=logcounts(sim_sc3),tsne=reducedDim(sim_sc3),sc3_clusters=as.data.frame(colData(sim_sc3)),seurat_clusters=********************)Index∗datasetsnba_clusts,10sc_example,10clustree,2clustree-package,2clustree_overlay,6igraph::layout_as_tree(),4,5igraph::layout_with_sugiyama(),4,5nba_clusts,10sc_example,1012。

YPPE软件包说明说明书

YPPE软件包说明说明书

Package‘YPPE’October12,2022Title Yang and Prentice Model with Piecewise Exponential BaselineDistributionVersion1.0.1Description Semiparametric modeling of lifetime data with crossing sur-vival curves via Yang and Prentice model with piecewise exponential baseline distribution.De-tails about the model can be found in Demar-qui and Mayrink(2019)<arXiv:1910.02406>.Modelfitting carried out via likelihood-based and Bayesian approaches.The package also provides point and interval estima-tion for the crossing survival times.License GPL(>=2)URL https:///fndemarqui/YPPEBugReports https:///fndemarqui/YPPE/issuesEncoding UTF-8LazyData trueBiarch trueDepends R(>=3.4.0),survivalImports methods,MASS,Formula,Rcpp(>=0.12.0),rstan(>=2.18.1),rstantools(>=2.0.0)LinkingTo BH(>=1.66.0),Rcpp(>=0.12.0),RcppEigen(>=0.3.3.3.0),rstan(>=2.18.1),StanHeaders(>=2.18.0)SystemRequirements GNU makeRoxygenNote7.0.2Suggests testthatNeedsCompilation yesAuthor Fabio Demarqui[aut,cre]Maintainer Fabio Demarqui<*******************.br>Repository CRANDate/Publication2020-01-0920:40:03UTC12YPPE-package R topics documented:YPPE-package (2)coef (3)coef.yppe (3)confint (4)confint.yppe (4)crossTime (5)crossTime.yppe (5)gastric (6)ipass (7)print.summary.yppe (8)summary.yppe (8)survfit (9)survfit.yppe (9)timeGrid (10)vcov (11)vcov.yppe (11)yppe (12)Index14 YPPE-package The’YPPE’package.DescriptionSemiparametric modeling of lifetime data with crossing survival curves via Yang and Prentice model with piecewise exponential baseline distribution curves.Details about the model can be found in Demarqui and Mayrink(2019)<arXiv:1910.02406>.Modelfitting carried out via likelihood-based and Bayesian approaches.The package also provides point and interval estimation for the crossing survival times.ReferencesDemarqui,F.N.and Mayrink,V.D.(2019).A fully likelihood-based approach to model survival data with crossing survival curves.<arXiv:1910.02406>Stan Development Team(2019).RStan:the R interface to Stan.R package version2.19.2.https://Yang,S.and Prentice,R.L.(2005).Semiparametric analysis of short-term and long-term hazard ratios with two-sample survival data.Biometrika92,1-17.coef3 coef Generic S3method coefDescriptionGeneric S3method coefUsagecoef(object,...)Argumentsobject afitted model object...further arguments passed to or from other methods.Valuethe estimated regression coefficientscoef.yppe Estimated regression coefficientsDescriptionEstimated regression coefficientsUsage##S3method for class yppecoef(object,...)Argumentsobject an object of the class yppe...further arguments passed to or from other methodsValuethe estimated regression coefficients4confint.yppe confint Generic S3method confintDescriptionGeneric S3method confintUsageconfint(object,...)Argumentsobject afitted model object...further arguments passed to or from other methods.Valuethe estimated regression coefficientsconfint.yppe Confidence intervals for the regression coefficientsDescriptionConfidence intervals for the regression coefficientsUsage##S3method for class yppeconfint(object,level=0.95,...)Argumentsobject an object of the class yppelevel the confidence level required...further arguments passed to or from other methodsValue100(1-alpha)confidence intervals for the regression coefficientscrossTime5 crossTime Generic S3method crossTimeDescriptionGeneric S3method crossTimeUsagecrossTime(object,...)Argumentsobject afitted model object...further arguments passed to or from other methods.Valuethe crossing survival timecrossTime.yppe Computes the crossing survival timesDescriptionComputes the crossing survival timesUsage##S3method for class yppecrossTime(object,newdata1,newdata2,conf.level=0.95,nboot=4000,...) Argumentsobject an object of class yppenewdata1a data frame containing thefirst set of explanatory variablesnewdata2a data frame containing the second set of explanatory variablesconf.level level of the confidence/credible intervalsnboot number of bootstrap samples(default nboot=4000);ignored if approach="bayes"....further arguments passed to or from other methods.Valuethe crossing survival time6gastric Examples#ML approach:library(YPPE)mle<-yppe(Surv(time,status)~arm,data=ipass,approach="mle")summary(mle)newdata1<-data.frame(arm=0)newdata2<-data.frame(arm=1)tcross<-crossTime(mle,newdata1,newdata2)tcrossekm<-survfit(Surv(time,status)~arm,data=ipass)newdata<-data.frame(arm=0:1)St<-survfit(mle,newdata)time<-sort(ipass$time)plot(ekm,col=1:2)lines(time,St[[1]])lines(time,St[[2]],col=2)abline(v=tcross,col="blue")#Bayesian approach:bayes<-yppe(Surv(time,status)~arm,data=ipass,approach="bayes")summary(bayes)newdata1<-data.frame(arm=0)newdata2<-data.frame(arm=1)tcross<-crossTime(bayes,newdata1,newdata2)tcrossekm<-survfit(Surv(time,status)~arm,data=ipass)newdata<-data.frame(arm=0:1)St<-survfit(bayes,newdata)time<-sort(ipass$time)plot(ekm,col=1:2)lines(time,St[[1]])lines(time,St[[2]],col=2)abline(v=tcross,col="blue")gastric Gastric cancer data setDescriptionData set from a clinical trial conducted by the Gastrointestinal Tumor Study Group(GTSG)in 1982.The data set refers to the survival times of patients with locally nonresectable gastric cancer.Patients were either treated with chemotherapy combined with radiation or chemotherapy alone. FormatA data frame with90rows and3variables:ipass7•time:survival times(in days)•status:failure indicator(1-failure;0-otherwise)•trt:treatments(1-chemotherapy+radiation;0-chemotherapy alone)Author(s)Fabio N.Demarqui<*******************.br>ReferencesGastrointestinal Tumor Study Group.(1982)A Comparison of Combination Chemotherapy and Combined Modality Therapy for Locally Advanced Gastric Carcinoma.Cancer49:1771-7. ipass IRESSA Pan-Asia Study(IPASS)data setDescriptionReconstructed IPASS clinical trial data reported in Argyropoulos and Unruh(2015).Although reconstructed,this data set preserves all features exhibited in references with full access to the observations from this clinical trial.The data base is related to the period of March2006to April 2008.The main purpose of the study is to compare the drug gefitinib against carboplatin/paclitaxel doublet chemotherapy asfirst line treatment,in terms of progression free survival(in months),to be applied to selected non-small-cell lung cancer(NSCLC)patients.FormatA data frame with1217rows and3variables:•time:progression free survival(in months)•status:failure indicator(1-failure;0-otherwise)•arm:(1-gefitinib;0-carboplatin/paclitaxel doublet chemotherapy)Author(s)Fabio N.Demarqui<*******************.br>ReferencesArgyropoulos,C.and Unruh,M.L.(2015).Analysis of time to event outcomes in randomized controlled trials by generalized additive models.PLOS One10,1-33.8summary.yppe print.summary.yppe Print the summary.yppe outputDescriptionPrint the summary.yppe outputUsage##S3method for class summary.yppeprint(x,...)Argumentsx an object of the class summary.yppe....further arguments passed to or from other methods.Valuea summary of thefitted model.summary.yppe Summary for the yppe modelDescriptionSummary for the yppe modelUsage##S3method for class yppesummary(object,...)Argumentsobject an objecto of the class’yppe’....further arguments passed to or from other methods.survfit9 survfit Generic S3method survfitDescriptionGeneric S3method survfitUsagesurvfit(object,...)Argumentsobject afitted model object...further arguments passed to or from other methods.Valuethe crossing survival timesurvfit.yppe Survival function for the YPPE modelDescriptionSurvival function for the YPPE modelUsage##S3method for class yppesurvfit(object,newdata,...)Argumentsobject an object of the class yppenewdata a data frame containing the set of explanatory variables....further arguments passed to or from other methods.Valuea list containing the estimated survival probabilities.10timeGrid Examples#ML approach:library(YPPE)mle<-yppe(Surv(time,status)~arm,data=ipass,approach="mle")summary(mle)ekm<-survfit(Surv(time,status)~arm,data=ipass)newdata<-data.frame(arm=0:1)St<-survfit(mle,newdata)time<-sort(ipass$time)plot(ekm,col=1:2)lines(time,St[[1]])lines(time,St[[2]],col=2)#Bayesian approach:bayes<-yppe(Surv(time,status)~arm,data=ipass,approach="bayes")summary(bayes)ekm<-survfit(Surv(time,status)~arm,data=ipass)newdata<-data.frame(arm=0:1)St<-survfit(bayes,newdata)time<-sort(ipass$time)plot(ekm,col=1:2)lines(time,St[[1]])lines(time,St[[2]],col=2)timeGrid Time gridDescriptionTime gridUsagetimeGrid(time,status,n_int=NULL)Argumentstime Vector of failure timesstatus Vector of failure indicatorsn_int Optional.Number of intervals.If NULL,the number of intervals is set to be equal to the number of distinct observed failure times.ValueTime grid.vcov11 vcov Generic S3method vcovDescriptionGeneric S3method vcovUsagevcov(object,...)Argumentsobject afitted model object...further arguments passed to or from other methods.Valuethe variance-covariance matrix associated the regression coefficients.vcov.yppe Covariance of the regression coefficientsDescriptionCovariance of the regression coefficientsUsage##S3method for class yppevcov(object,...)Argumentsobject an object of the class yppe...further arguments passed to or from other methods.Valuethe variance-covariance matrix associated with the regression coefficients.12yppeyppe Fits the Yang and Prentice model with baseline distribution modelledby the piecewise exponential distribution.DescriptionFits the Yang and Prentice model with baseline distribution modelled by the piecewise exponential distribution.Usageyppe(formula,data,n_int=NULL,rho=NULL,tau=NULL,hessian=TRUE,approach=c("mle","bayes"),hyper_parms=list(h1_gamma=0,h2_gamma=4,mu_psi=0,sigma_psi=4,mu_phi=0, sigma_phi=4,mu_beta=0,sigma_beta=4),...)Argumentsformula an object of class"formula"(or one that can be coerced to that class):a symbolic description of the model to befitted.data an optional data frame,list or environment(or object coercible by as.data.frame to a data frame)containing the variables in the model.If not found in data,thevariables are taken from environment(formula),typically the environment fromwhich yppe is called.n_int number of intervals of the PE distribution.If NULL,default value(square root of n)is used.rho the time grid of the PE distribution.If NULL,the function timeGrid is used to compute rho.tau the maximum time of follow-up.If NULL,tau=max(time),where time is the vector of observed survival times.hessian logical;If TRUE(default),the hessian matrix is returned when approach="mle".approach approach to be used tofit the model(mle:maximum likelihood;bayes:Bayesian approach).hyper_parms a list containing the hyper-parameters of the prior distributions(when approach ="bayes").If not specified,default values are used....Arguments passed to either‘rstan::optimizing‘or‘rstan::sampling‘.yppe13Valueyppe returns an object of class"yppe"containing thefitted model.Examples#ML approach:library(YPPE)mle<-yppe(Surv(time,status)~arm,data=ipass,approach="mle")summary(mle)#Bayesian approach:bayes<-yppe(Surv(time,status)~arm,data=ipass,approach="bayes")summary(bayes)Index∗datasetsgastric,6ipass,7coef,3coef.yppe,3confint,4confint.yppe,4crossTime,5crossTime.yppe,5gastric,6ipass,7print.summary.yppe,8summary.yppe,8survfit,9survfit.yppe,9timeGrid,10vcov,11vcov.yppe,11YPPE(YPPE-package),2yppe,12YPPE-package,214。

pipedata使用手册

pipedata使用手册

pipedata使用手册(原创版)目录1.Pipedata 简介2.安装与使用3.常见问题4.总结正文【1.Pipedata 简介】Pipedata 是一个用于数据处理的 Python 库,提供了一系列易于使用的函数和工具,可以帮助用户进行数据的清洗、转换、整理和分析。

无论是处理 CSV、Excel、JSON 等常见数据格式,还是进行数据可视化、统计分析等操作,Pipedata 都能为您提供高效的解决方案。

【2.安装与使用】安装 Pipedata 非常简单,只需在终端或命令提示符中输入以下命令即可:```pip install pipedata```安装完成后,您可以在 Python 代码中通过`import pipedata`来使用 Pipedata。

Pipedata 提供了许多实用的函数,例如:- `pipedata.read_csv("file.csv")`: 读取 CSV 文件- `pipedata.read_excel("file.xlsx")`: 读取 Excel 文件- `pipedata.read_json("file.json")`: 读取 JSON 文件- `pipedata.clean("data")`: 数据清洗,去除空值、异常值等- `pipedata.transpose("data")`: 交换数据行列- `pipedata.describe("data")`: 查看数据描述性统计信息- `pipedata.plot("data")`: 数据可视化,绘制折线图、柱状图等【3.常见问题】以下是一些使用 Pipedata 时可能遇到的问题及解决方法:- 问题:读取 Excel 文件时出现错误解决:请确保已安装`openpyxl`库,在终端或命令提示符中输入`pip install openpyxl`进行安装。

ProbYX软件包说明说明书

ProbYX软件包说明说明书

Package‘ProbYX’October12,2022Type PackageTitle Inference for the Stress-Strength Model R=P(Y<X)Version1.1-0.1Date2015-12-17Author Giuliana CorteseMaintainer Giuliana Cortese<*******************.it>Depends R(>=3.0-0),rootSolveDescription Confidence intervals and point estimation for R under various parametric model assump-tions;likelihood inference based on classicalfirst-order approximations and higher-order asymp-totic procedures.License GPL-2LazyLoad yesImports stats,graphicsNeedsCompilation noRepository CRANDate/Publication2022-06-2108:57:52UTCR topics documented:ProbYX-package (2)loglik (3)MLEs (4)Prob (6)ROC.plot (7)rp (9)rpstar (10)wald (12)Index1412ProbYX-package ProbYX-package Inference on the stress-strength model R=P(Y<X)DescriptionCompute confidence intervals and point estimates for R,under parametric model assumptions for Y and X.Y and X are two independent continuous random variables from two different populations. DetailsPackage:ProbYXType:PackageVersion: 1.1Date:2012-03-20License:GPL-2LazyLoad:yesThe package can be used for computing accurate confidence intervals and point estimates for the stress-strength(reliability)model R=P(Y<X);maximum likelihood estimates,Wald statis-tic,signed log-likelihood ratio statistic and its modified version ca be computed.The main function is Prob,which evaluates confidence intervals and point estimates under different approaches and parametric assumptions.Author(s)Giuliana CorteseMaintainer:Giuliana Cortese<*******************.it>ReferencesCortese G.,Ventura L.(2013).Accurate higher-order likelihood inference on P(Y<X).Computa-tional Statistics,28:1035-1059.Kotz S,Lumelskii Y,Pensky M.(2003).The Stress-Strength Model and its Generalizations.Theory and Applications.World Scientific,Singapore.Examples#data from the first populationY<-rnorm(15,mean=5,sd=1)#data from the second populationX<-rnorm(10,mean=7,sd=1.5)level<-0.01#\eqn{\alpha}level#estimate and confidence interval under the assumption of two#normal variables with different variances.loglik3Prob(Y,X,"norm_DV","RPstar",level)#method has to be set equal to "RPstar".loglik Log-likelihood of the bivariate distribution of (Y,X)DescriptionComputation of the log-likelihood function of the bivariate distribution (Y ,X).The log-likelihood is reparametrized with the parameter of interest ψ,corresponding to the quantity R,and the nuisance parameter λ.Usageloglik(ydat,xdat,lambda,psi,distr ="exp")Argumentsydat data vector of the sample measurements from Y .xdat data vector of the sample measurements from X.lambda nuisance parameter vector,λ.Values can be determined from the reparameteri-sation of the original parameters of the bivariate distribution chosen in distr .psiscalar parameter of interest,ψ,for the probability R.Value can be determined from the reparameterisation of the original parameters of the bivariate distribu-tion chosen in distr .distrcharacter string specifying the type of distribution assumed for X 1and X 2.Pos-sible choices for distr are "exp"(default)for the one-parameter exponential,"norm_EV"and "norm_DV"for the Gaussian distribution with,respectively,equal or unequal variances assumed for the two random variables.DetailsFor further information on the random variables Y and X,see help on Prob .Reparameterisation in order to determine ψand λdepends on the assumed distribution.Here the following relashonships have been used:Exponential models:ψ=α(α+β)and λ=α+β,with Y ∼e αand X ∼e β;Gaussian models with equal variances:ψ=Φ µ2−µ1√2σ2 and λ=(λ1,λ2)=(µ1√2σ2,√2σ2),with Y ∼N (µ1,σ2)and X ∼N (µ2,σ2);Gaussian models with unequal variances:ψ=Φµ2−µ1√σ21+σ22and λ=(λ1,λ2,λ3)=(µ1,σ21,σ22),with Y ∼N (µ1,σ21)and X ∼N (µ2,σ22).The Standard Normal cumulative distribution function is indicated with Φ.4MLEs ValueValue of the log-likelihood function computed inψ=psi andλ=lambda.Author(s)Giuliana CorteseReferencesCortese G.,Ventura L.(2013).Accurate higher-order likelihood inference on P(Y<X).Compu-tational Statistics,28:1035-1059.See AlsoMLEsExamples#data from the first populationY<-rnorm(15,mean=5,sd=1)#data from the second populationX<-rnorm(10,mean=7,sd=1)mu1<-5mu2<-7sigma<-1#parameter of interest,the R probabilityinterest<-pnorm((mu2-mu1)/(sigma*sqrt(2)))#nuisance parametersnuisance<-c(mu1/(sigma*sqrt(2)),sigma*sqrt(2))#log-likelihood valueloglik(Y,X,nuisance,interest,"norm_EV")MLEs Maximum likelihood estimates of the stress-strength model R=P(Y<X).DescriptionCompute maximum likelihood estimates of R,considered as the parameter of interest.Maximum likelihood estimates of the nuisance parameter are also supplied.UsageMLEs(ydat,xdat,distr)MLEs5 Argumentsydat data vector of the sample measurements from Y.xdat data vector of the sample measurements from X.distr character string specifying the type of distribution assumed for Y and X.Pos-sible choices for distr are"exp"(default)for the one-parameter exponential,"norm_EV"and"norm_DV"for the Gaussian distribution with,respectively,equal or unequal variances assumed for the two random variables.DetailsThe two independent random variables Y and X with given distribution distr are measurements of a certain characteristics on two different populations.For the relationship of the parameter of interest(R)and nuisance parameters with the original parameters of distr,look at the details in loglik.ValueVector of estimetes of the nuisance parameters and the R quantity(parameter of interest),respec-tively.Author(s)Giuliana CorteseReferencesKotz S,Lumelskii Y,Pensky M.(2003).The Stress-Strength Model and its Generalizations.Theory and Applications.World Scientific,Singapore.See Alsologlik,ProbExamples#data from the first populationY<-rnorm(15,mean=5,sd=1)#data from the second populationX<-rnorm(10,mean=7,sd=1.5)#vector of MLEs for the nuisance parameters and the quantity RMLEs(Y,X,"norm_DV")6Prob Prob Estimation of the stress-strength model R=P(Y<X)DescriptionCompute confidence intervals and point estimates for the probability R,under parametric model assumptions for Y and X.Y and X are two independent continuous random variable from two different populations.UsageProb(ydat,xdat,distr="exp",method="RPstar",level=0.05)Argumentsydat data vector of the sample measurements from Y.xdat data vector of the sample measurements from X.distr character string specifying the type of distribution assumed for Y and X.Pos-sible choices for distr are"exp"(default)for the one-parameter exponential,"norm_EV"and"norm_DV"for the Gaussian distribution with,respectively,equal or unequal variances assumed for the two random variables.method character string specifying the methodological approach used for inference(con-fidence intervals and point estimates)on the AUC.The argument method can beset equal to"Wald","RP"or RPstar"(default),according as inference is basedon the Wald statistic,the signed log-likelihood ratio statistic(directed likelih-hod,r p)or the modified signed log-likelihood ratio statistic(modified directedlikelihood,r∗p),respectively.level it is theαthat supplies the nominal level(1−α)chosen for the confidence interval.ValuePROB Point estimate of R=P(Y<X).This value corresponds to the maxi-mum likelihoos estimate if method"Wald"or"RP"is chosen;otherwise,whenmethod"RPstar"is selected,estimate is obtained from the estimating equaltionr∗p=0.C.Interval Confidence interval of R at confidence level(1−α).Author(s)Giuliana CorteseReferencesCortese G.,Ventura L.(2013).Accurate higher-order likelihood inference on R=P(Y<X).Computational Statistics,28:1035-1059.See Alsowald,rp,rpstarExamples#data from the first populationY<-rnorm(15,mean=5,sd=1)#data from the second populationX<-rnorm(10,mean=7,sd=1.5)level<-0.01##\eqn{\alpha}level#estimate and confidence interval under the assumption of two#normal variables with different variances.Prob(Y,X,"norm_DV","RPstar",level)#method has to be set equal to"RPstar".ROC.plot Estimated ROC curvesDescriptionPlot of ROC curves estimated under parametric model assumptions on the continuous diagnostic marker.UsageROC.plot(ydat,xdat,distr="exp",method="RPstar",mc=1)Argumentsydat data vector of the diagnostic marker measurements on the sample of non-diseased individuals(from Y).xdat data vector of the diagnostic marker measurements on the sample of diseased individuals(from X).distr character string specifying the type of distribution assumed for Y and X.Pos-sible choices for distr are"exp"(default)for the one-parameter exponential,"norm_EV"and"norm_DV"for the Gaussian distribution with,respectively,equal or unequal variances assumed for the two random variables.method character string specifying the methodological approach used for estimating the probability R,which is here interpreted as the area under the ROC curve(AUC).The argument method can be set equal to"Wald","RP"or RPstar"(default),according as inference is based on the Wald statistic,the signed log-likelihoodratio statistic(directed likelihhod,r p)or the modified signed log-likelihood ra-tio statistic(modified directed likelihood,r∗p),respectively.For estimating theROC curve parametrically,methods"Wald"and"RP"are equivalent and supplymaximum likelihood estimation(MLE),whereas,by using method"RPstar",estimate of the ROC curve is based on the modified signed log-likelihood ratiostatistic(r∗p).See rpstar for details on this statistic.mc a numeric value indicating single or multiple plots in the samefigure.In case mc is equal to1(default),only the method specified in method is applied and thecorresponding estimated ROC curve is plotted.If mc is different from1,bothMLE and r∗p-based methods are applied,and two differently estimated ROCcurves are plotted.DetailsIf mc is different from1,method does not need to be specified.ValuePlot of ROC curvesNoteThe two independent random variables Y and X with given distribution distr are measurements of the diagnostic marker on the diseased and non-diseased subjects,respectively.In"Wald"method,or equivalently"RP"method,MLEs for parameters of the Y and X distributions are computed and then used to estimate specificity and sensitivity.These measures are evaluated as P(Y<t)and P(X>t),respectively.In"RPstar"method,parameters of the Y and X distributions are estimated from the r∗p-based esti-mate of the AUC.Author(s)Giuliana CorteseReferencesCortese G.,Ventura L.(2013).Accurate higher-order likelihood inference on P(Y<X).Compu-tational Statistics,28:1035-1059.See AlsoProbExamples#data from the non-diseased populationY<-rnorm(15,mean=5,sd=1)#data from the diseased populationX<-rnorm(10,mean=7,sd=1.5)ROC.plot(Y,X,"norm_DV",method="RP",mc=2)rp9 rp Signed log-likelihood ratio statisticDescriptionCompute the signed log-likelihood ratio statistic(r p)for a given value of the stress strength R= P(Y<X),that is the parameter of interest,under given parametric model assumptions.Usagerp(ydat,xdat,psi,distr="exp")Argumentsydat data vector of the sample measurements from Y.xdat data vector of the sample measurements from X.psi scalar for the parameter of interest.It is the value of R,treated as a parameter under the parametric model construction.distr character string specifying the type of distribution assumed for Y and X.Pos-sible choices for distr are"exp"(default)for the one-parameter exponential,"norm_EV"and"norm_DV"for the Gaussian distribution with,respectively,equal or unequal variances assumed for the two random variables.DetailsThe two independent random variables Y and X with given distribution distr are measurements of the diagnostic marker on the diseased and non-diseased subjects,respectively.For the relationship of the parameter of interest(R)and nuisance parameters with the original parameters of distr,look at the details in loglik.ValueValue of the signed log-likelihood ratio statistic r p.NoteThe r p values can be also used for testing statistical hypotheses on the probability R.Author(s)Giuliana Cortese10rpstar ReferencesCortese G.,Ventura L.(2013).Accurate higher-order likelihood inference on P(Y<X).Computa-tional Statistics,28:1035-1059.Severini TA.(2000).Likelihood Methods in Statistics.Oxford University Press,New York.Brazzale AR.,Davison AC.,Reid N.(2007).Applied Asymptotics.Case-Studies in Small Sample Statistics.Cambridge University Press,Cambridge.See Alsowald,rpstar,MLEs,ProbExamples#data from the first populationY<-rnorm(15,mean=5,sd=1)#data from the second populationX<-rnorm(10,mean=7,sd=1.5)#value of\eqn{r_p}for\code{psi=0.9}rp(Y,X,0.9,"norm_DV")rpstar Modified signed log-likelihood ratio statisticDescriptionCompute the modified signed log-likelihood ratio statistic(r∗p)for a given value of the stress strength R=P(Y<X),that is the parameter of interest,under given parametric model assumptions.Usagerpstar(ydat,xdat,psi,distr="exp")Argumentsydat data vector of the sample measurements from Y.xdat data vector of the sample measurements from X.psi scalar for the parameter of interest.It is the value of R,treated as a parameter under the parametric model construction.distr character string specifying the type of distribution assumed for Y and X.Pos-sible choices for distr are"exp"(default)for the one-parameter exponential,"norm_EV"and"norm_DV"for the Gaussian distribution with,respectively,equal or unequal variances assumed for the two random variables.rpstar11 DetailsThe two independent random variables Y and X with given distribution distr are measurements from two different populations.For the relationship of the parameter of interest(R)and nuisance parameters with the original parameters of distr,look at the details in loglik.Valuerp Value of the signed log-likelihood ratio statistic r p.rp_star Value of the modified signed log-likelihood ratio statistic r∗p.NoteThe statistic r∗p is a modified version of r p which provides more statistically accurate estimates.The r∗p values can be also used for testing statistical hypotheses on the probability R.Author(s)Giuliana CorteseReferencesCortese G.,Ventura L.(2013).Accurate higher-order likelihood inference on P(Y<X).Computa-tional Statistics,28:1035-1059.Severini TA.(2000).Likelihood Methods in Statistics.Oxford University Press,New York.Brazzale AR.,Davison AC.,Reid N.(2007).Applied Asymptotics.Case-Studies in Small Sample Statistics.Cambridge University Press,Cambridge.See Alsowald,rp,MLEs,ProbExamples#data from the first populationY<-rnorm(15,mean=5,sd=1)#data from the second populationX<-rnorm(10,mean=7,sd=1.5)#value of\eqn{r_p^*}for\code{psi=0.9}rpstar(Y,X,0.9,"norm_DV")#method has be set equal to"RPstar".12wald wald Wald statisticDescriptionCompute the Wald statistic for a given value of the stress-strength R=P(Y<X),that is the parameter of interest,under given parametric model assumptions.Usagewald(ydat,xdat,psi,distr="exp")Argumentsydat data vector of the sample measurements from Y.xdat data vector of the sample measurements from X.psi scalar for the parameter of interest.It is the value of the quantity R,treated as a parameter under the parametric model construction.distr character string specifying the type of distribution assumed for Y and X.Pos-sible choices for distr are"exp"(default)for the one-parameter exponential,"norm_EV"and"norm_DV"for the Gaussian distribution with,respectively,equal or unequal variances assumed for the two random variables.DetailsThe two independent random variables Y and X with given distribution distr are measurements from two different populations.For the relationship of the parameter of interest(R)and nuisance parameters with the original parameters of distr,look at the details in loglik.ValueWald Value of the Wald statistic for a given psiJphat Observed profile Fisher informationNoteValues of the Wald statistic can be also used for testing statistical hypotheses on the probability R. Author(s)Giuliana CorteseReferencesCortese G.,Ventura L.(2013).Accurate higher-order likelihood inference on P(Y<X).Computa-tional Statistics,28:1035-1059.Brazzale AR.,Davison AC.,Reid N.(2007).Applied Asymptotics.Case-Studies in Small Sample Statistics.Cambridge University Press,Cambridge.wald13See Alsorp,rpstar,MLEs,ProbExamples#data from the first populationY<-rnorm(15,mean=5,sd=1)#data from the second populationX<-rnorm(10,mean=7,sd=1.5)#value of Wald for\code{psi=0.9}wald(Y,X,0.9,"norm_DV")Index∗MLEloglik,3∗ROC curveROC.plot,7∗Stress-strength reliabilityMLEs,4∗Wald statisticwald,12∗area under the ROC curveROC.plot,7∗confidence intervalProb,6∗estimatesMLEs,4∗likelihood asymptoticsrpstar,10∗log-likelihoodloglik,3∗maximum likelihood estimateMLEs,4∗modified signed log-likelihood ratio rpstar,10∗point estimateProb,6∗signed log-likelihood ratiorp,9∗stress-strength modelProbYX-package,2∗stress-strength reliabilityProb,6rp,9rpstar,10wald,12loglik,3,5,9,11,12MLEs,4,4,10,11,13Prob,3,5,6,8,10,11,13ProbYX(ProbYX-package),2ProbYX-package,2ROC.plot,7rp,7,9,11,13rpstar,7,10,10,13wald,7,10,11,12 14。

Linux下MPI并行环境与Eclipse配置全过程

Linux下MPI并行环境与Eclipse配置全过程

Linux下MPI并行环境与Eclipse配置全过程。

Linux + mpich2 + Eclipse我是Linux超级新手,文中难免有错误的地方,望指正和多多包容硬件情况:2台主机主机1:主机名:node1 IP:192.168.19.165 操作系统:CentOS 5.2 用户:root 密码:root主机2:主机名:node2 IP:192.168.19.169 操作系统:CentOS 5.2 用户:root 密码:root(这里的两台主机上的用户名和密码设置成一样的,好像不一样的话将会影响之后mpi程序的执行)为了省事,以下操作都是以root用户进行的1、===================配置host文件=========================在node1和node2上#vi /etc/hosts 打开hosts文件,修改如下:127.0.0.1 localhost.localdomainlocalhost192.168.19.165 node1192.168.19.169 node2(注意127.0.0.1 localhost.localdomainlocalhost一定不能缺,否则将可能导致之后 mpiexec运行出错)2、====================设置SSH信任连接====================在node1上生成SSH秘钥对.#ssh-keygen -t rsa yes,一路回车#cat /root/.ssh/id_rsa.pub | root@192.168.19.169 "cat - >> root/.ssh/authorized_keys" 将密钥等信息拷贝至node2中,该过程需要输入node2上root用户的密码#ssh root@node2 登陆node2#exit#ssh root@node2 第二次登陆node2,无需再输入密码了#exit#ssh root@node1 登陆自身一次在node2上执行同样的操作,只不过目标换成node1了#ssh-keygen -t rsa yes,一路回车#cat /root/.ssh/id_rsa.pub | root@192.168.19.165 "cat - >> root/.ssh/authorized_keys" #ssh root@node1#exit#ssh root@node1#exit#ssh root@node2(以上使用的ssh,如果系统安装的ssh2,设置过程将与上有所不同)3、=====================安装mpich2======================在node1和node2上:#tar -zxvf mpich2-1.0.1.tar.gz 解压缩#cd mpich2-1.0.1#./configure --prefix==安装路径,指定安装路径时可以使用#./configure --prefix=???,不带参数时默认安装路径为/usr/loacl,我用的是默认安装路径#make#make install 安装完成(为了避免未知错误,两台机器的mpich2安装位置最好一样)设置环境变量:#cd /etc/#vi profile 编辑profile文件添加 PATH="$PATH:/usr/local/bin"#source profile#which mpd 测试环境变量创建并修改/etc/mpd.conf文件#vi /etc/mpd.conf内容为secretword=myword#touch /etc/mpd.conf#chmod 600 /etc/mpd.conf (设置文件读取权限和修改时间,这两步好像不能省)创建主机名称集合文件/root/mpd.hosts#vi /root/mpd.hosts文件内容如下:node1node24、=====================简单的测试=========================在node1上#mpd& 启动#mpdboot -n 2 -f mpd.hosts 启动2台机器(启动的机器数不能超过集群中的主机数,这里只有2台)#mpdtrace 观看启动机器#mpiexec -n 4 /usr/local/examples/cpi number为使用的进程数,运行mpi自带的测试程序(不一定存在)#mpdallexit 退出mpi程序的编译#mpicc -o example C语言源代码或#mpic++ -o example C++语言源代码或#mpif77 example.f -o example Fortran语言源代码编译后可以执行:#mpdboot -n 2 -f mpd.hosts#scp /tmp/example root@node2:/tmp/example (/tmp/为刚才编译的程序所在文件夹)(需要并行运算的程序在两台主机上所存放的路径必须相同,文件名也必须相同我这里都存放在/tmp/文件夹下)#mpiexec -n 4/tmp/example5、===================在Eclipse中开发MPI程序=================在新建的工程上点右键选择Properties添加include路径,我的mpich2安装在/usr/local添加lib库路径,添加mpich,mpichxx,pthread 注:这是在linux下,与windows环境下需添加的库不同OK,Eclipse加MPI开发环境配置完成参考资料:SSH设置:/15798089_d.htmlMPICH2配置:/linux/article/accidence/install/20070514/8413.html MPI与Eclipse:/cleverysm/archive/2007/06/06/1640290.aspx一些MPI错误解决方法:/xiaxiazls/archive/2009/09/08/4530423.aspx。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

第5卷第3期 上海大学学报(自然科学版) V o l.5,N o.3 1999年6月 JOU RNAL O F SHAN GHA IUN I V ER S IT Y(NA TU RAL SC IEN CE) June1999PENELO PE软件包的移植与应用实例X罗文芸 王传珊 黄 伟  (化学与化工学院) (理学院) 提 要 PEN ELO PE是电子2光子簇射的M on te2Carlo模拟计算软件包(F.Salvat,1996),能量范围为1keV至几百M eV;模拟计算方法为混合模拟,即硬事件的详细模拟与软事件的压缩模拟相结合;有构造简单的几何软件包,能模拟光子2电子在由二次曲面构成的复杂几何体中的输运过程.本文作者在133微机上实现了对PEN ELO PE的移植,并给出了两个应用实例.关键词 M on te2Carlo方法;混合模拟;能量沉积;电子2光子簇射中图法分类号 T P311.54;TL99The Portable of PENELOPE and Appl ied Exam plesL uo W enyun W ang Chuan shan(Schoo l of Chem istry and Chem ical Engineering,ShanghaiU n iversity)H uang W ei(Schoo l of Sciences,ShanghaiU n iversity)Abstract:PEN ELO PE p erfo rm s M on te2Carlo si m u lati on of electron2p ho ton show ers in arb itrary fo r a w ide energy range,from1keV to several hundred M eV.T he m ethod of si m u lati on is a m ixed p rocedu re,w h ich com b ines detailed si m u lati on of hard even ts w ith conden sed si m u lati on of soft in teracti on s.A si m p le geom etry p ackage p erm its the generati on of random electron2p ho ton show ers in m aterial system s con sisting of hom ogeneou s bodies li m ited by quadric su rface.T he po rtab le of th is code and tw o app lied exam p les have been given.Key words:M on te2Carlo m ethod;m ixed si m u lati on;depo sited energy;electron2p ho ton show ers M on te2Carlo方法在粒子输运上的应用是它最成功的应用,多年来M on te2Carlo方法编制的软件和研究论文一直很多,仅对高能电子而言,常用的就有ETRAN[1](B erger,1988)、IT S3[2](H alb leib, 1992)、EGS4[3](N elson,1985)、GEAN T[4](B run, 1986)等.可是,高能电子的详细模拟是有困难的,因为电子在与介质的一次相互作用后损失的能量很小,只有几十个电子伏特量级,这样,一个高能电子在被介质吸收之前与介质相互作用的次数相当巨大,详细模拟效率非常低.多次散射理论的引入,是将给定路程段中的大量事件作为一个整体效应处理,这样的M on te2Carlo模拟叫做压缩(Conden sed) M on te2Carlo方法.基于多次散射的压缩M on te2 Carlo方法是近似的模拟,有系统误差,而且模拟结果与所取步长有关,只有当步长足够小时,计算结果才稳定,故耗费的机时太多.同时过小的步长也可能X收稿日期:1998211226 罗文芸,女,1965年生,硕士,助研;上海大学化学与化工学院射线应用研究所,上海市嘉定区城中路20号(201800)阻止某些相互作用的发生而影响模拟结果的准确性.此外,这种方法在介质存在界面时也会产生新的困难.上述的M on te2Carlo程序都是这种方法.F. Salvat于1988年提出了压缩M on te2Carlo方法与微分截面的解析解相结合的方法,其散射模型是将数值的总截面(阻止本领)和不同相互作用机制下解析的微分截面(对不同反应道)结合起来,因此程序的结构非常简单.在对电子进行模拟时,采用这种混合过程,即对散射角或能量损失大于截止值的硬相互作用事件详细模拟,只要截止值选择适当,每个径迹中的硬事件数是相对较小的,详细模拟完全可行.而对散射角和能量损失都不超过截止值的软相互作用事件用多次散射方法处理.这样,所引起的横向歧离小,跨越界面时的误差也小.这种M on te2Carlo方法,对具有复杂辐射环境和复杂几何条件问题提供了解决方法.我们的目的是建立一个可以方便地在普通微机上实现的高能电子的M on te2Carlo程序,基于PEN ELO PE[5]较之其他程序的优势,故选择了对PEN ELO PE的移植和开发.1 软件移植PEN ELO PE是模拟电子2光子簇射的M on te2 Carlo软件包(F.Salvat,1996),能量范围为1keV 至几百M eV;有很全面的数据库,自然界中存在的92种元素和由其组成的近300种常用材料的有关信息,都有现成的数据可调用,对这300种以外的材料,可以自己生成数据;还有一个灵活可变的几何软件,运行几何软件可以生成任何可以用二次曲面表示的几何体的组合;除此之外,它还有强大的计算功能,对于有复杂结构物体的剂量分布通过一次计算就可以全部得出.整个软件主要由三个程序包和一个数据库组成:(a)模拟程序包该程序包是软件的核心,即主体程序,由几十个子程序组成,模拟电子2光子在介质中的运动历史.(b)几何程序包该程序包主要是解决由于介质的整体不均匀性给电子模拟带来的困难.用它可以检验径迹是否跨界面,自动实现模拟的几何要求.(c)材料程序包该程序包由一个辅助程序M A T ER I AL和若干子程序组成,实现从数值的数据库中提取相关原子的相互作用数据,形成反映介质各种特性的材料数据文件.(d)数据库该数据库除包含序号1~92的92种元素的相互作用截面和核外电子层数据,还附有包括92种元素在内的近三百种不同材料的组成数据.主程序的流程图可由图1表示.图1 主程序流程图我们在通读整个软件包的基础上,对其源程序进行了适当修改,特别是对电子(或光子)入射部分,使其不仅适用点源和面源,也适用于其他复杂几何的入射情况.根据实践,由于模拟过程涉及众多的变量,而且模拟结果的可靠性在很大程度上取决于模拟的初始粒子数是否足够多,因此PEN ELO PE的・412・ 上海大学学报(自然科学版) 第5卷实际运行对所用计算机的内存和速度有比较高的要求.在安装了W I NDOW S 下的FO R TRAN 编译系统、内存容量为32M 的奔腾133微机上,该软件的运行情况是比较理想的.下面给出两个应用实例.2 模拟计算2.1 半无限厚平板介质被模拟的介质由三层组成,第一层钛窗(0.03mm ),第二层空气(10c m ),第三层为半无限厚的平板碳材料;电子能量2M eV ,平行正入射.跟踪10万个入射电子,给出电子在平板碳材料中的能量沉积深度分布,并与实验进行比较,结果符合较好,见图2.图中实验数据摘自参考文献[6].图2 2M eV 电子在碳中的能量沉积分布2.2 电缆选择铝芯交联聚乙烯绝缘架空电缆为模拟对象,电缆的外半径为1c m ,铝芯的半径为0.75c m ,聚乙烯绝缘层厚度为0.25c m .假设加速器产生的电子为平行电子束,能量为2M eV ,在辐照过程中电缆线不进行旋转,即单面辐照,见示意图(图3).图3 电缆截面示意图把绝缘层沿径向从外到里分为5层(layer 1~layer 5),每层厚度为0.05c m ,再沿极角方向(见图3)将每层36等分,算出电子在每个小体积元内能量沉积的平均值,跟踪20万个入射电子后,给出在每层绝缘层中,电子能量沉积沿极角H 的分布情况,见图4.图4 2M eV 电子在电缆绝缘层中能量沉积分布由图4可以看出,绝缘层上表面(0°≤H <180°)最外层(layer 1)电子能量沉积小,而里层(layer 5)反而大,但在近0°和180°处,出现相反现象,外层大里层小.这主要是铝芯背散射的结果,因为背散射系数与原子序数成正比[7],铝的原子序数大于聚乙烯的等效原子序数,受铝芯背散射效应的影响,绝缘层上表面里层的电子能量沉积明显增大,而在近0°和180°处,背散射影响小,则出现相反现象;其次,在电子平行正入射的情况下,根据深度剂量分布规律[8],电子在吸收体中的能量沉积并不是呈线性下降的趋势,而总是呈一个先上升再下降的分布形状(见图2),峰位和宽度与电子能量、吸收体原子序数和阻止本领等因素有关,在本例模拟计算中,由于假设电缆线是受单面辐照,平行电子束只有在上表面正中间的地方可以近似为正入射,其它地方电子的入射情况都只能看作斜入射,能量沉积分布更为复杂.这也是导致上述结果的原因之一.绝缘层下表面(180°≤H <360°)电子能量沉积几乎为零,这表明电子大部分截止在铝芯内,电缆绝缘层下表面基本辐照不到.如果将电缆线不停地进行旋转,电子的入射方向可以近似为沿径向的正入射,加上铝芯的背散射作用,对绝缘层稍厚一些的电缆线,也能基本达到均匀辐照的效果.因此,在辐照・512・第3期 罗文芸等:PEN ELO PE 软件包的移植与应用实例过程中,电缆线的旋转是十分必要的.3 讨 论PEN ELO PE软件包采用混合的M on te2Carlo 模拟方法,把电子与物质的相互作用区分为硬、软碰撞,仅仅对硬碰撞做详细模拟,对软碰撞用多次散射理论模拟,这样可以相应缩短机时,提高计算效率,同时,混合模拟使介质中界面的处理也变得十分容易,当电子在两次硬碰撞之间遇到界面时,自动调整步长,使电子停止在界面处,调用新材料的有关信息后,再继续模拟下一次碰撞,这样处理在程序上容易实现,对复杂几何体的模拟也能得到比较准确的结果.PEN ELO PE作为模拟电子2光子簇射的M on te2Carlo软件包,能在微机上实现,有很宽的能量范围,能模拟任意材料和有复杂结构的介质,这对射线应用而言,无疑是增加了一种很好的研究手段.本文对PEN ELO PE应用于多层平板介质和多层圆柱体作了模拟计算,其中,多层平板介质的计算结果与其它实验室的实验结果作了比较.多层平板和多层圆柱体都是结构比较简单的几何体,我们将PEN ELO PE应用在模拟电子加速器和卫星空间辐射环境上,得到了令人满意的结果,以后将另文发表.参 考 文 献1 Jenk in s T W,N elson W R,R indi A.M on te Carlo tran spo rt of electron s and pho ton s,19882 H alb leib J A,Ken sek R P,M eh lho rn T A,et al.R e2 po rt SAND9121632Sandia N ati onal L abo rato ries,1992 3 N elson W R,H irayam a H,Rogers D W O.Stanfo rd lin2 ear accelerato r cen ter repo rt.SLA C2265,19854 B run R,B ruyan t F,M aireM,et al.CERN R epo rt DD EE8421,19865 Salvat F,Fernandez2V area J M,Baro J,et rm es tecn ico s ciem at,1996.7996 A ndreo P,Ito R,T abata T.A tom ic data and nuclear data tab les,1994,56:1057 王传珊等.电子束在多层材料中的背散射效应.核技术, 1995,18(3):1668 地人书馆(日本).R adiati on do si m etry of electron beam s fo r radiati on p rocessing,1992.122^・612・ 上海大学学报(自然科学版) 第5卷。

相关文档
最新文档