Python学习
Xianyu_Wang
科研小白,慢慢成长~
展开
-
MCMC收敛判据:Gelman-Rubin检验和自相关时间
MCMC收敛判据:Gelman-Rubin检验和自相关时间Gelman-Rubin 检验The Gelman Rubin Statistic compares the mean of medians vs the median of means of the chains. It is essentially a measure of how similar the chains are and asymptotically approaches 1 as they become identica.原创 2020-10-14 19:37:34 · 3707 阅读 · 0 评论 -
Basemap编码错误处理:UnicodeDecodeError: utf-8
Basemap编码错误处理:UnicodeDecodeError: utf-8问题描述主要的情况是载入shp文件时候发生编码错误,报错如下。中国shp文件合集ploy.py 12 <module>basemap.readshapefile(shapefile = "bou1_4p",name = "china")__init__.py 2139 readshapefilefor shprec in shf.shapeRecords():shapefile.py 104.原创 2020-08-03 11:54:57 · 717 阅读 · 0 评论 -
Python性能分析:统计每一行代码的执行时间
Python性能分析:统计每一行代码的执行时间参考文章: A Guide to Analyzing Python Performanceline_profiler 安装$ pip install line_profiler写入装饰器安装后line_profiler,可以访问名为“line_profiler”的新模块以及一个可执行脚本kernprof.py。要使用这个工具,首先通过使用@profile 装饰要执行的函数。不必输入任何东西来使用这个装饰器。kernprof.py将在执行.原创 2020-07-31 10:54:15 · 5526 阅读 · 2 评论 -
Python多进程:超时进程的处理与终止
###Python多进程:超时进程的处理与终止简介: 平时的工作中经常需要使用多进程去求解微分方程去模拟系统演化或者通过优化方法去寻找最优解,上述的工作中经常用到Python的多进程Multiprocess。在使用这一功能的时候,我经常遇到某个进程长时间没有结束,可能是在求解的时候陷入了无尽的循环,所以我引入**可超时终止的多进程方法**。关键词: Python多进程, Multiprocess,超时,子进程,Timeout####基本思想我们希望当程序运行的时候,最好有一个...原创 2020-06-02 15:22:06 · 5710 阅读 · 1 评论 -
Python多进程与随机函数
不同平台上的多进程(Windows和Linux)廖雪峰关于Python的多进程在不同平台上的实现:链接要点: Linux通过Fork实现多进程,Windows通过multiprocessing实现多进程 由于Windows通过调用上述模块实现多进程,所以要通过if name == “main“:将其保护起来,否则将递归创建进程 在多进程中的Random函数由于在Unix上每...原创 2019-10-22 09:23:28 · 1350 阅读 · 0 评论 -
Python加载nmpy、scipy和matplotlib模块的方法
Python添加模块原创 2017-02-27 14:18:26 · 1941 阅读 · 0 评论