Skip to content
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
509 changes: 359 additions & 150 deletions PV_tool0.4.ipynb

Large diffs are not rendered by default.

15,785 changes: 15,785 additions & 0 deletions PV_tool0.5 - backup.ipynb

Large diffs are not rendered by default.

15,933 changes: 15,933 additions & 0 deletions PV_tool0.5.ipynb

Large diffs are not rendered by default.

Binary file not shown.
260 changes: 132 additions & 128 deletions pv_tool/cphi_analysis/c_phi_analysis.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resultaten/TXT_klei_14_16.html

Large diffs are not rendered by default.

Binary file modified resultaten/c_phi_data_geforceerd.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified resultaten/temp_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resultaten/temp_plot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resultaten/temp_plot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resultaten/temp_plot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test_files/Template_PVtool5_0.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
52 changes: 52 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
os.environ["GIT_PYTHON_REFRESH"] = "quiet"
import git
from typing import Optional
import datetime


def get_repo_root(root_search_dir: Optional[str] = None) -> str:
"""Returns the repository root by searching in the given directory and its subdirectories.

:param root_search_dir: The given directory in which it will search for the repository root. It will also
search in the subdirectories of this given directory. If not provided (i.e. None) then function will use
os.getcwd().
:return:
"""

# Determine search directory
if root_search_dir is None:
root_search_dir = os.getcwd()

# Initial search at that directory
try:
repo = git.Repo(root_search_dir, search_parent_directories=False)
return repo.working_tree_dir
except git.InvalidGitRepositoryError:
pass

# After that subdirectories
for subdir, dirs, files in os.walk(os.getcwd()):
for directory in dirs:
try:
repo = git.Repo(os.path.join(subdir, directory), search_parent_directories=False)
return repo.working_tree_dir
except git.InvalidGitRepositoryError:
continue

# Last resort: search parent directories
repo = git.Repo(root_search_dir, search_parent_directories=True)
return repo.working_tree_dir


def make_temp_folder(parent_folder: Optional[str] = None, add_microseconds: bool = False) -> str:
timestamp_expression = "%Y%m%d_%H%M%S.%f"
now = datetime.datetime.now().strftime(timestamp_expression)
if not add_microseconds:
now = now[:-7]
if parent_folder is not None:
export_dir = os.path.join(parent_folder, f"Temp_{now}")
else:
export_dir = os.path.join(get_repo_root(), "_temp_files", f"Temp_{now}")
os.makedirs(export_dir, exist_ok=True)
return export_dir
Loading