Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
gautam-404 committed Nov 15, 2023
2 parents d6da847 + b84f577 commit b02383a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
17 changes: 4 additions & 13 deletions mesaport/Access/gyre_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,13 @@ def check_env(self):
if "GYRE_DIR" not in os.environ:
raise EnvironmentError("GYRE_DIR is not set in your enviroment. Be sure to set it properly!!")

def load(self, gyre_in="gyre.in"):
def load(self, gyre_in="gyre.in", dest=None):
"""
Loads the GYRE input file into the project directory.
"""
dest = os.path.join(self.projectDir, 'gyre.in')
if os.path.exists(gyre_in):
shutil.copy(gyre_in, dest)
elif os.path.exists(os.path.join(self.projectDir, gyre_in)):
gyre_in = os.path.join(self.projectDir, gyre_in)
shutil.copy(gyre_in, dest)
elif os.path.exists(os.path.join("LOGS", gyre_in)):
gyre_in = os.path.join("LOGS", gyre_in)
shutil.copy(gyre_in, dest)
else:
raise FileNotFoundError(f"Could not find the your specified GYRE input file, '{gyre_in}'. Aborting...")
self.gyre_in = os.path.join(self.projectDir, gyre_in)
if dest is None:
dest = os.path.join(self.projectDir, "LOGS", 'gyre.in')
shutil.copy(gyre_in, dest)

def gyreDefaults(self):
"""Reads the defaults files and returns a dictionary with all the parameters and their values.
Expand Down
2 changes: 1 addition & 1 deletion mesaport/ProjectOps/ops_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run_subprocess(commands, wdir, silent=True, runlog='', status=None,
"""
if gyre_in is not None:
gyre_obj = GyreAccess(wdir)
gyre_obj.load(gyre_in=gyre_in)
gyre_obj.load(gyre_in=gyre_in, dest=wdir)
if parallel:
num = filename.split(".")[0]
shutil.copy(gyre_in, os.path.join(wdir, f"gyre{num}.in"))
Expand Down

0 comments on commit b02383a

Please sign in to comment.