Skip to content

Commit

Permalink
Merge branch 'main' into time-alignment-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD authored May 20, 2024
2 parents e787bd6 + ce875b5 commit 34c09fe
Show file tree
Hide file tree
Showing 26 changed files with 244 additions and 214 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ repos:
hooks:
- id: black
exclude: ^docs/
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
Expand Down
12 changes: 6 additions & 6 deletions demos/sse/test_sse_display_of_tqdm.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from flask import Flask, render_template, Response
from typing import List
import random
import asyncio
import os
import random
import sys
import time
from tqdm import tqdm as base_tqdm
from typing import List

import sys
import os
from flask import Flask, Response, render_template
from tqdm import tqdm as base_tqdm

SCRIPT_DIR = os.path.dirname(os.path.abspath(os.path.join(__file__, "..", "..", "pyflask")))
sys.path.append(os.path.dirname(SCRIPT_DIR))
Expand Down
33 changes: 33 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* Improve spacing */
.version-switcher__container.dropdown {
margin-left: 10px;
}

button.btn.version-switcher__button {
margin-bottom: 0px;
}

/* Show on hover */
.version-switcher__container.dropdown:hover .dropdown-menu {
display: block;
left: 0;
margin-top: var(--bs-dropdown-spacer);
top: 100%;
}

.dropdown-menu.show {
display: none;
}

/* Remove underline and borders */
button.btn.version-switcher__button:hover {
text-decoration: none;
}

.version-switcher__menu a.list-group-item {
border: none !important;
}

.version-switcher__menu a.list-group-item:hover {
text-decoration: none !important;
}
15 changes: 9 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import sys
import inspect
from pathlib import Path
import json
import os
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parents[0]))
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))

from conf_extlinks import extlinks, intersphinx_mapping # noqa: E402, F401


project = "NWB GUIDE"
copyright = "2022, CatalystNeuro" # TODO: how to include NWB?
author = "Garrett Flynn, Cody Baker, Ryan Ly, Oliver Ruebel, and Ben Dichter"
Expand Down Expand Up @@ -45,9 +44,9 @@
]

# These paths are either relative to html_static_path or fully qualified paths (eg. https://...)
# html_css_files = [
# "css/custom.css",
# ]
html_css_files = [
"css/custom.css",
]

linkcheck_anchors = False

Expand Down Expand Up @@ -85,6 +84,7 @@
version_match = os.environ.get("READTHEDOCS_VERSION")
with open("../package.json") as f:
release = json.load(f)["version"]

