Skip to content

Commit

Permalink
Merge pull request #72 from NREL/cleanup
Browse files Browse the repository at this point in the history
Minor cleanup
  • Loading branch information
fmuni authored Dec 13, 2024
2 parents 4522199 + 614660b commit dcd1d55
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 16 deletions.
3 changes: 2 additions & 1 deletion bird/calibration/param_nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ def prepareLog(self):
os.makedirs(self.log_loss_folder, exist_ok=True)
try:
os.remove(os.path.join(self.log_loss_folder, "log.csv"))
except:
except FileNotFoundError as err:
print(err)
pass
# Make log headers
f = open(os.path.join(self.log_loss_folder, "log.csv"), "a+")
Expand Down
3 changes: 2 additions & 1 deletion bird/preprocess/inhomogeneousBC/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def binInfo(phasePropFile):

try:
shutil.rmtree("IC_inhomo")
except FileNotFoundError:
except FileNotFoundError as err:
print(err)
pass
shutil.copytree("IC", "IC_inhomo")

Expand Down
2 changes: 1 addition & 1 deletion bird/utilities/mathtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def conditionalAverage(x, y, nbin):
try:
assert len(x) == len(y)
except:
except AssertionError:
print("conditional average x and y have different dimension")
print("dim x = ", len(x))
print("dim y = ", len(y))
Expand Down
7 changes: 5 additions & 2 deletions bird/utilities/ofio.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ def readOFScal(file, nCells, nHeader=None):
nHeader = iline + 2
f.close()
Array = np.loadtxt(file, skiprows=nHeader, max_rows=nCells)
except:
except Exception as err:
print("Issue when reading %s" % file)
print(err)
sys.exit()
return Array

Expand Down Expand Up @@ -77,8 +78,9 @@ def readOFVec(file, nCells, nHeader=None):
Array[i, 1] = float(Array[i, 1])
Array[i, 2] = float(Array[i, 2][:-1])
Array = np.array(Array).astype(float)
except:
except Exception as err:
print("Issue when reading %s" % file)
print(err)
sys.exit()

return Array
Expand Down Expand Up @@ -135,6 +137,7 @@ def getCaseTimes(casePath):
try:
a = float(entry)
except ValueError:
print(f"{entry} not a time folder, removing")
a = times_tmp.pop(i)
# print('removed ', a)
time_float = [float(entry) for entry in times_tmp]
Expand Down
3 changes: 2 additions & 1 deletion papers/co2_model/calibration/binBreakup/bcr_nn_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def prepareLog(self):
os.makedirs(self.log_loss_folder, exist_ok=True)
try:
os.remove(os.path.join(self.log_loss_folder, "log.csv"))
except:
except FileNotFoundError as err:
print(err)
pass
# Make log headers
f = open(os.path.join(self.log_loss_folder, "log.csv"), "a+")
Expand Down
3 changes: 2 additions & 1 deletion papers/co2_model/calibration/breakup/bcr_nn_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def prepareLog(self):
os.makedirs(self.log_loss_folder, exist_ok=True)
try:
os.remove(os.path.join(self.log_loss_folder, "log.csv"))
except:
except FileNotFoundError as err:
print(err)
pass
# Make log headers
f = open(os.path.join(self.log_loss_folder, "log.csv"), "a+")
Expand Down
3 changes: 2 additions & 1 deletion papers/sparger/sparger_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def setupCaseFolder(
):
try:
rmtree(target_folder)
except:
except FileNotFoundError as err:
print(err)
pass
os.makedirs(target_folder)

Expand Down
3 changes: 0 additions & 3 deletions tutorial_cases/bubble_column_20L/.vim/.netrwhist

This file was deleted.

3 changes: 0 additions & 3 deletions tutorial_cases/loop_reactor_mixing/.vim/.netrwhist

This file was deleted.

2 changes: 1 addition & 1 deletion tutorial_cases/loop_reactor_mixing/presteps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ writeMeshObj

echo PRESTEP 3
python writeGlobalVars.py
cp constant/phaseProperties_constantd constant/phaseProperties
cp constant/phaseProperties_pbe constant/phaseProperties

conda deactivate

Expand Down
2 changes: 1 addition & 1 deletion tutorial_cases/loop_reactor_mixing/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ writeMeshObj

echo PRESTEP 3
python writeGlobalVars.py
cp constant/phaseProperties_constantd constant/phaseProperties
cp constant/phaseProperties_pbe constant/phaseProperties

#conda deactivate

Expand Down

0 comments on commit dcd1d55

Please sign in to comment.