Skip to content

Commit 7c46dee

Browse files
authored
Merge pull request #39 from ssciwr/fix_38_mock_nwb_metadata
add `get_sample_nwb_metadata()`
2 parents 2111315 + 2650f48 commit 7c46dee

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

mease_elabftw/nwb.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,50 @@ def validate_pynwb_data(nwb_metadata):
206206
io.close()
207207

208208
return validation_bool
209+
210+
211+
def get_sample_nwb_metadata(experiment_id):
212+
"""
213+
Returns sample NWB metadata for testing purposes without needing an ElabFTW token.
214+
215+
:param experiment_id: Ignored - this function always returns the same sample metadata
216+
217+
:return: Sample NWB metadata
218+
:rtype: dict
219+
"""
220+
221+
# Output of get_nwb_metadata(156) with a valid elabftw token.
222+
# Note: this needs to be updated when this output changes.
223+
return {
224+
"NWBFile": {
225+
"session_description": "test fake experiment with json metadata",
226+
"identifier": "20211001-8b6f100d66f4312d539c52620f79d6a503c1e2d1",
227+
"session_start_time": "2021-10-01 11:13:47",
228+
"experimenter": ["Liam Keegan"],
229+
"institution": "Heidelberg University, Physiology and Pathophysiology",
230+
"lab": "Medical Biophysics, Groh/Mease",
231+
"virus": "AAVretr ChR2-tdTomato:\n * Virus in -80 storage: AAVrg-CAG-hChR2-tdTomato (AAV Retrograde)\n * Origin: Addgene\n * Comments: retrograde\n * Expression Quality: \n * product number: \nAAVretr Flpo:\n * Virus in -80 storage: AAVretr EF1a-Flpo\n * Origin: Addgene\n * Comments: retrograde Flip\n * Expression Quality: \n * product number: 55637-AAVrg\n",
232+
},
233+
"Subject": {
234+
"sex": "unknown",
235+
"weight": 0.002,
236+
"genotype": "Nt1Cre-ChR2-EYFP",
237+
"subject_id": "xy1",
238+
"description": "test mouse",
239+
"date_of_birth": "2000-01-01",
240+
},
241+
"Ecephys": {},
242+
"Other": {
243+
"OptogeneticStimulationSite": {
244+
"device": "the device",
245+
"location": "S1: primary somatosensory cortex",
246+
"description": "laser stimulation",
247+
"excitation_lambda": "473",
248+
},
249+
"SiliconProbe": {
250+
"Probe identifier:": "1234356",
251+
"ElectrodeGroup.name": "H5",
252+
"ElectrodeGroup.description": "a test H5 probe",
253+
},
254+
},
255+
}

mease_elabftw/tests/test_nwb.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,9 @@ def test_validate_pynwb_data():
113113
nwb_metadata["NWBFile"]["session_start_time"] = ""
114114
with pytest.raises(ValueError) as ValueError_info:
115115
mease_elabftw.nwb.validate_pynwb_data(nwb_metadata)
116+
117+
118+
def test_get_sample_nwb_metadata():
119+
nwb_metadata = mease_elabftw.nwb.get_nwb_metadata(test_ids.valid_experiment)
120+
sample_nwb_metadata = mease_elabftw.nwb.get_sample_nwb_metadata(123)
121+
assert nwb_metadata == sample_nwb_metadata

0 commit comments

Comments
 (0)