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

Camstim ephys #144

Merged
merged 119 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 115 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
4f493af
add camstim session object
rcpeene May 3, 2024
f84515c
bump schema version
rcpeene May 6, 2024
275a974
Fix syntax
rcpeene May 6, 2024
17302c7
correct variable name
rcpeene May 6, 2024
1dfaa25
remove opto table generation. that should be handled outside this repo
rcpeene May 6, 2024
835e610
Add test
rcpeene May 6, 2024
993ee93
pep codestyle
rcpeene May 6, 2024
53fb855
Lint and update tests and docstrings
rcpeene May 6, 2024
ac62ba8
Merge branch 'main' into camstim-ephys
rcpeene May 6, 2024
ebb8d46
merge main into branch
mekhlakapoor May 13, 2024
5e9c420
linters
mekhlakapoor May 13, 2024
2aa9636
Rename CamstimSession -> CamstimEphysSession
rcpeene May 14, 2024
d450910
Merge branch 'camstim-ephys' of https://github.com/AllenNeuralDynamic…
rcpeene May 14, 2024
9b29e56
Merge branch 'main' of https://github.com/AllenNeuralDynamics/aind-me…
rcpeene May 14, 2024
ecffa15
Adjust for new data schema imports. split camstim into camstim ephys …
rcpeene May 15, 2024
fe644e6
Lint, fix tests
rcpeene May 15, 2024
4f26333
remove dependency npc_session
rcpeene May 15, 2024
ce3dde9
fix bug with retrieving probe letter. fix bug with incorrect import o…
rcpeene May 16, 2024
e706890
adding pkl functions
Ahad-Allen May 16, 2024
214c39e
porting over utils
Ahad-Allen May 16, 2024
5b04501
adding start and stop time functions
Ahad-Allen May 16, 2024
2b1869e
renaming utils
Ahad-Allen May 16, 2024
8d11041
Merge branch 'camstim-ephys' of https://github.com/AllenNeuralDynamic…
Ahad-Allen May 16, 2024
24c8b4b
fix imports; replace npc_sync function with local sync_utils to elimi…
rcpeene May 16, 2024
c68c70b
woops! remove while(true) from cheap debugging
rcpeene May 16, 2024
c7e443d
documentation
Ahad-Allen May 17, 2024
5412d67
Merge branch 'camstim-ephys' of https://github.com/AllenNeuralDynamic…
Ahad-Allen May 17, 2024
90e2081
documentation
Ahad-Allen May 17, 2024
f9ffe4f
remove constants requirement
Ahad-Allen May 17, 2024
99e5de8
linting
Ahad-Allen May 17, 2024
2835b59
added build_stimulus_table and build_optogenetics_table to camstim an…
rcpeene May 17, 2024
bcb1e28
Merge branch 'camstim-ephys' of https://github.com/AllenNeuralDynamic…
rcpeene May 17, 2024
bf7e577
adding doc strings
Ahad-Allen May 17, 2024
f33a571
add docstring and option to overwrite tables for camstim and camstim-…
rcpeene May 17, 2024
0faaf6a
Merge branch 'camstim-ephys' of https://github.com/AllenNeuralDynamic…
rcpeene May 17, 2024
ce11dc7
lint a bunch of files
rcpeene May 17, 2024
1e75624
refactor overwrite_tables and opto_conditions_map into json settings …
rcpeene May 17, 2024
9fc932a
fixing naming_utils
Ahad-Allen May 17, 2024
81de5fc
fixing merge
Ahad-Allen May 17, 2024
044d885
fix imports
rcpeene May 17, 2024
9e2f46a
lint
rcpeene May 17, 2024
317222a
fix function header
rcpeene May 17, 2024
6eaea08
remove NA for stim names when missing
Ahad-Allen May 21, 2024
fbef07f
testing pkl functions
Ahad-Allen May 21, 2024
5efb706
adding naming test
Ahad-Allen May 21, 2024
b48a4f1
creating sync tests
Ahad-Allen May 21, 2024
195e3c6
cleaning up sync tests
Ahad-Allen May 21, 2024
c3f879e
adding heavily mocked tests
Ahad-Allen May 21, 2024
d12b51d
modifying ai generated tests
Ahad-Allen May 21, 2024
3e4a55d
using copilot to make tests for many scenarios
Ahad-Allen May 21, 2024
d6b8a55
basic ai cases for math functions
Ahad-Allen May 21, 2024
fef571c
linting
Ahad-Allen May 22, 2024
26679ad
resolve conflicts
mekhlakapoor May 24, 2024
8d17180
WIP: linters
mekhlakapoor May 24, 2024
9e272ad
removing long comments from naming
Ahad-Allen May 24, 2024
932ae94
removing long comments from pkl
Ahad-Allen May 24, 2024
8291bff
fixing excessive comments of test_sync
Ahad-Allen May 24, 2024
b4e7832
removing lambda function
Ahad-Allen May 24, 2024
6e34d6b
fixing spaces before : in sync utils
Ahad-Allen May 24, 2024
ac3ef98
fixing test_syncs
Ahad-Allen May 24, 2024
faaf61a
changing sync meta functions for tests"
Ahad-Allen May 24, 2024
38c6a09
fixing time import errors
Ahad-Allen May 24, 2024
13500a9
fixing sync import errors
Ahad-Allen May 24, 2024
f433353
fixing more sync import errors
Ahad-Allen May 24, 2024
cfe112b
fixing sync import issues in tons of tests
Ahad-Allen May 24, 2024
7f7e15f
fixing linting issues from importing
Ahad-Allen May 24, 2024
f21176a
moved files for coverage convention
Ahad-Allen May 28, 2024
86ac09c
adding inits.py files
Ahad-Allen May 28, 2024
18d579f
fixing test
Ahad-Allen May 29, 2024
0fa6e43
fixing failed ignore_case
Ahad-Allen May 29, 2024
3150e79
fixing test case for mapping that fails
Ahad-Allen May 29, 2024
957e41d
fixing imports in toml
Ahad-Allen May 29, 2024
5dc43c9
fixing missing doc strings
Ahad-Allen May 29, 2024
19ed574
doc strings for tests
Ahad-Allen May 29, 2024
30bf718
fixing interrogate
Ahad-Allen May 29, 2024
6828315
fixing long doc strings
Ahad-Allen May 29, 2024
d5908bf
fixing space before colon
Ahad-Allen May 29, 2024
cf5fdc1
fixing one missing doc string
Ahad-Allen May 29, 2024
6a69453
fixing imports for testing
Ahad-Allen May 29, 2024
9a4c80e
fixing import issues?
Ahad-Allen May 30, 2024
6712743
merge from main
mekhlakapoor May 31, 2024
eff2e17
moves utils into open_ephys
mekhlakapoor May 31, 2024
6d22bde
replaces prints with logger
mekhlakapoor Jun 1, 2024
6ac37dd
runs linters
mekhlakapoor Jun 3, 2024
37d8440
Merge branch 'main' into camstim-ephys
mekhlakapoor Jun 7, 2024
ca6a5c5
utils coverage
mekhlakapoor Jun 7, 2024
4625cf2
excluse E203 flake8
mekhlakapoor Jun 7, 2024
5f89f0e
fix linter
mekhlakapoor Jun 7, 2024
4a3c6dd
WIP: tests for behavior and stim utils
mekhlakapoor Jun 7, 2024
08b44ad
adding some tests for stim utils
Ahad-Allen Jun 12, 2024
7d9811c
generating and cleaning the rest of the func tests
Ahad-Allen Jun 12, 2024
b49d533
all stim tests pass
Ahad-Allen Jun 12, 2024
43aaf23
finalizing behavior tests
Ahad-Allen Jun 13, 2024
b38939b
Adding imports to behavior calls
Ahad-Allen Jun 13, 2024
c9a0188
linting and fixes
Ahad-Allen Jun 13, 2024
58def7a
linting + docstrings
Ahad-Allen Jun 13, 2024
afc0bf2
forgot one docstring
Ahad-Allen Jun 13, 2024
e3116fd
fixing copy paste mistake for behavior
Ahad-Allen Jun 13, 2024
61355a9
flake8 fixes
Ahad-Allen Jun 13, 2024
84a55be
resolves conflict
mekhlakapoor Jun 13, 2024
a3124cb
moving constants to new loc
Ahad-Allen Jun 16, 2024
4a4fe5a
behavior for loop clean up
Ahad-Allen Jun 16, 2024
f312102
linting
Ahad-Allen Jun 16, 2024
ab23025
moving function into being a helper
Ahad-Allen Jun 16, 2024
eead07b
resolve merge
rcpeene Jun 18, 2024
13b7f0c
Merge branch 'camstim-ephys' of https://github.com/AllenNeuralDynamic…
rcpeene Jun 18, 2024
ebdfbd9
rename costants.py to constants.py
rcpeene Jun 18, 2024
46e8a21
fix small bugs
rcpeene Jun 18, 2024
439753e
linted and fix bug with NaNs appearing for spontaneous periods in sti…
rcpeene Jun 18, 2024
39415d5
except other errors for getting ecephys paths
rcpeene Sep 9, 2024
aab9728
Merge branch 'main' of https://github.com/AllenNeuralDynamics/aind-me…
rcpeene Sep 9, 2024
ebd8f8b
Merge branch 'main' of https://github.com/AllenNeuralDynamics/aind-me…
rcpeene Sep 9, 2024
3167039
Merge branch 'main' into camstim-ephys
rcpeene Sep 9, 2024
dbc69c7
update probe objects for latest schema;
rcpeene Sep 10, 2024
2322d97
fix assignment of stim name to accomodate multiple keys from pkl file
rcpeene Sep 10, 2024
25528e6
Merge branch 'dev' of https://github.com/AllenNeuralDynamics/aind-met…
rcpeene Sep 11, 2024
0561a40
address feedback, fix linting
rcpeene Sep 11, 2024
8f99299
address more linting
rcpeene Sep 11, 2024
8b1b653
argh linting
rcpeene Sep 11, 2024
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
8 changes: 3 additions & 5 deletions src/aind_metadata_mapper/open_ephys/camstim_ephys_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
import pandas as pd
from aind_data_schema.components.coordinates import Coordinates3d
from aind_data_schema.core.session import (
EphysModule,
EphysProbeConfig,
ManipulatorModule,
Session,
Stream,
)
Expand Down Expand Up @@ -68,7 +67,7 @@ def __init__(self, session_id: str, json_settings: dict) -> None:
self.recording_dir = npc_ephys.get_single_oebin_path(
session_inst.lims_path
).parent
except FileNotFoundError:
except:
Copy link
Contributor