# If READTHEDOCS_VERSION doesn't exist, we're not on RTD
# If it is an integer, we're in a PR build and the version isn't correct.
# If it's "latest" → change to "dev" (that's what we want the switcher to call it)
Expand Down Expand Up @@ -144,3 +144,6 @@ def _correct_signatures(app, what, name, obj, options, signature, return_annotat

def setup(app): # This makes the data-interfaces signatures display on the docs/api, they don't otherwise
app.connect("autodoc-process-signature", _correct_signatures)

# Add custom CSS
app.add_css_file("css/custom.css")
5 changes: 3 additions & 2 deletions generateInterfaceSchema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path
import json
from neuroconv import converters, datainterfaces, NWBConverter
from pathlib import Path

from neuroconv import NWBConverter, converters, datainterfaces

filepath = Path("guideGlobalMetadata.json")
generatedJSONSchemaPath = Path("schemas", "json", "generated")
Expand Down
9 changes: 9 additions & 0 deletions guide_testing_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ pipelines:
PhySortingInterface:
folder_path: ephy_testing_data/phy/phy_example_0


SpikeGLX_v1_SingleProbe_AP:
SpikeGLXRecordingInterface:
file_path: ephy_testing_data/spikeglx/Noise4Sam_g0/Noise4Sam_g0_imec0/Noise4Sam_g0_t0.imec0.ap.bin


SpikeGLXConverter-Phy:
SpikeGLXConverterPipe:
folder_path: ephy_testing_data/spikeglx/Noise4Sam_g0
PhySortingInterface:
folder_path: ephy_testing_data/phy/phy_example_0


Suite2P_SinglePlane_SingleChannel:
metadata:
NWBFile:
Expand Down
4 changes: 2 additions & 2 deletions pyflask/apis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .startup import startup_api
from .neuroconv import neuroconv_api
from .data import data_api
from .neuroconv import neuroconv_api
from .startup import startup_api
5 changes: 2 additions & 3 deletions pyflask/apis/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import traceback

from flask_restx import Namespace, Resource, reqparse

from manageNeuroconv import generate_test_data, generate_dataset
from errorHandlers import notBadRequestException
from flask_restx import Namespace, Resource, reqparse
from manageNeuroconv import generate_dataset, generate_test_data

data_api = Namespace("data", description="API route for dataset generation in the NWB GUIDE.")

Expand Down
30 changes: 13 additions & 17 deletions pyflask/apis/neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,28 @@

import traceback

from flask_restx import Namespace, Resource, reqparse
from errorHandlers import notBadRequestException
from flask import Response, request

from manageNeuroconv.info import announcer

from flask_restx import Namespace, Resource, reqparse
from manageNeuroconv import (
get_all_interface_info,
get_all_converter_info,
locate_data,
autocomplete_format_string,
get_source_schema,
get_metadata_schema,
convert_to_nwb,
validate_metadata,
listen_to_neuroconv_events,
get_all_converter_info,
get_all_interface_info,
get_interface_alignment,
get_metadata_schema,
get_source_schema,
inspect_multiple_filesystem_objects,
inspect_nwb_file,
inspect_nwb_folder,
inspect_multiple_filesystem_objects,
upload_project_to_dandi,
listen_to_neuroconv_events,
locate_data,
upload_folder_to_dandi,
upload_multiple_filesystem_objects_to_dandi,
get_interface_alignment,
upload_project_to_dandi,
validate_metadata,
)

from errorHandlers import notBadRequestException

from manageNeuroconv.info import announcer

neuroconv_api = Namespace("neuroconv", description="Neuroconv neuroconv_api for the NWB GUIDE.")

Expand Down
3 changes: 1 addition & 2 deletions pyflask/apis/startup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""API endpoint definitions for startup operations."""

from flask_restx import Namespace, Resource

from errorHandlers import notBadRequestException
from flask_restx import Namespace, Resource

startup_api = Namespace("startup", description="API for startup commands related to the NWB GUIDE.")

Expand Down
23 changes: 12 additions & 11 deletions pyflask/app.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
"""The primary Flask server for the Python backend."""

import sys
import json
import multiprocessing
from os import kill, getpid
from os.path import isabs

from signal import SIGINT
from logging import Formatter, DEBUG
import sys
from logging import DEBUG, Formatter
from logging.handlers import RotatingFileHandler
from os import getpid, kill
from os.path import isabs
from pathlib import Path
from signal import SIGINT
from urllib.parse import unquote


# https://stackoverflow.com/questions/32672596/pyinstaller-loads-script-multiple-times#comment103216434_32677108
multiprocessing.freeze_support()


from flask import Flask, request, send_from_directory, send_file
from apis import data_api, neuroconv_api, startup_api
from flask import Flask, request, send_file, send_from_directory
from flask_cors import CORS
from flask_restx import Api, Resource

from apis import startup_api, neuroconv_api, data_api
from manageNeuroconv.info import resource_path, STUB_SAVE_FOLDER_PATH, CONVERSION_SAVE_FOLDER_PATH
from manageNeuroconv.info import (
CONVERSION_SAVE_FOLDER_PATH,
STUB_SAVE_FOLDER_PATH,
resource_path,
)

app = Flask(__name__)

Expand Down
30 changes: 14 additions & 16 deletions pyflask/manageNeuroconv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
from .info import CONVERSION_SAVE_FOLDER_PATH, STUB_SAVE_FOLDER_PATH
from .manage_neuroconv import (
get_all_interface_info,
get_all_converter_info,
locate_data,
autocomplete_format_string,
get_source_schema,
get_metadata_schema,
convert_to_nwb,
validate_metadata,
upload_project_to_dandi,
upload_folder_to_dandi,
upload_multiple_filesystem_objects_to_dandi,
listen_to_neuroconv_events,
generate_dataset,
generate_test_data,
get_all_converter_info,
get_all_interface_info,
get_interface_alignment,
get_metadata_schema,
get_source_schema,
inspect_multiple_filesystem_objects,
inspect_nwb_file,
inspect_nwb_folder,
inspect_multiple_filesystem_objects,
get_interface_alignment,
generate_test_data,
listen_to_neuroconv_events,
locate_data,
upload_folder_to_dandi,
upload_multiple_filesystem_objects_to_dandi,
upload_project_to_dandi,
validate_metadata,
)


from .info import STUB_SAVE_FOLDER_PATH, CONVERSION_SAVE_FOLDER_PATH
7 changes: 3 additions & 4 deletions pyflask/manageNeuroconv/info/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from .sse import announcer, format_sse
from .urls import (
resource_path,
CONVERSION_SAVE_FOLDER_PATH,
GUIDE_ROOT_FOLDER,
STUB_SAVE_FOLDER_PATH,
CONVERSION_SAVE_FOLDER_PATH,
resource_path,
)

from .sse import announcer, format_sse
2 changes: 1 addition & 1 deletion pyflask/manageNeuroconv/info/sse.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import queue
import json
import queue


def format_sse(data: str, event=None) -> str:
Expand Down
2 changes: 1 addition & 1 deletion pyflask/manageNeuroconv/info/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
import json
import os
import sys
from pathlib import Path


def resource_path(relative_path):
Expand Down
Loading

0 comments on commit 34c09fe

Please sign in to comment.