guan-0.0.162
This commit is contained in:
		| @@ -290,6 +290,8 @@ 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') | ||||
|  | ||||
| guan.open_file(filename='a', file_format='.txt') | ||||
|  | ||||
| guan.write_one_dimensional_data(x_array, y_array, filename='a', file_format='.txt') | ||||
|  | ||||
| guan.write_one_dimensional_data_without_opening_file(x_array, y_array, file) | ||||
| @@ -298,7 +300,11 @@ guan.write_two_dimensional_data(x_array, y_array, matrix, filename='a', file_for | ||||
|  | ||||
| guan.write_two_dimensional_data_without_opening_file(x_array, y_array, matrix, file) | ||||
|  | ||||
| guan.print_array(array, show_index=0, index_type=0) | ||||
| guan.write_two_dimensional_data_without_xy_array(matrix, filename='a', file_format='.txt') | ||||
|  | ||||
| guan.write_two_dimensional_data_without_xy_array_and_without_opening_file(matrix, file) | ||||
|  | ||||
| guan.print_array_with_index(array, show_index=1, index_type=0) | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| [metadata] | ||||
| # replace with your username: | ||||
| name = guan | ||||
| version = 0.0.161 | ||||
| version = 0.0.162 | ||||
| author = guanjihuan | ||||
| author_email = guanjihuan@163.com | ||||
| description = An open source python package | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| Metadata-Version: 2.1 | ||||
| Name: guan | ||||
| Version: 0.0.161 | ||||
| Version: 0.0.162 | ||||
| Summary: An open source python package | ||||
| Home-page: https://py.guanjihuan.com | ||||
| Author: guanjihuan | ||||
|   | ||||
| @@ -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.161, updated on January 13, 2023. | ||||
| # The current version is guan-0.0.162, updated on February 20, 2023. | ||||
|  | ||||
| # Installation: pip install --upgrade guan | ||||
|  | ||||
| @@ -2232,6 +2232,13 @@ 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 | ||||
|  | ||||
| def open_file(filename='a', file_format='.txt'): | ||||
|     try: | ||||
|         file = open(filename+file_format, 'a', encoding='UTF-8') | ||||
|     except: | ||||
|         file = open(filename+file_format, 'w', encoding='UTF-8') | ||||
|     return file | ||||
|  | ||||
| def write_one_dimensional_data(x_array, y_array, filename='a', file_format='.txt'):  | ||||
|     with open(filename+file_format, 'w') as file: | ||||
|         guan.write_one_dimensional_data_without_opening_file(x_array, y_array, file) | ||||
| @@ -2272,7 +2279,17 @@ def write_two_dimensional_data_without_opening_file(x_array, y_array, matrix, fi | ||||
|         file.write('\n') | ||||
|         i0 += 1 | ||||
|  | ||||
| def print_array(array, show_index=0, index_type=0): | ||||
| def write_two_dimensional_data_without_xy_array(matrix, filename='a', file_format='.txt'): | ||||
|     with open(filename+file_format, 'w') as file: | ||||
|         guan.write_two_dimensional_data_without_xy_array_and_without_opening_file(matrix, file) | ||||
|  | ||||
| def write_two_dimensional_data_without_xy_array_and_without_opening_file(matrix, file): | ||||
|     for row in matrix: | ||||
|         for element in row: | ||||
|             file.write(str(element)+'   ') | ||||
|         file.write('\n') | ||||
|  | ||||
| def print_array_with_index(array, show_index=1, index_type=0): | ||||
|     if show_index==0: | ||||
|         for i0 in array: | ||||
|             print(i0) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user