Choose a reason for hiding this comment

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

why was the FileNotFoundError removed? Using a bare except without specifying an exception type will catch all exceptions, including ones that you might not intend to handle (like KeyboardInterrupt, SystemExit, or MemoryError).

This can make debugging more difficult so I'd recommend putting FileNotFoundError back or if you need to catch multiple types of errors you can do a tuple

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There was another error received here but I forget what it was. I should have written it down. I guess we can revert and if it shows up again I can commit again

self.recording_dir = npc_ephys.get_single_oebin_path(
session_inst.npexp_path
).parent
Expand Down Expand Up @@ -230,13 +229,12 @@ def ephys_modules(self) -> list:
probe_name, newscale_coords
)

probe_module = EphysModule(
probe_module = ManipulatorModule(
assembly_name=probe_name.upper(),
arc_angle=0.0,
module_angle=0.0,
rotation_angle=0.0,
primary_targeted_structure="none",
ephys_probes=[EphysProbeConfig(name=probe_name.upper())],
manipulator_coordinates=manipulator_coordinates,
notes=notes,
)
Expand Down
10 changes: 5 additions & 5 deletions src/aind_metadata_mapper/open_ephys/utils/stim_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,13 @@ def read_stimulus_name_from_path(stimulus):
"""

stim_name = stimulus["stim_path"].split("\\")[-1].split(".")[0]

if len(stim_name) == 0:
stim_name = stimulus["stim_path"].split("\\\\")[-2]


if stimulus["stim_path"] == "":
stim_name = stimulus["movie_local_path"].split("\\")[-1].split(".")[0]
else:
stim_name = stimulus["stim_path"].split("\\")[-1].split(".")[0]
return stim_name


def get_stimulus_type(stimulus):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

fill in docstrings

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like all functions here have docstrings already. am I missing something?

Obtains the stimulus type from the stimulus dictionary.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_open_ephys/test_rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from unittest.mock import MagicMock, patch

from aind_data_schema.core.rig import Rig # type: ignore

from aind_metadata_mapper.open_ephys.rig import OpenEphysRigEtl


RESOURCES_DIR = (
Path(os.path.dirname(os.path.realpath(__file__))) / ".." / "resources"
)
Expand Down
Loading