会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
algxbi
博客园
首页
新随笔
联系
订阅
管理
2021年2月1日
常用国内pip镜像源
摘要: 常用国内pip镜像源 清华 https://pypi.tuna.tsinghua.edu.cn/simple/ 中科大 https://pypi.mirrors.ustc.edu.cn/simple/ 阿里云 https://mirrors.aliyun.com/pypi/simple/ 豆瓣 ht
阅读全文
posted @ 2021-02-01 16:08 algxbi
阅读(282)
评论(0)
推荐(0)
2020年12月23日
[python] pip使用命令
摘要: 根据requirements.txt文件安装模块 pip install -r requirements.txt 安装/卸载 模块 pip install <module> # 下载某个模块 pip install <module>== <version> # 指定下载的版本 pip uninsta
阅读全文
posted @ 2020-12-23 20:37 algxbi
阅读(71)
评论(0)
推荐(0)
FastSurfer, 使用深度学习加速大脑皮层分割
摘要: FastSurfer github: https://github.com/Deep-MI/FastSurfer FastSurfer简介 FastSurfer, 一个快速而准确的基于深度学习的神经医学影像处理管道. 可以实现进行volumetric分析(在GPU上1min), 和在surface上
阅读全文
posted @ 2020-12-23 19:09 algxbi
阅读(2957)
评论(0)
推荐(1)
[pytest] 使用pytest-cov计算覆盖率
摘要: 配置.coveragerc 排除某些你不关注的行, 比如 '__main__' 所在行 可以通过配置你本地的 .coveragerc 文件进行设置 [run] branch = True omit = # 计算覆盖率时排除某些文件 */test_*.py */*_test.py [report] #
阅读全文
posted @ 2020-12-23 10:44 algxbi
阅读(809)
评论(0)
推荐(0)
2020年12月22日
[pytest] pytest-mock简单入门
摘要: 什么是mock 写测试写到一定程度,就会发现,不做mock是不行的, 一个长达5个小时的计算代码,总不能每次测试都跑一次吧? 这个时候我们就需要mock住代码 所谓mock,简单理解就是模拟代码的行为, 并不真正运行代码本身,从而能够减少重复测试,减少测试的时间. pytest-mock pytho
阅读全文
posted @ 2020-12-22 16:02 algxbi
阅读(2074)
评论(0)
推荐(0)
2020年12月9日
[pytest]如何测试正确的'错误'? 使用pytest进行异常测试
摘要: 使用pytest.raises来进行对异常的测试 import pytest def test_error(): with pytest.raises(ZeroDivisionError): 1 / 0
阅读全文
posted @ 2020-12-09 15:48 algxbi
阅读(301)
评论(0)
推荐(0)
[pytest]使用多线程为pytest测试加速
摘要: 安装pytest-xdist包 pip3 install pytest-xdist 使用方法 pytest -n NUM NUM 为进程数目, 你的电脑是几核的就可以使用最大数量的核来进行运算, 比如我的电脑是六核的,NUM就可以设定为6. 康康效果 #使用前 28 passed in 26.15s
阅读全文
posted @ 2020-12-09 14:26 algxbi
阅读(519)
评论(0)
推荐(0)
2020年11月18日
[python] 数组排序之后恢复原来的顺序
摘要: 解决的是这样一个问题 1.我们对数组\列表进行排序 2.对排序后的数组\列表进行操作 3.我们希望把操作之后的数据恢复原先的顺序 import numpy as np values = np.array([0.9,0.1,0.5,0.6]) values_index = np.argsort(val
阅读全文
posted @ 2020-11-18 19:43 algxbi
阅读(1420)
评论(0)
推荐(0)
2020年10月10日
更加优雅轻便的python单元测试模块——pytest【入门篇】
摘要: 官网介绍 全英警告!!! https://docs.pytest.org/en/latest/getting-started.html#install-pytest 安装pytest pip3 install pytest 写一个简单的例子 # content of test_sample.py d
阅读全文
posted @ 2020-10-10 16:50 algxbi
阅读(180)
评论(0)
推荐(1)
公告