| 1 | import csv |
| 2 | import numpy as np |
| 3 | import os |
| 4 | |
| 5 | data = [] |
| 6 | |
| 7 | csv_file = 'NOMAD_Invalid_groups_exported_1.csv' |
| 8 | |
| 9 | with open(csv_file, 'r') as file: |
| 10 | csv_reader = csv.reader(file) |
| 11 | next(csv_reader) |
| 12 | |
| 13 | for row in csv_reader: |
| 14 | data.append(row) |
| 15 | |
| 16 | data = np.array(data)[:, 1] |
| 17 | |
| 18 | for i in data: |
| 19 | file_t = f"NOM_Si_640e_bank{i}.dat" |
| 20 | if os.path.exists(file_t): |
| 21 | os.remove(file_t) |
| 22 | print(f"File {file_t} removed.") |
yuanpeng / remove_invalid_banks.py
Last active 2 months ago