日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

数据处理-拉伸中的strain-stress曲线

發布時間:2024/1/1 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 数据处理-拉伸中的strain-stress曲线 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

目錄

  • 基本步驟
  • 軟件推薦
  • 代碼部分
  • 草圖輸出
  • 福利


主要記錄科研中遇到的通用數據處理過程

源代碼下載:Deformation of Amorphous Polyethylene,不過里面的data不是以文件形式提供的,不太方便。

所以可以從我的資源里下載:deformTest.tar.gz,里面含有基本的源數據和對應的處理py腳本。


基本步驟

  • 得到數據文件(來源于各種仿真程序,通常可以導致指定格式的文件。批量讀取文件的話,需要考慮到文件夾內文件的排序以及文件類型問題)
  • 得到文件中的數據(讀取上述文件中的數據,需要考慮到數據的篩選清洗、以及時間步的平均調整)
  • 對數據進行可視化(哪怕excel都可以做出好看的圖,只是綜合來看可以完成以上步驟的同時還需要可視化,建議使用一門編程語言,例如Python)

  • 軟件推薦

    IDE部分建議使用Spyder,界面和Matlab類似。


    代碼部分

    #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 8 12:37:24 2021@author: yuanbaoqiangThis is a simple py to handle the data in multi txt files, mainly including three steps:1. ENSURE YOUR DATA FILES2. OBTAIN YOUR DATA3. PLOT """# Import modules you need to deal with your files # glob,os ---> file processing import glob,os # pandas ----> data processing import pandas as pd # matplotlib ----> plot import matplotlib.pyplot as plt######################################################## # 1. FIND THE PATH, AND LOAD NEEDED FILES IN THIS PATH# To get the py file's absolute path path=os.getcwd() # Add all .txt files in the path above file=glob.glob(os.path.join("*.txt")) # Sort all .txt files you have added file.sort() # You can also sort all files by using the keyword in your file name with the lamba experession below # file.sort(key = lambda x: int(x[13:-4])) print('You have added ' + str(len(file)) + ' files, and they are ' + str(file))# Define a empty list # List named "df" is to store your data in every file seperately in a dataframe element df = [] # List named "names" is to define column names of every dataframe names = [] names1 = ['strain', 'pxx', 'pyy', 'pzz', 'lx', 'ly', 'lz' , 'temp']; names2 = ['strain', 'epair', 'ebond', 'eangle', 'edihed'] names.append(names1) names.append(names2)######################################################## # 2. OBTAIN THE DATA IN FILES YOU HAVE LOADED# Traverse the list and obtain the needed frame in each file i = 0 for f in file:# Official interpretation about "pandas.read_csv", which is the most "read" command I have used# https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.htmldf.append(pd.read_csv(f, delim_whitespace=True, names=names[i], skiprows=[0]))i = i + 1######################################################## # 3. JUST PLOT USING THE DATA YOU NEEDED# Plot a simple graph, and you can see a rough prototype like the "strain-stress" curve in the paper: # 10.1016/j.polymer.2010.10.009 plt.plot(df[0][:]['strain'], df[0][:]['pxx'])

    草圖輸出

    不含數據的處理,只是一個基本草圖輸出,但從趨勢來看是和論文大致相同的。

    10.1016/j.polymer.2010.10.009論文中的圖:


    福利

    本群在lammps學習過程中給予了我莫大的幫助,群里很活躍,歡迎小伙伴的加入~

    歡迎加入qq群:698671585

    歡迎關注群主的公眾號,lammps_zhushou,文章持續更新中~

    總結

    以上是生活随笔為你收集整理的数据处理-拉伸中的strain-stress曲线的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。