用于科学代码和脚本的小型工具和函数集。

sciscripttools的Python项目详细描述


科学工具

用于科学代码和脚本的小型工具和函数集。在

安装

pip

pip install sciscripttools

源代码构建

^{pr2}$

示例

IO

IO工具入门示例。 它可以保存相对基本的python对象,例如值、字符串、数组和 这些项目的字典。在

importsciscripttoolsasstpower=[4,5,6]st.save_data("power_exp_01",power)# save a value, arrary, or dictionaryexp_info={"id":20200117,"wire_r":0.005,"lengths_1":[0.1,0.5,1.5]}st.save_data("exp_01",exp_info,directory="data/")w1=[0.1,0.5,1.5]w2=[0.1,0.3,1.7]w3=[0.1,0.6,1.2]radii=st.create_dictionary("w1",w1,"w2",w2,"w3",w3)st.save_data("radii",radii)

加载以前保存的数据

importsciscripttoolsasstexp_info=st.load_dictionary("exp_01",directory="data/")keys,radii=st.load_data("radii",keys=["w1","w3"])# load straight into arrayspower=st.load_item("power_exp_01")

绘图

开始使用打印工具的示例。 注意:standard_font类和{}类的单元函数需要乳胶!在

importnumpyasnpimportmatplotlib.pyplotaspltimportsciscripttoolsasst# datax=np.linspace(0,2)y=x+np.random.rand(len(x))y2=x+np.random.rand(len(x))# figurefig_params=st.figure_parameters()# generate parametersst.standard_font(font_size=fig_params.font_size)# standarise the font# normal matplotlib plottingfig,axes=plt.subplots(1,2,sharey=True)# create matplotlib figureax1,ax2=axes# plot dataax1.plot(x,y)ax2.plot(x,y2)foraxinaxes:ax.set_ylim(0,3)fig.subplots_adjust(wspace=fig_params.adjust_subplot_wspace)# set subplot width spacingsf=st.standard_figure(fig,axes,fig_params)# create standard_figuresf.add_subplot_labels()# add unitsylabel="Power";yunit="\\watt"sf.ylabel(ax1,ylabel,yunit)xlabel="Time";xunit="\\second"sf.xlabel(axes,xlabel,xunit)fig.savefig("quick_plot.png")

example quick plot

贡献

发现了一个bug,想添加功能,还是修复了一个bug? 创建一个issuepull request。 任何意见或反馈,请写在issue中。在

链接

GitHub

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java重写父类中的特定行   java Apache Commons CLI订购帮助选项?   java如何将数据添加到网格视图   java如何在Apache Camel批处理后移动文件?   java如何为日期范围的between子句编写hql查询?   雅加达ee开始Java编程,我应该从哪里开始?   排序Java8+流:检查我的objectinstances的两个字段的列表顺序是否正确   java如何将json转换为Map<String,Object>确保整数为整数   java不能在Spring数据JPA批处理过程中创建TransactionException   java损坏的PDF文件从FTP下载到使用Apache Common Net的设备   java无法使用Spring批处理和Wso2为XML架构命名空间找到Spring NamespaceHandler   java Android ImageView未显示在SherlockFragment中   Maven在构建时出错=无法识别Java路径   java如何使用批处理文件调用关闭处理程序?   java admob广告横幅重叠我的游戏屏幕安卓