Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix remove the tracked output files from pytest #46

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ dptb/tests/data/test_all/test_config.json
dptb/tests/data/test_all/checkpoint/best_nnsk_b5.000_c6.615_w0.265.json
dptb/tests/data/test_all/checkpoint/best_nnsk_b4.000_c4.000_w0.300.json
dptb/tests/data/test_all/fancy_ones/checkpoint/best_nnsk_b4.000_c4.000_w0.300.json
dptb/tests/data/test_negf/test_negf_run/out_negf/run_config.json
run_config.json
dptb/nnet/__pycache__/
dptb/sktb/__pycache__/
dptb/negf/__pycache__/
Expand Down
3 changes: 3 additions & 0 deletions dptb/entrypoints/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def run(

task_options = j_must_have(jdata, "task_options")
task = task_options["task"]
use_gui = jdata.get("use_gui", False)
task_options.update({"use_gui": use_gui})

model_ckpt = run_opt["init_model"]["path"]
# init_type = model_ckpt.split(".")[-1]
# if init_type not in ["json", "pth"]:
Expand Down
6 changes: 4 additions & 2 deletions dptb/postprocess/bandstructure/band.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def __init__ (self, apiHrk, run_opt, jdata):
self.apiH.update_struct(self.structase)

self.ref_band = self.band_plot_options.get("ref_band", None)

self.use_gui = self.band_plot_options.get("use_gui", False)

def get_bands(self):
kline_type = self.band_plot_options['kline_type']

Expand Down Expand Up @@ -153,4 +154,5 @@ def band_plot(self):
# remove the box around the plot
ax.set_frame_on(False)
plt.savefig(f'{self.results_path}/band.png',dpi=300)
plt.show()
if self.use_gui:
plt.show()
10 changes: 7 additions & 3 deletions dptb/postprocess/bandstructure/dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__ (self, apiHrk, run_opt, jdata):
self.dos_plot_options = jdata
self.results_path = run_opt.get('results_path')
self.apiH.update_struct(self.structase)

self.use_gui = self.dos_plot_options.get("use_gui", False)

def get_dos(self):
self.mesh_grid = self.dos_plot_options['mesh_grid']
Expand Down Expand Up @@ -59,7 +59,8 @@ def dos_plot(self):
plt.tick_params(direction='in')
plt.tight_layout()
plt.savefig(f'{self.results_path}/dos.png',dpi=300)
plt.show()
if self.use_gui:
plt.show()


def _calc_dos(self, sigma=0.1, npoints=100, width=None, updata=False, kpoints=None):
Expand Down Expand Up @@ -123,6 +124,8 @@ def __init__ (self, apiHrk, run_opt, jdata):
for itype in apiHrk.structure.proj_atom_symbols:
norbs = apiHrk.structure.proj_atomtype_norbs[itype]
self.num_orbs_per_atom.append(norbs)

self.use_gui = self.pdos_plot_options.get("use_gui", False)

def get_pdos(self):
self.mesh_grid = self.pdos_plot_options['mesh_grid']
Expand Down Expand Up @@ -183,7 +186,8 @@ def pdos_plot(self, atom_index=None, orbital_index=None):
plt.tick_params(direction='in')
plt.tight_layout()
plt.savefig(f'{self.results_path}/proj_dos.png',dpi=300)
plt.show()
if self.use_gui:
plt.show()


def _calc_pdos(self, sigma=0.1, npoints=100, width=None, updata=False, kpoints=None):
Expand Down
151 changes: 0 additions & 151 deletions dptb/tests/data/test_negf/test_negf_run/out_negf/run_config.json

This file was deleted.

2 changes: 2 additions & 0 deletions dptb/utils/argcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ def normalize_run(data):
doc_structure = ""
doc_use_correction = ""
doc_overlap = ""
doc_gui = ""

args = [
Argument("onsite_cutoff", float, optional = False, doc = doc_onsite_cutoff),
Expand Down Expand Up @@ -621,6 +622,7 @@ def normalize_run(data):
mo,
Argument("structure", [str,None], optional=True, default=None, doc = doc_structure),
Argument("use_correction", [str,None], optional=True, default=None, doc = doc_use_correction),
Argument("use_gui", bool, optional=True, default=False, doc = doc_gui),
Argument("task_options", dict, sub_fields=[], optional=True, sub_variants=[task_options()], doc = doc_property)
]

Expand Down