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

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如何在导入到Google工作表时使用ApachePOI显示系列标签   java在Swing表上修改数据生成SQL   java TCP数据包在网络级别合并   java自动连线bean在线程位置为空   javasocket。禁用无线连接时getOutputStream()阻塞   JSON上的javascript字符串数组。stringify输出unicode字符   java在Oracle数据库中存储不同类型数据的最佳体验   Spring MVC中模板引擎后的java进程输出   不知从哪里来的java空字符串。   如何加载java。使用Adobe Flex的客户端的属性文件?   java如何替换多层括号之间的所有内容?   {JSONObject必须以java'开头   java使用commandButton或commandLink返回并管理HTML控件值   java Android大文本视图动态   java JMock需要自定义类   java Android应用程序在emulator中工作,但在设备中失败   java连接到derby数据库时使用什么文件路径格式?   java在一个函数调用中返回两个结果?