Download pv-data0/create_folders.py from MnbvZhou/laser-arc_welding_simulation_dataset_tecplot_format: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/datasets/MnbvZhou/laser-arc_welding_simulation_dataset_tecplot_format/resolve/main/pv-data0/create_folders.py
- Command line
-
hf download hf://datasets/MnbvZhou/laser-arc_welding_simulation_dataset_tecplot_format/pv-data0/create_folders.py
-
curl -L -o create_folders.py https://huggingface.co/datasets/MnbvZhou/laser-arc_welding_simulation_dataset_tecplot_format/resolve/main/pv-data0/create_folders.py
1.92 kB
| import os | |
| import shutil | |
| import math | |
| # 参数设置 | |
| power = 1000 # 功率 (W) | |
| speed_start = 0.006 # 起始速度 (m/s) | |
| speed_end = 0.025 # 结束速度 (m/s) | |
| speed_step = 0.001 # 速度步长 (m/s) | |
| # 读取原始input_param.txt文件 | |
| with open('input_param.txt', 'r', encoding='utf-8') as f: | |
| original_content = f.read() | |
| # 创建文件夹和文件 | |
| speeds = [] | |
| current_speed = speed_start | |
| while current_speed <= speed_end: | |
| speeds.append(round(current_speed, 3)) | |
| current_speed += speed_step | |
| print("将创建以下文件夹:") | |
| for speed in speeds: | |
| energy_density = round(power / speed, 1) | |
| folder_name = f"{energy_density} J_m" | |
| print(f"速度: {speed} m/s, 线能量密度: {energy_density} J/m, 文件夹: {folder_name}") | |
| print("\n开始创建文件夹和文件...") | |
| for speed in speeds: | |
| energy_density = round(power / speed, 1) | |
| folder_name = f"{energy_density} J_m" | |
| # 创建主文件夹 | |
| os.makedirs(folder_name, exist_ok=True) | |
| # 创建result子文件夹 | |
| result_folder = os.path.join(folder_name, "result") | |
| os.makedirs(result_folder, exist_ok=True) | |
| # 复制exe文件 | |
| shutil.copy2("2017.05.08.exe", folder_name) | |
| # 修改input_param.txt文件内容 | |
| modified_content = original_content.replace("alaspow=1000", f"alaspow={power}") | |
| modified_content = modified_content.replace("scanvel=0.006", f"scanvel={speed}") | |
| # 写入修改后的input_param.txt到result文件夹 | |
| output_file = os.path.join(result_folder, "input_param.txt") | |
| with open(output_file, 'w', encoding='utf-8') as f: | |
| f.write(modified_content) | |
| print(f"已创建: {folder_name}") | |
| print(f"\n完成! 共创建了 {len(speeds)} 个文件夹") | |
| print("每个文件夹包含:") | |
| print("- 2017.05.08.exe") | |
| print("- result/input_param.txt (已修改功率和扫描速度)") | |