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 algo docs #232

Open
wants to merge 17 commits into
base: develop-main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ build_frontend:
docs:
rm -rf docs/_build/
poetry install --with doc --no-root
# sphinx-apidoc -f -o ./docs/_build/modules ./studio
sphinx-autobuild -b html docs docs/_build --port 8001

.PHONY: dockerhub
Expand Down
23 changes: 23 additions & 0 deletions docs/algorithms/caiman.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CaImAn
======

caiman\_cnmf
------------

.. automodule:: studio.app.optinist.wrappers.caiman.cnmf
:members:
:undoc-members:

caiman\_cnmfe
-------------

.. automodule:: studio.app.optinist.wrappers.caiman.cnmfe
:members:
:undoc-members:

caiman\_motion\_correction
--------------------------

.. automodule:: studio.app.optinist.wrappers.caiman.motion_correction
:members:
:undoc-members:
15 changes: 15 additions & 0 deletions docs/algorithms/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
**********
ALGORITHMS
**********

.. toctree::
:maxdepth: 2

caiman
suite2p
lccd

.. toctree::
:maxdepth: 3

optinist/index
9 changes: 9 additions & 0 deletions docs/algorithms/lccd.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Lccd
====

lccd\_detection
---------------

.. automodule:: studio.app.optinist.wrappers.lccd.lccd_detection
:members:
:undoc-members:
16 changes: 16 additions & 0 deletions docs/algorithms/optinist/basic_neural_analysis.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Basic Neural Analysis
=====================

cell\_grouping
--------------

.. automodule:: studio.app.optinist.wrappers.optinist.basic_neural_analysis.cell_grouping
:members:
:undoc-members:

eta
---

.. automodule:: studio.app.optinist.wrappers.optinist.basic_neural_analysis.eta
:members:
:undoc-members:
30 changes: 30 additions & 0 deletions docs/algorithms/optinist/dimension_reduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Dimension Reduction
==================

cca
---

.. automodule:: studio.app.optinist.wrappers.optinist.dimension_reduction.cca
:members:
:undoc-members:

dpca\_fit
---------

.. automodule:: studio.app.optinist.wrappers.optinist.dimension_reduction.dpca_fit
:members:
:undoc-members:

pca
---

.. automodule:: studio.app.optinist.wrappers.optinist.dimension_reduction.pca
:members:
:undoc-members:

tsne
----

.. automodule:: studio.app.optinist.wrappers.optinist.dimension_reduction.tsne
:members:
:undoc-members:
11 changes: 11 additions & 0 deletions docs/algorithms/optinist/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**********
OptiNiSt
**********

.. toctree::
:maxdepth: 2

basic_neural_analysis
dimension_reduction
neural_decoding
neural_population_analysis
23 changes: 23 additions & 0 deletions docs/algorithms/optinist/neural_decoding.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Neural Decoding
===============

glm
---

.. automodule:: studio.app.optinist.wrappers.optinist.neural_decoding.glm
:members:
:undoc-members:

lda
---

.. automodule:: studio.app.optinist.wrappers.optinist.neural_decoding.lda
:members:
:undoc-members:

svm
---

.. automodule:: studio.app.optinist.wrappers.optinist.neural_decoding.svm
:members:
:undoc-members:
23 changes: 23 additions & 0 deletions docs/algorithms/optinist/neural_population_analysis.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Neural Population Analysis
==========================

correlation
-----------

.. automodule:: studio.app.optinist.wrappers.optinist.neural_population_analysis.correlation
:members:
:undoc-members:

cross\_correlation
------------------

.. automodule:: studio.app.optinist.wrappers.optinist.neural_population_analysis.cross_correlation
:members:
:undoc-members:

granger
-------

.. automodule:: studio.app.optinist.wrappers.optinist.neural_population_analysis.granger
:members:
:undoc-members:
30 changes: 30 additions & 0 deletions docs/algorithms/suite2p.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Suite2p
=======

suite2p\_file\_convert
----------------------

.. automodule:: studio.app.optinist.wrappers.suite2p.file_convert
:members:
:undoc-members:

suite2p\_registration
---------------------

.. automodule:: studio.app.optinist.wrappers.suite2p.registration
:members:
:undoc-members:

suite2p\_roi
------------

.. automodule:: studio.app.optinist.wrappers.suite2p.roi
:members:
:undoc-members:

suite2p\_spike\_deconv
----------------------

.. automodule:: studio.app.optinist.wrappers.suite2p.spike_deconv
:members:
:undoc-members:
11 changes: 9 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import os
import sys
from datetime import datetime

# -- Path setup --------------------------------------------------------------
Expand All @@ -13,7 +14,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#

sys.path.insert(0, os.path.abspath("../studio"))

# -- Project information -----------------------------------------------------
project = "OptiNiSt"
Expand Down Expand Up @@ -44,11 +45,16 @@
"sphinx.ext.extlinks",
"sphinx.ext.autodoc.typehints",
"sphinx_copybutton",
"sphinxcontrib.autodoc_pydantic",
]

# autodoc_pydantic config
autodoc_pydantic_model_show_field_summary = False
autodoc_pydantic_settings_show_json_error_strategy = "coerce"
autodoc_pydantic_model_show_json = False

# Tell myst-parser to assign header anchors for h1-h3.
myst_heading_anchors = 4

suppress_warnings = ["myst.header"]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -79,6 +85,7 @@
html_show_sourcelink = False

autosummary_generate = True
napoleon_custom_sections = [("Returns", "params_style")]

