0.0.128
This commit is contained in:
		| @@ -329,10 +329,12 @@ new_array = guan.find_close_values_in_one_array(array, precision=1e-2) | |||||||
|  |  | ||||||
| degenerate_k_array, degenerate_eigenvalue_array = guan.find_degenerate_points(k_array, eigenvalue_array, precision=1e-2) | degenerate_k_array, degenerate_eigenvalue_array = guan.find_degenerate_points(k_array, eigenvalue_array, precision=1e-2) | ||||||
|  |  | ||||||
| guan.change_directory_by_replacement(current_key_word='code', new_key_word='data') |  | ||||||
|  |  | ||||||
| guan.batch_reading_and_plotting(directory, xlabel='x', ylabel='y') | guan.batch_reading_and_plotting(directory, xlabel='x', ylabel='y') | ||||||
|  |  | ||||||
|  | guan.move_all_files_to_root_directory(directory) | ||||||
|  |  | ||||||
|  | guan.change_directory_by_replacement(current_key_word='code', new_key_word='data') | ||||||
|  |  | ||||||
| hex = guan.rgb_to_hex(rgb, pound=1) | hex = guan.rgb_to_hex(rgb, pound=1) | ||||||
|  |  | ||||||
| rgb = guan.hex_to_rgb(hex) | rgb = guan.hex_to_rgb(hex) | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| [metadata] | [metadata] | ||||||
| # replace with your username: | # replace with your username: | ||||||
| name = guan | name = guan | ||||||
| version = 0.0.127 | version = 0.0.128 | ||||||
| author = guanjihuan | author = guanjihuan | ||||||
| author_email = guanjihuan@163.com | author_email = guanjihuan@163.com | ||||||
| description = An open source python package | description = An open source python package | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| Metadata-Version: 2.1 | Metadata-Version: 2.1 | ||||||
| Name: guan | Name: guan | ||||||
| Version: 0.0.127 | Version: 0.0.128 | ||||||
| Summary: An open source python package | Summary: An open source python package | ||||||
| Home-page: https://py.guanjihuan.com | Home-page: https://py.guanjihuan.com | ||||||
| Author: guanjihuan | 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. | # 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.127, updated on August 28, 2022. | # The current version is guan-0.0.128, updated on September 07, 2022. | ||||||
|  |  | ||||||
| # Installation: pip install --upgrade guan | # Installation: pip install --upgrade guan | ||||||
|  |  | ||||||
| @@ -2528,15 +2528,6 @@ def find_degenerate_points(k_array, eigenvalue_array, precision=1e-2): | |||||||
|         i0 += 1 |         i0 += 1 | ||||||
|     return degenerate_k_array, degenerate_eigenvalue_array |     return degenerate_k_array, degenerate_eigenvalue_array | ||||||
|  |  | ||||||
| def change_directory_by_replacement(current_key_word='code', new_key_word='data'): |  | ||||||
|     import os |  | ||||||
|     code_path = os.getcwd() |  | ||||||
|     data_path = code_path.replace('\\', '/')  |  | ||||||
|     data_path = data_path.replace(current_key_word, new_key_word)  |  | ||||||
|     if os.path.exists(data_path) == False: |  | ||||||
|         os.makedirs(data_path) |  | ||||||
|     os.chdir(data_path) |  | ||||||
|  |  | ||||||
| def batch_reading_and_plotting(directory, xlabel='x', ylabel='y'): | def batch_reading_and_plotting(directory, xlabel='x', ylabel='y'): | ||||||
|     import re |     import re | ||||||
|     import os |     import os | ||||||
| @@ -2547,6 +2538,28 @@ def batch_reading_and_plotting(directory, xlabel='x', ylabel='y'): | |||||||
|                 x_array, y_array = guan.read_one_dimensional_data(filename=filename) |                 x_array, y_array = guan.read_one_dimensional_data(filename=filename) | ||||||
|                 guan.plot(x_array, y_array, xlabel=xlabel, ylabel=ylabel, title=filename, show=0, save=1, filename=filename) |                 guan.plot(x_array, y_array, xlabel=xlabel, ylabel=ylabel, title=filename, show=0, save=1, filename=filename) | ||||||
|  |  | ||||||
|  | def move_all_files_to_root_directory(directory): | ||||||
|  |     import os | ||||||
|  |     import shutil | ||||||
|  |     for root, dirs, files in os.walk(directory): | ||||||
|  |         for i0 in range(len(files)): | ||||||
|  |             shutil.move(root+'/'+files[i0], directory+'/'+files[i0]) | ||||||
|  |     for i0 in range(100): | ||||||
|  |         for root, dirs, files in os.walk(directory): | ||||||
|  |             try: | ||||||
|  |                 os.rmdir(root)  | ||||||
|  |             except: | ||||||
|  |                 pass | ||||||
|  |  | ||||||
|  | def change_directory_by_replacement(current_key_word='code', new_key_word='data'): | ||||||
|  |     import os | ||||||
|  |     code_path = os.getcwd() | ||||||
|  |     data_path = code_path.replace('\\', '/')  | ||||||
|  |     data_path = data_path.replace(current_key_word, new_key_word)  | ||||||
|  |     if os.path.exists(data_path) == False: | ||||||
|  |         os.makedirs(data_path) | ||||||
|  |     os.chdir(data_path) | ||||||
|  |  | ||||||
| def rgb_to_hex(rgb, pound=1): | def rgb_to_hex(rgb, pound=1): | ||||||
|     if pound==0: |     if pound==0: | ||||||
|         return '%02x%02x%02x' % rgb |         return '%02x%02x%02x' % rgb | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user