Skip to content

Commit

Permalink
Merge pull request #445 from NeurodataWithoutBorders/neuralynx2
Browse files Browse the repository at this point in the history
Add Neuralynx Recording
  • Loading branch information
CodyCBakerPhD authored Oct 17, 2023
2 parents b2db7cf + 488c917 commit 6395832
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
3 changes: 2 additions & 1 deletion guideGlobalMetadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"MEArecRecordingInterface",
"PlexonRecordingInterface",
"PlexonSortingInterface",
"AxonaRecordingInterface"
"AxonaRecordingInterface",
"NeuralynxRecordingInterface"
]
}
36 changes: 36 additions & 0 deletions schemas/json/generated/NeuralynxRecordingInterface.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"required": [],
"properties": {
"NeuralynxRecordingInterface": {
"required": [
"folder_path"
],
"properties": {
"folder_path": {
"format": "directory",
"type": "string"
},
"stream_name": {
"type": "string"
},
"verbose": {
"type": "boolean",
"default": false
},
"es_key": {
"type": "string",
"default": "ElectricalSeries"
}
},
"type": "object",
"additionalProperties": false
}
},
"type": "object",
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "source.schema.json",
"title": "Source data schema",
"description": "Schema for the source data, files and directories",
"version": "0.1.0"
}
6 changes: 2 additions & 4 deletions src/renderer/src/stories/FileSystemSelector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LitElement, css, html } from "lit";

import { remote } from "../electron/index";
import { fs, remote } from "../electron/index";
const { dialog } = remote;

function getObjectTypeReferenceString(type, multiple, { nested, native } = {}) {
Expand Down Expand Up @@ -126,7 +126,7 @@ export class FilesystemSelector extends LitElement {
};

#checkType = (value) => {
const isLikelyFile = value.split(".").length !== 1;
const isLikelyFile = fs ? fs.lstatSync(value).isFile() : value.split(".").length;
if ((this.type === "directory" && isLikelyFile) || (this.type === "file" && !isLikelyFile))
this.#onThrow("Incorrect filesystem object", `Please provide a <b>${this.type}</b> instead.`);
};
Expand All @@ -150,8 +150,6 @@ export class FilesystemSelector extends LitElement {

if (this.multiple && !Array.isArray(resolvedValue)) resolvedValue = [];

console.log(resolvedValue);

this.value = resolvedValue;
this.onSelect(this.value);
const event = new Event("change"); // Create a new change event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import MEArecRecordingInterfaceSchema from "../../../../../../schemas/json/gener
import PlexonRecordingInterfaceSchema from "../../../../../../schemas/json/generated/PlexonRecordingInterface.json";
import PlexonSortingInterfaceSchema from "../../../../../../schemas/json/generated/PlexonSortingInterface.json";
import AxonaRecordingInterfaceSchema from "../../../../../../schemas/json/generated/AxonaRecordingInterface.json";
import NeuralynxRecordingInterfaceSchema from "../../../../../../schemas/json/generated/NeuralynxRecordingInterface.json";

export default {
title: "Pages/Guided Mode/Source Data",
Expand Down Expand Up @@ -91,6 +92,8 @@ globalStateCopy.schema.source_data.properties.PlexonSortingInterface =
PlexonSortingInterfaceSchema.properties.PlexonSortingInterface;
globalStateCopy.schema.source_data.properties.AxonaRecordingInterface =
AxonaRecordingInterfaceSchema.properties.AxonaRecordingInterface;
globalStateCopy.schema.source_data.properties.NeuralynxRecordingInterface =
NeuralynxRecordingInterfaceSchema.properties.NeuralynxRecordingInterface;

const results = globalStateCopy.results;
for (let sub in results) {
Expand Down Expand Up @@ -265,3 +268,9 @@ const AxonaRecordingInterfaceGlobalCopy = JSON.parse(JSON.stringify(globalState)
AxonaRecordingInterfaceGlobalCopy.interfaces.interface = AxonaRecordingInterface;
AxonaRecordingInterfaceGlobalCopy.schema.source_data = AxonaRecordingInterfaceSchema;
AxonaRecordingInterface.args = { activePage, globalState: AxonaRecordingInterfaceGlobalCopy };

export const NeuralynxRecordingInterface = PageTemplate.bind({});
const NeuralynxRecordingInterfaceGlobalCopy = JSON.parse(JSON.stringify(globalState));
NeuralynxRecordingInterfaceGlobalCopy.interfaces.interface = NeuralynxRecordingInterface;
NeuralynxRecordingInterfaceGlobalCopy.schema.source_data = NeuralynxRecordingInterfaceSchema;
NeuralynxRecordingInterface.args = { activePage, globalState: NeuralynxRecordingInterfaceGlobalCopy };
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,8 @@ export class GuidedSourceDataPage extends ManagedPage {
const schema = this.info.globalState.schema.source_data;
delete schema.description;

console.log("Schema", schema);

const schemaResolved = getSourceDataSchema(schema);

console.log("Schema", schemaResolved);

const form = new JSONSchemaForm({
identifier: instanceId,
mode: "accordion",
Expand Down

0 comments on commit 6395832

Please sign in to comment.