html_theme_options = {
"canonical_url": "",
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Main Features
installation/index
tutorials
gui/index
algorithms/index
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ノード関数ファイルの編集方法(以下での説明内容)のテキストは、docs の配下への格納でしょうか。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらToDo漏れていましたね、そちらのドキュメントを更新します。

host_for_multiuser/index
utils/index
for_developers/index
4 changes: 1 addition & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ const App: FC = () => {
dispatch(getModeStandalone())
.unwrap()
.catch(() => {
new Promise((resolve) =>
setTimeout(resolve, RETRY_WAIT),
).then(() => {
new Promise((resolve) => setTimeout(resolve, RETRY_WAIT)).then(() => {
getMode()
})
})
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/nwb/NWB.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BASE_URL } from "const/API"
import axios from "utils/axios"
import { ParamDTO } from "utils/param/ParamType"
import { ParamMap } from "utils/param/ParamType"

export async function getNWBParamsApi(): Promise<ParamDTO> {
export async function getNWBParamsApi(): Promise<ParamMap> {
const response = await axios.get(`${BASE_URL}/nwb`)
return response.data
}
4 changes: 2 additions & 2 deletions frontend/src/api/params/Params.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BASE_URL } from "const/API"
import axios from "utils/axios"
import { ParamDTO } from "utils/param/ParamType"
import { ParamMap } from "utils/param/ParamType"

export async function getAlgoParamsApi(algoName: string): Promise<ParamDTO> {
export async function getAlgoParamsApi(algoName: string): Promise<ParamMap> {
const response = await axios.get(`${BASE_URL}/params/${algoName}`)
return response.data
}
8 changes: 4 additions & 4 deletions frontend/src/api/run/Run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import type {
} from "store/slice/FlowElement/FlowElementType"
import type { FILE_TYPE } from "store/slice/InputNode/InputNodeType"
import axios from "utils/axios"
import type { ParamMap } from "utils/param/ParamType"
import type { ParamMapWithoutMeta } from "utils/param/ParamType"

export type RunPostData = {
name: string
nodeDict: NodeDict
edgeDict: EdgeDict
nwbParam: ParamMap
snakemakeParam: ParamMap
nwbParam: ParamMapWithoutMeta
snakemakeParam: ParamMapWithoutMeta
forceRunList: { nodeId: string; name: string }[]
}

Expand All @@ -39,7 +39,7 @@ export interface InputNodePostData extends InputNodeData {

export interface AlgorithmNodePostData extends AlgorithmNodeData {
path: string
param: ParamMap
param: ParamMapWithoutMeta
}

export async function runApi(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/api/snakemake/Snakemake.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BASE_URL } from "const/API"
import axios from "utils/axios"
import { ParamDTO } from "utils/param/ParamType"
import { ParamMap } from "utils/param/ParamType"

export async function getSnakemakeParamsApi(): Promise<ParamDTO> {
export async function getSnakemakeParamsApi(): Promise<ParamMap> {
const response = await axios.get(`${BASE_URL}/snakemake`)
return response.data
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { createAsyncThunk } from "@reduxjs/toolkit"

import { getAlgoParamsApi } from "api/params/Params"
import { ALGORITHM_NODE_SLICE_NAME } from "store/slice/AlgorithmNode/AlgorithmNodeType"
import { ParamDTO } from "utils/param/ParamType"
import { ParamMap } from "utils/param/ParamType"

export const getAlgoParams = createAsyncThunk<
ParamDTO,
ParamMap,
{ nodeId: string; algoName: string }
>(
`${ALGORITHM_NODE_SLICE_NAME}/getAlgoParams`,
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/store/slice/AlgorithmNode/AlgorithmNodeSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
importWorkflowConfig,
fetchWorkflow,
} from "store/slice/Workflow/WorkflowActions"
import { convertToParamMap, getChildParam } from "utils/param/ParamUtils"
import { getChildParam } from "utils/param/ParamUtils"

const initialState: AlgorithmNode = {}

Expand Down Expand Up @@ -50,7 +50,7 @@ export const algorithmNodeSlice = createSlice({
builder
.addCase(getAlgoParams.fulfilled, (state, action) => {
const { nodeId } = action.meta.arg
state[nodeId].params = convertToParamMap(action.payload)
state[nodeId].params = action.payload
})
.addCase(addAlgorithmNode.fulfilled, (state, action) => {
const { node, functionPath, name, runAlready } = action.meta.arg
Expand All @@ -59,7 +59,7 @@ export const algorithmNodeSlice = createSlice({
state[node.id] = {
functionPath,
name,
params: convertToParamMap(params),
params: params,
isUpdated: runAlready ?? false,
}
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/slice/FlowElement/FlowElementActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import {
NodeData,
} from "store/slice/FlowElement/FlowElementType"
import { FILE_TYPE } from "store/slice/InputNode/InputNodeType"
import { ParamDTO } from "utils/param/ParamType"
import { ParamMap } from "utils/param/ParamType"

export type AddingNodeData = Omit<Node<NodeData>, "position"> &
Partial<Pick<Node<NodeData>, "position">>

export const addAlgorithmNode = createAsyncThunk<
ParamDTO,
ParamMap,
{
node: AddingNodeData
functionPath: string
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/slice/NWB/NWBAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { createAsyncThunk } from "@reduxjs/toolkit"

import { getNWBParamsApi } from "api/nwb/NWB"
import { NWB_SLICE_NAME } from "store/slice/NWB/NWBType"
import { ParamDTO } from "utils/param/ParamType"
import { ParamMap } from "utils/param/ParamType"

export const getNWBParams = createAsyncThunk<ParamDTO, void>(
export const getNWBParams = createAsyncThunk<ParamMap, void>(
`${NWB_SLICE_NAME}/getNWBParams`,
async (_, thunkAPI) => {
const { rejectWithValue } = thunkAPI
Expand Down
Loading