From 0752b169dac98c8a776726d2e2dce3d6a5ec238a Mon Sep 17 00:00:00 2001 From: Kyu Hyun Lee Date: Tue, 9 May 2023 23:56:29 -0700 Subject: [PATCH 1/7] Save LFP as pynwb.ecephys.LFP --- src/spyglass/common/common_filter.py | 7 +++++-- src/spyglass/lfp/v1/lfp.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/spyglass/common/common_filter.py b/src/spyglass/common/common_filter.py index 701f92d31..931000525 100644 --- a/src/spyglass/common/common_filter.py +++ b/src/spyglass/common/common_filter.py @@ -254,8 +254,11 @@ def filter_data_nwb( electrodes=electrode_table_region, timestamps=np.empty(output_shape_list[time_axis]), ) - # Add the electrical series to the scratch area - nwbf.add_scratch(es) + lfp = pynwb.ecephys.LFP(electrical_series=es) + ecephys_module = nwbf.create_processing_module( + name="ecephys", description="filtered extracellular electrophysiology data" + ) + ecephys_module.add(lfp) io.write(nwbf) # reload the NWB file to get the h5py objects for the data and the timestamps diff --git a/src/spyglass/lfp/v1/lfp.py b/src/spyglass/lfp/v1/lfp.py index 41b4953ed..8140f3fd8 100644 --- a/src/spyglass/lfp/v1/lfp.py +++ b/src/spyglass/lfp/v1/lfp.py @@ -533,8 +533,11 @@ def make(self, key): electrodes=electrode_table_region, timestamps=new_timestamps, ) - # Add the electrical series to the scratch area - nwbf.add_scratch(es) + lfp = pynwb.ecephys.LFP(electrical_series=es) + ecephys_module = nwbf.create_processing_module( + name="ecephys", description="processed LFP band data" + ) + ecephys_module.add(lfp) io.write(nwbf) filtered_data_object_id = es.object_id # From 9fb9d7bf65f583ac7bf7d21efbce8e88019ee621 Mon Sep 17 00:00:00 2001 From: Eric Denovellis Date: Wed, 10 May 2023 07:41:04 -0700 Subject: [PATCH 2/7] Fix formatting --- src/spyglass/common/common_filter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spyglass/common/common_filter.py b/src/spyglass/common/common_filter.py index 931000525..c5b8b235d 100644 --- a/src/spyglass/common/common_filter.py +++ b/src/spyglass/common/common_filter.py @@ -256,7 +256,8 @@ def filter_data_nwb( ) lfp = pynwb.ecephys.LFP(electrical_series=es) ecephys_module = nwbf.create_processing_module( - name="ecephys", description="filtered extracellular electrophysiology data" + name="ecephys", + description="filtered extracellular electrophysiology data" ) ecephys_module.add(lfp) io.write(nwbf) From 5243b21096c6ed91f84477547b8051ce9b4ca3ce Mon Sep 17 00:00:00 2001 From: Eric Denovellis Date: Wed, 10 May 2023 07:43:18 -0700 Subject: [PATCH 3/7] Fix formatting --- src/spyglass/common/common_filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spyglass/common/common_filter.py b/src/spyglass/common/common_filter.py index c5b8b235d..9d40c5f50 100644 --- a/src/spyglass/common/common_filter.py +++ b/src/spyglass/common/common_filter.py @@ -257,7 +257,7 @@ def filter_data_nwb( lfp = pynwb.ecephys.LFP(electrical_series=es) ecephys_module = nwbf.create_processing_module( name="ecephys", - description="filtered extracellular electrophysiology data" + description="filtered extracellular electrophysiology data", ) ecephys_module.add(lfp) io.write(nwbf) From 6026d8482c77f84a03105548573ba0e53ba1a3ab Mon Sep 17 00:00:00 2001 From: Kyu Hyun Lee Date: Mon, 20 May 2024 10:32:42 -0700 Subject: [PATCH 4/7] Don't reinsert name --- src/spyglass/common/common_lab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spyglass/common/common_lab.py b/src/spyglass/common/common_lab.py index c5a6fbc00..a098af2cf 100644 --- a/src/spyglass/common/common_lab.py +++ b/src/spyglass/common/common_lab.py @@ -192,7 +192,7 @@ def create_new_team( member_list = [] for team_member in team_members: - LabMember.insert_from_name(team_member) + # LabMember.insert_from_name(team_member) query = ( LabMember.LabMemberInfo() & {"lab_member_name": team_member} ).fetch("google_user_name") From 105eefda53e04eb2999d981e6e1506915e27f2e6 Mon Sep 17 00:00:00 2001 From: CBroz1 Date: Tue, 21 May 2024 13:46:25 -0500 Subject: [PATCH 5/7] Recompose name --- src/spyglass/common/common_lab.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/spyglass/common/common_lab.py b/src/spyglass/common/common_lab.py index a098af2cf..7f88cf69d 100644 --- a/src/spyglass/common/common_lab.py +++ b/src/spyglass/common/common_lab.py @@ -64,9 +64,9 @@ def insert_from_nwbfile(cls, nwbf): # each person is by default the member of their own LabTeam # (same as their name) - full_name, _, _ = decompose_name(experimenter) + full_name, first, last = decompose_name(experimenter) LabTeam.create_new_team( - team_name=full_name, team_members=[full_name] + team_name=full_name, team_members=[f"{last}, {first}"] ) @classmethod @@ -192,9 +192,10 @@ def create_new_team( member_list = [] for team_member in team_members: - # LabMember.insert_from_name(team_member) + LabMember.insert_from_name(team_member) + full_name, _, _ = decompose_name(team_member) query = ( - LabMember.LabMemberInfo() & {"lab_member_name": team_member} + LabMember.LabMemberInfo() & {"lab_member_name": full_name} ).fetch("google_user_name") if not query: logger.info( From 3716a9f3b02cf5ac69883d3d051777f8cc12ccc5 Mon Sep 17 00:00:00 2001 From: CBroz1 Date: Tue, 21 May 2024 15:10:03 -0500 Subject: [PATCH 6/7] Fix second referece to --- src/spyglass/common/common_lab.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spyglass/common/common_lab.py b/src/spyglass/common/common_lab.py index 7f88cf69d..de2ad8079 100644 --- a/src/spyglass/common/common_lab.py +++ b/src/spyglass/common/common_lab.py @@ -193,10 +193,10 @@ def create_new_team( member_list = [] for team_member in team_members: LabMember.insert_from_name(team_member) - full_name, _, _ = decompose_name(team_member) - query = ( - LabMember.LabMemberInfo() & {"lab_member_name": full_name} - ).fetch("google_user_name") + member_dict = {"lab_member_name": decompose_name(team_member)[0]} + query = (LabMember.LabMemberInfo() & member_dict).fetch( + "google_user_name" + ) if not query: logger.info( f"Please add the Google user ID for {team_member} in " @@ -204,7 +204,7 @@ def create_new_team( ) labteammember_dict = { "team_name": team_name, - "lab_member_name": team_member, + **member_dict, } member_list.append(labteammember_dict) # clear cache for this member From 7450df5557584a3ef8891e871c7595ad33315612 Mon Sep 17 00:00:00 2001 From: Eric Denovellis Date: Wed, 29 May 2024 10:16:23 -0700 Subject: [PATCH 7/7] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54d6f087b..9bd9809f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ - DLC - Allow dlc without pre-existing tracking data #973, #975 +- Common + - Don't insert lab member when creating lab team #983 ## [0.5.2] (April 22, 2024)