Skip to content

Commit

Permalink
Merge pull request #834 from NeurodataWithoutBorders/refactor_watermark
Browse files Browse the repository at this point in the history
Add GUIDE watermark
  • Loading branch information
CodyCBakerPhD authored Jun 5, 2024
2 parents ac2285b + 21aa3d0 commit f8bac78
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@

from tqdm_publisher import TQDMProgressHandler

from .info import CONVERSION_SAVE_FOLDER_PATH, GUIDE_ROOT_FOLDER, STUB_SAVE_FOLDER_PATH
from .info import (
CONVERSION_SAVE_FOLDER_PATH,
GUIDE_ROOT_FOLDER,
STUB_SAVE_FOLDER_PATH,
is_packaged,
resource_path,
)
from .info.sse import format_sse

progress_handler = TQDMProgressHandler()
Expand Down Expand Up @@ -870,7 +876,7 @@ def create_file(
info: dict,
log_url: Optional[str] = None,
) -> dict:

import neuroconv
import requests
from tqdm_publisher import TQDMProgressSubscriber

Expand Down Expand Up @@ -934,6 +940,14 @@ def update_conversion_progress(message):
progress_bar_options=progress_bar_options,
)

# Add GUIDE watermark
package_json_file_path = resource_path("../package.json" if is_packaged() else "../package.json")
with open(file=package_json_file_path) as fp:
package_json = json.load(fp=fp)
app_version = package_json["version"]
metadata["NWBFile"]["source_script"] = f"Created using NWB GUIDE v{app_version}"
metadata["NWBFile"]["source_script_file_name"] = neuroconv.__file__ # Must be included to be valid

run_conversion_kwargs = dict(
metadata=metadata,
nwbfile_path=nwbfile_path,
Expand Down

0 comments on commit f8bac78

Please sign in to comment.