diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 46d2ddb95..d8130f1ec 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -668,10 +668,36 @@ def get_interface_alignment(info: dict) -> dict: return timestamps +def configure_dataset_backends(nwbfile, backend_configuration, configuration = None): + from neuroconv.tools.nwb_helpers import get_default_backend_configuration, configure_backend + + PROPS_TO_AVOID = [ + "full_shape" + ] + + if (configuration is None): + configuration = get_default_backend_configuration(nwbfile=nwbfile, backend="hdf5") + + for name, item in backend_configuration.items(): + for key, value in item.items(): + + # Avoid setting compression options if unspecified + if (key == 'compression_options' and len(value) == 0): + setattr(configuration.dataset_configurations[name], key, None) + + # Avoid certain properties passed to the GUIDE + elif (key not in PROPS_TO_AVOID): + setattr(configuration.dataset_configurations[name], key, value) + + + configure_backend(nwbfile=nwbfile, backend_configuration=configuration) + + + def get_backend_configuration(info: dict) -> dict: import numpy as np - from neuroconv.tools.nwb_helpers import make_or_load_nwbfile, get_default_backend_configuration, HDF5BackendConfiguration, configure_backend + from neuroconv.tools.nwb_helpers import make_or_load_nwbfile, get_default_backend_configuration backend_configuration = info.get("configuration") @@ -685,11 +711,6 @@ def get_backend_configuration(info: dict) -> dict: "dtype" ] - PROPS_TO_AVOID = [ - "full_shape" - ] - - with make_or_load_nwbfile( nwbfile_path=path_info["file"], metadata=metadata, @@ -703,28 +724,13 @@ def get_backend_configuration(info: dict) -> dict: configuration = get_default_backend_configuration(nwbfile=nwbfile, backend="hdf5") if backend_configuration: - - for name, item in backend_configuration.items(): - for key, value in item.items(): - - # Avoid setting compression options if unspecified - if (key == 'compression_options' and len(value) == 0): - setattr(configuration.dataset_configurations[name], key, None) - - # Avoid certain properties passed to the GUIDE - elif (key not in PROPS_TO_AVOID): - setattr(configuration.dataset_configurations[name], key, value) - - - configure_backend(nwbfile=nwbfile, backend_configuration=configuration) - - + configure_dataset_backends(nwbfile, backend_configuration, configuration) + def custom_encoder(obj): if isinstance(obj, np.ndarray): return obj.tolist() if isinstance(obj, np.dtype): return str(obj) - # Add more types as needed raise TypeError(f"Object of type {obj.__class__.__name__} is not JSON serializable") # neuroconv_api.logger.info(default_backend_configuration) @@ -850,8 +856,9 @@ def convert_to_nwb(info: dict) -> str: else None ) - # if (backend_configuration): - # configure_backend(nwbfile=nwbfile, backend_configuration=backend_configuration) + ## NOTE: figure out how to actually set this on the output NWB file... + # if backend_configuration: + # configure_dataset_backends(nwbfile, backend_configuration) # Actually run the conversion converter.run_conversion( diff --git a/src/renderer/src/stories/List.ts b/src/renderer/src/stories/List.ts index 8a9e0c8a9..18b681df2 100644 --- a/src/renderer/src/stories/List.ts +++ b/src/renderer/src/stories/List.ts @@ -36,6 +36,10 @@ export class List extends LitElement { overflow: auto; } + ol { + margin: 0px; + } + #empty { margin: 1rem; @@ -327,10 +331,10 @@ export class List extends LitElement { this.object[i] = value; } + console.log(this) - if (isObjectContent) {} // Skip object contents - - else if (content instanceof HTMLElement) li.append(editableElement = content) + if (content instanceof HTMLElement) li.append(editableElement = content) + else if (isObjectContent) {} // Skip other object contents // Always attempt render of other items else { diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedBackendConfiguration.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedBackendConfiguration.js index 2a9a83cfb..82144007f 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedBackendConfiguration.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedBackendConfiguration.js @@ -59,7 +59,8 @@ export class GuidedBackendConfigurationPage extends ManagedPage { if (instance instanceof JSONSchemaForm) await instance.validate(); // Will throw an error in the callback } - await this.getBackendConfiguration() // Validate by trying to set backend configuration with the latest values + // NOTE: Eventually you'll want to swap this to a full stub conversion with these options (which will fail the same...) + await this.getBackendConfiguration(true, { title: "Validating backend options..." }) // Validate by trying to set backend configuration with the latest values return this.to(1); }, diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js index deb5ddc6d..a763e275b 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedStructure.js @@ -33,6 +33,10 @@ export class GuidedStructurePage extends Page { this.searchModal.toggle(false); }; + Object.assign(this.addButton.style, { + marginTop: '10px' + }) + this.addButton.innerText = "Add Format"; this.addButton.onClick = () => { this.search.shadowRoot.querySelector("input").focus(); diff --git a/src/renderer/src/stories/pages/guided-mode/options/GuidedInspectorPage.js b/src/renderer/src/stories/pages/guided-mode/options/GuidedInspectorPage.js index 6c3cb5256..8cd2911a0 100644 --- a/src/renderer/src/stories/pages/guided-mode/options/GuidedInspectorPage.js +++ b/src/renderer/src/stories/pages/guided-mode/options/GuidedInspectorPage.js @@ -115,6 +115,7 @@ export class GuidedInspectorPage extends Page { return html` ${until( (async () => { + if (fileArr.length <= 1) { this.report = inspector; @@ -147,12 +148,17 @@ export class GuidedInspectorPage extends Page { const path = getSharedPath(fileArr.map(({ info }) => info.file)); this.report = inspector; + if (!this.report) { const result = await run("inspect_folder", { path, ...options }, { title: title + "s" }); + this.report = globalState.preview.inspector = { ...result, messages: truncateFilePaths(result.messages, path), }; + + console.log(this.report, fileArr) + } if (!inspector) await this.save();