This commit is contained in:
guanjihuan 2023-03-02 03:09:59 +08:00
parent 88b3564344
commit 4a53868d57
4 changed files with 11 additions and 3 deletions

View File

@ -394,6 +394,9 @@ x_array, y_array, matrix = guan.read_two_dimensional_data(filename='a', file_for
# 读取文件中的二维数据(第一行和列分别为横纵坐标)(支持复数形式)
x_array, y_array, matrix = guan.read_two_dimensional_complex_data(filename='a', file_format='.txt')
# 读取文件中的二维数据不包括x和y
matrix = guan.read_two_dimensional_data_without_xy_array(filename='a', file_format='.txt')
# 打开文件用于新增内容
f = guan.open_file(filename='a', file_format='.txt')

View File

@ -1,7 +1,7 @@
[metadata]
# replace with your username:
name = guan
version = 0.0.165
version = 0.0.166
author = guanjihuan
author_email = guanjihuan@163.com
description = An open source python package

View File

@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: guan
Version: 0.0.165
Version: 0.0.166
Summary: An open source python package
Home-page: https://py.guanjihuan.com
Author: guanjihuan

View File

@ -2,7 +2,7 @@
# With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing.
# The current version is guan-0.0.165, updated on February 24, 2023.
# The current version is guan-0.0.166, updated on March 02, 2023.
# Installation: pip install --upgrade guan
@ -2323,6 +2323,11 @@ def read_two_dimensional_complex_data(filename='a', file_format='.txt'):
matrix = np.append(matrix, [matrix_row], axis=0)
return x_array, y_array, matrix
# 读取文件中的二维数据不包括x和y
def read_two_dimensional_data_without_xy_array(filename='a', file_format='.txt'):
matrix = np.loadtxt(filename+file_format)
return matrix
# 打开文件用于新增内容
def open_file(filename='a', file_format='.txt'):
try: