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

Add GUIDE watermark #834

Merged
merged 2 commits into from
Jun 5, 2024
Merged
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
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
Loading